mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 18:26:39 +02:00
[Common]fix fancy zones exclusion (#16041)
replace WS_POPUP with WS_EX_TOOLWINDOW
This commit is contained in:
committed by
GitHub
parent
49a2218358
commit
e284b07da7
@@ -14,14 +14,13 @@ using Point = System.Windows.Point;
|
||||
|
||||
namespace PowerLauncher.Helper
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")]
|
||||
public static class WindowsInteropHelper
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")]
|
||||
private const int GWL_STYLE = -16; // WPF's Message code for Title Bar's Style
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")]
|
||||
private const int GWL_EX_STYLE = -20;
|
||||
private const int WS_SYSMENU = 0x80000; // WPF's Message code for System Menu
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1310:Field names should not contain underscore", Justification = "Matching COM")]
|
||||
private const int WS_POPUP = 1 << 31; // 0x80000000
|
||||
private const int WS_EX_TOOLWINDOW = 0x00000080;
|
||||
private static IntPtr _hwnd_shell;
|
||||
private static IntPtr _hwnd_desktop;
|
||||
|
||||
@@ -172,12 +171,12 @@ namespace PowerLauncher.Helper
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set WS_POPUP to make FancyZones ignoring the Window
|
||||
/// Set WS_EX_TOOLWINDOW to make FancyZones ignoring the Window
|
||||
/// </summary>
|
||||
public static void SetPopupStyle(Window win)
|
||||
internal static void SetToolWindowStyle(Window win)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(win).Handle;
|
||||
_ = NativeMethods.SetWindowLong(hwnd, GWL_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP);
|
||||
_ = NativeMethods.SetWindowLong(hwnd, GWL_EX_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_EX_STYLE) | WS_EX_TOOLWINDOW);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user