diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs index ce20c9be77..e80792723d 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/MainWindow.xaml.cs @@ -404,11 +404,6 @@ public sealed partial class MainWindow : Window, // know till the message is being handled. WeakReferenceMessenger.Default.Send(new(commandId, _hwnd)); -#pragma warning disable SA1310 // Field names should not contain underscore - private const uint DOT_KEY = 0xBE; - private const uint WM_HOTKEY = 0x0312; -#pragma warning restore SA1310 // Field names should not contain underscore - private void UnregisterHotkeys() { _keyboardListener.ClearHotkeys(); @@ -502,7 +497,10 @@ public sealed partial class MainWindow : Window, { switch (uMsg) { - case WM_HOTKEY: + // Prevent the window from maximizing when double-clicking the title bar area + case PInvoke.WM_NCLBUTTONDBLCLK: + return (LRESULT)IntPtr.Zero; + case PInvoke.WM_HOTKEY: { var hotkeyIndex = (int)wParam.Value; if (hotkeyIndex < _hotkeys.Count) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/NativeMethods.txt b/src/modules/cmdpal/Microsoft.CmdPal.UI/NativeMethods.txt index 4db59d7070..285bcff8c8 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/NativeMethods.txt +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/NativeMethods.txt @@ -25,6 +25,8 @@ SHCreateStreamOnFileEx CoAllowSetForegroundWindow SHCreateStreamOnFileEx SHLoadIndirectString +WM_HOTKEY +WM_NCLBUTTONDBLCLK Shell_NotifyIcon LoadIcon