Fallback OSK to CTRL+WIN+O

This commit is contained in:
Kamil Trzciński 2022-12-16 10:47:55 +01:00
parent 49f86225cb
commit 147ef53a7f
3 changed files with 34 additions and 14 deletions

View file

@ -15,17 +15,24 @@ namespace ExternalHelpers
public static bool Toggle()
{
StartTabTip();
try
{
StartTabTip();
var type = Type.GetTypeFromCLSID(Guid.Parse("4ce576fa-83dc-4F88-951c-9d0782b4e376"));
if (type is null)
var type = Type.GetTypeFromCLSID(Guid.Parse("4ce576fa-83dc-4F88-951c-9d0782b4e376"));
if (type is null)
return false;
var instance = (ITipInvocation?)Activator.CreateInstance(type);
if (instance is null)
return false;
instance?.Toggle(GetDesktopWindow());
Marshal.ReleaseComObject(instance);
return true;
}
catch (Exception)
{
return false;
var instance = (ITipInvocation?)Activator.CreateInstance(type);
if (instance is null)
return false;
instance?.Toggle(GetDesktopWindow());
Marshal.ReleaseComObject(instance);
return true;
}
}
static void StartTabTip()

View file

@ -36,14 +36,23 @@ namespace PowerControl
CycleOptions = false,
CurrentValue = delegate()
{
return Helpers.AudioManager.GetMasterVolume(5.0);
try { return Helpers.AudioManager.GetMasterVolume(5.0); }
catch(Exception) { return null; }
},
ApplyValue = delegate(object selected)
{
Helpers.AudioManager.SetMasterVolumeMute(false);
Helpers.AudioManager.SetMasterVolume((int)selected);
try
{
Helpers.AudioManager.SetMasterVolumeMute(false);
Helpers.AudioManager.SetMasterVolume((int)selected);
return Helpers.AudioManager.GetMasterVolume(5.0);
return Helpers.AudioManager.GetMasterVolume(5.0);
}
catch(Exception)
{
// In some cases MasterVolume device is missing
return null;
}
}
},
new Menu.MenuItemSeparator(),

View file

@ -63,7 +63,11 @@ namespace SteamController.Profiles.Default
break;
case Settings.KeyboardStyles.WindowsTouch:
OnScreenKeyboard.Toggle();
if (!OnScreenKeyboard.Toggle())
{
// Fallback to CTRL+WIN+O
c.Keyboard.KeyPress(new VirtualKeyCode[] { VirtualKeyCode.LCONTROL, VirtualKeyCode.LWIN }, VirtualKeyCode.VK_O);
}
break;
}
}