From 9f50abd761cc7c23805a60b65578f48f7622e076 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 7 Mar 2022 16:54:24 +0000 Subject: [PATCH] Merge pull request #7755 from AvaloniaUI/fixes/win32-can-resize Fixes/win32 can resize --- .../Avalonia.Win32/WindowImpl.CustomCaptionProc.cs | 14 ++++---------- src/Windows/Avalonia.Win32/WindowImpl.cs | 11 +++++++---- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs b/src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs index 8a340aac5e9..48f5f8f871c 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs @@ -23,16 +23,10 @@ private HitTestValues HitTestNCA(IntPtr hWnd, IntPtr wParam, IntPtr lParam) AdjustWindowRectEx(ref rcFrame, (uint)(WindowStyles.WS_OVERLAPPEDWINDOW & ~WindowStyles.WS_CAPTION), false, 0); var borderThickness = new RECT(); - if (GetStyle().HasAllFlags(WindowStyles.WS_THICKFRAME)) - { - AdjustWindowRectEx(ref borderThickness, (uint)(GetStyle()), false, 0); - borderThickness.left *= -1; - borderThickness.top *= -1; - } - else if (GetStyle().HasAllFlags(WindowStyles.WS_BORDER)) - { - borderThickness = new RECT { bottom = 1, left = 1, right = 1, top = 1 }; - } + + AdjustWindowRectEx(ref borderThickness, (uint)GetStyle(), false, 0); + borderThickness.left *= -1; + borderThickness.top *= -1; if (_extendTitleBarHint >= 0) { diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index a71f625ef26..f62335b3f3d 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -648,13 +648,16 @@ public void BeginMoveDrag(PointerPressedEventArgs e) public void BeginResizeDrag(WindowEdge edge, PointerPressedEventArgs e) { + if (_windowProperties.IsResizable) + { #if USE_MANAGED_DRAG - _managedDrag.BeginResizeDrag(edge, ScreenToClient(MouseDevice.Position.ToPoint(_scaling))); + _managedDrag.BeginResizeDrag(edge, ScreenToClient(MouseDevice.Position.ToPoint(_scaling))); #else - _mouseDevice.Capture(null); - DefWindowProc(_hwnd, (int)WindowsMessage.WM_NCLBUTTONDOWN, - new IntPtr((int)s_edgeLookup[edge]), IntPtr.Zero); + _mouseDevice.Capture(null); + DefWindowProc(_hwnd, (int)WindowsMessage.WM_NCLBUTTONDOWN, + new IntPtr((int)s_edgeLookup[edge]), IntPtr.Zero); #endif + } } public void SetTitle(string title)