diff --git a/src/Native/Windows.cs b/src/Native/Windows.cs index 70e01796..61f3c96a 100644 --- a/src/Native/Windows.cs +++ b/src/Native/Windows.cs @@ -71,14 +71,9 @@ namespace SourceGit.Native Win32Properties.AddWndProcHookCallback(window, (IntPtr hWnd, uint msg, IntPtr _, IntPtr lParam, ref bool handled) => { - // Custom WM_NCHITTEST - if (msg == 0x0084) + // Custom WM_NCHITTEST only used to limit the resize border to 4 * window.RenderScaling pixels. + if (msg == 0x0084 && window.WindowState == WindowState.Normal) { - handled = true; - - if (window.WindowState == WindowState.FullScreen || window.WindowState == WindowState.Maximized) - return 1; // HTCLIENT - var p = IntPtrToPixelPoint(lParam); GetWindowRect(hWnd, out var rcWindow); @@ -95,18 +90,23 @@ namespace SourceGit.Native else if (p.Y < rcWindow.bottom && p.Y >= rcWindow.bottom - borderThickness) y = 2; + // If it's in the client area, do not handle it here. var zone = y * 3 + x; + if (zone == 4) + return IntPtr.Zero; + + // If it's in the resize border area, return the proper HT code. + handled = true; return zone switch { 0 => 13, // HTTOPLEFT 1 => 12, // HTTOP 2 => 14, // HTTOPRIGHT 3 => 10, // HTLEFT - 4 => 1, // HTCLIENT 5 => 11, // HTRIGHT 6 => 16, // HTBOTTOMLEFT 7 => 15, // HTBOTTOM - _ => 17, + _ => 17, // HTBOTTOMRIGHT }; } diff --git a/src/Views/CaptionButtons.axaml b/src/Views/CaptionButtons.axaml index f43230e4..b1ee6a7b 100644 --- a/src/Views/CaptionButtons.axaml +++ b/src/Views/CaptionButtons.axaml @@ -6,13 +6,13 @@ x:Class="SourceGit.Views.CaptionButtons" x:Name="ThisControl"> - - -