mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Wox now has an option to ignore hotkeys when the focused window is topmost. This will ignore not only the main Wox hotkey but also plugin hotkeys.
~ WindowIntelopHelper edited ~ User settings entry added ~ Checkbox added to General tab (as well as its events) ~ Language entries added for en/ru
This commit is contained in:
@@ -10,14 +10,28 @@ namespace Wox.Helper
|
||||
public class WindowIntelopHelper
|
||||
{
|
||||
private const int GWL_STYLE = -16; //WPF's Message code for Title Bar's Style
|
||||
private const int GWL_EXSTYLE = -20; //Gets the exstyle of the window
|
||||
private const int WS_EX_TOPMOST = 0x00000008; //Topmost flag
|
||||
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);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetForegroundWindow();
|
||||
|
||||
/// <summary>
|
||||
///Checks if the foreground window is TopMost (even Wox)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsForegroundWindowTopMost()
|
||||
{
|
||||
return (GetWindowLong(GetForegroundWindow(), GWL_EXSTYLE) & WS_EX_TOPMOST) == WS_EX_TOPMOST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// disable windows toolbar's control box
|
||||
/// this will also disable system menu with Alt+Space hotkey
|
||||
|
||||
Reference in New Issue
Block a user