Skip to content

Commit

Permalink
Merge pull request AvaloniaUI#7755 from AvaloniaUI/fixes/win32-can-re…
Browse files Browse the repository at this point in the history
…size

Fixes/win32 can resize
  • Loading branch information
danwalmsley committed Aug 12, 2022
1 parent ff86693 commit 9f50abd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
14 changes: 4 additions & 10 deletions src/Windows/Avalonia.Win32/WindowImpl.CustomCaptionProc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
11 changes: 7 additions & 4 deletions src/Windows/Avalonia.Win32/WindowImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9f50abd

Please sign in to comment.