mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix Alt+Space hotkey affect by system
if no disable control box, sometimes awake Wox with alt+space hotkey, the first input key is swallowed by system
This commit is contained in:
parent
dbdd6c701b
commit
3b09276395
3 changed files with 34 additions and 0 deletions
31
Wox/Helper/WindowIntelopHelper.cs
Normal file
31
Wox/Helper/WindowIntelopHelper.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
namespace Wox.Helper
|
||||
{
|
||||
public class WindowIntelopHelper
|
||||
{
|
||||
private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style
|
||||
private const int WS_SYSMENU = 0x80000; //WPF's Message code for System Menu
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
|
||||
|
||||
/// <summary>
|
||||
/// disable windows toolbar's control box
|
||||
/// this will also disable system menu with Alt+Space hotkey
|
||||
/// </summary>
|
||||
public static void DisableControlBox(Window win)
|
||||
{
|
||||
var hwnd = new System.Windows.Interop.WindowInteropHelper(win).Handle;
|
||||
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +90,8 @@ namespace Wox
|
|||
InitProgressbarAnimation();
|
||||
//only works for win7+
|
||||
//DwmDropShadow.DropShadowToWindow(this);
|
||||
|
||||
WindowIntelopHelper.DisableControlBox(this);
|
||||
}
|
||||
|
||||
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@
|
|||
<Compile Include="Commands\CommandFactory.cs" />
|
||||
<Compile Include="Commands\PluginCommand.cs" />
|
||||
<Compile Include="Commands\SystemCommand.cs" />
|
||||
<Compile Include="Helper\WindowIntelopHelper.cs" />
|
||||
<Compile Include="ProgramSourceSetting.xaml.cs">
|
||||
<DependentUpon>ProgramSourceSetting.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
|
|||
Loading…
Reference in a new issue