mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-15 03:07:56 +01:00
[PT Run/FancyZones] Exclude Launcher from zonable windows improvement (#9071)
* excluding launcher from fancy zones setting GWL_STYLE WS_POPUP fix WS_POPUP type * Migrate spelling-0.0.19 changes from main * rebase fix * fix spellcheck Co-authored-by: Dustin L. Howett <duhowett@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
dc08987a60
commit
57cdae724a
@@ -16,7 +16,6 @@
|
||||
// Non-Localizable strings
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const wchar_t PowerToysAppPowerLauncher[] = L"POWERTOYS.POWERLAUNCHER.EXE";
|
||||
const wchar_t PowerToysAppFZEditor[] = L"POWERTOYS.FANCYZONESEDITOR.EXE";
|
||||
const wchar_t SplashClassName[] = L"MsoSplash";
|
||||
}
|
||||
@@ -45,10 +44,6 @@ namespace
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (find_app_name_in_path(processPath, { NonLocalizable::PowerToysAppPowerLauncher }))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (find_app_name_in_path(processPath, { NonLocalizable::PowerToysAppFZEditor }))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace PowerLauncher.Helper
|
||||
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 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 static IntPtr _hwnd_shell;
|
||||
private static IntPtr _hwnd_desktop;
|
||||
|
||||
@@ -169,6 +171,15 @@ namespace PowerLauncher.Helper
|
||||
_ = NativeMethods.SetWindowLong(hwnd, GWL_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set WS_POPUP to make FancyZones ignoring the Window
|
||||
/// </summary>
|
||||
public static void SetPopupStyle(Window win)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(win).Handle;
|
||||
_ = NativeMethods.SetWindowLong(hwnd, GWL_STYLE, NativeMethods.GetWindowLong(hwnd, GWL_STYLE) | WS_POPUP);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Transforms pixels to Device Independent Pixels used by WPF
|
||||
/// </summary>
|
||||
|
||||
@@ -64,6 +64,12 @@ namespace PowerLauncher
|
||||
PowerToysTelemetry.Log.WriteEvent(telemetryEvent);
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
base.OnSourceInitialized(e);
|
||||
WindowsInteropHelper.SetPopupStyle(this);
|
||||
}
|
||||
|
||||
private void CheckForFirstDelete(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
if (_firstDeleteTimer != null)
|
||||
|
||||
Reference in New Issue
Block a user