mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Block CTRL + ESC
This commit is contained in:
@ -11,7 +11,7 @@ namespace osu.Desktop.Windows
|
|||||||
{
|
{
|
||||||
public class GameplayWinKeyHandler : Component
|
public class GameplayWinKeyHandler : Component
|
||||||
{
|
{
|
||||||
private Bindable<bool> winKeyEnabled;
|
private Bindable<bool> allowScreenSuspension;
|
||||||
private Bindable<bool> disableWinKey;
|
private Bindable<bool> disableWinKey;
|
||||||
|
|
||||||
private GameHost host;
|
private GameHost host;
|
||||||
@ -21,11 +21,11 @@ namespace osu.Desktop.Windows
|
|||||||
{
|
{
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
|
||||||
winKeyEnabled = host.AllowScreenSuspension.GetBoundCopy();
|
allowScreenSuspension = host.AllowScreenSuspension.GetBoundCopy();
|
||||||
winKeyEnabled.ValueChanged += toggleWinKey;
|
allowScreenSuspension.ValueChanged += toggleWinKey;
|
||||||
|
|
||||||
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
|
disableWinKey = config.GetBindable<bool>(OsuSetting.GameplayDisableWinKey);
|
||||||
disableWinKey.BindValueChanged(t => winKeyEnabled.TriggerChange(), true);
|
disableWinKey.BindValueChanged(t => allowScreenSuspension.TriggerChange(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toggleWinKey(ValueChangedEvent<bool> e)
|
private void toggleWinKey(ValueChangedEvent<bool> e)
|
||||||
|
@ -38,6 +38,7 @@ namespace osu.Desktop.Windows
|
|||||||
{
|
{
|
||||||
case 0x09 when lParam.Flags == 32: // alt + tab
|
case 0x09 when lParam.Flags == 32: // alt + tab
|
||||||
case 0x1b when lParam.Flags == 32: // alt + esc
|
case 0x1b when lParam.Flags == 32: // alt + esc
|
||||||
|
case 0x1b when (getKeyState(0x11) & 0x8000) != 0: //ctrl + esc
|
||||||
case 0x5B: // left windows key
|
case 0x5B: // left windows key
|
||||||
case 0x5C: // right windows key
|
case 0x5C: // right windows key
|
||||||
return 1;
|
return 1;
|
||||||
@ -78,5 +79,8 @@ namespace osu.Desktop.Windows
|
|||||||
|
|
||||||
[DllImport(@"user32.dll", EntryPoint = @"CallNextHookEx")]
|
[DllImport(@"user32.dll", EntryPoint = @"CallNextHookEx")]
|
||||||
private static extern int callNextHookEx(int hHook, int nCode, int wParam, ref KdDllHookStruct lParam);
|
private static extern int callNextHookEx(int hHook, int nCode, int wParam, ref KdDllHookStruct lParam);
|
||||||
|
|
||||||
|
[DllImport(@"user32.dll", EntryPoint = @"GetKeyState")]
|
||||||
|
private static extern int getKeyState(int vkey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user