Browse Source

maintain the client size when switching between extended and non extended client areas.

Previously the client area would grow to fill the window.
pull/5736/head
Dan Walmsley 6 years ago
parent
commit
79665bfc74
  1. 17
      src/Windows/Avalonia.Win32/WindowImpl.cs

17
src/Windows/Avalonia.Win32/WindowImpl.cs

@ -883,20 +883,19 @@ namespace Avalonia.Win32
_isClientAreaExtended = false; _isClientAreaExtended = false;
return; return;
} }
GetClientRect(_hwnd, out var rcClient);
GetWindowRect(_hwnd, out var rcClient); GetWindowRect(_hwnd, out var rcWindow);
// Inform the application of the frame change. // Inform the application of the frame change.
SetWindowPos(_hwnd, SetWindowPos(_hwnd,
IntPtr.Zero, IntPtr.Zero,
rcClient.left, rcClient.top, rcWindow.left, rcWindow.top,
rcClient.Width, rcClient.Height, rcClient.Width, rcClient.Height,
SetWindowPosFlags.SWP_FRAMECHANGED); SetWindowPosFlags.SWP_FRAMECHANGED);
if (_isClientAreaExtended && WindowState != WindowState.FullScreen) if (_isClientAreaExtended && WindowState != WindowState.FullScreen)
{ {
var margins = UpdateExtendMargins(); var margins = UpdateExtendMargins();
DwmExtendFrameIntoClientArea(_hwnd, ref margins); DwmExtendFrameIntoClientArea(_hwnd, ref margins);
} }
else else
@ -906,6 +905,8 @@ namespace Avalonia.Win32
_offScreenMargin = new Thickness(); _offScreenMargin = new Thickness();
_extendedMargins = new Thickness(); _extendedMargins = new Thickness();
Resize(new Size(rcWindow.Width, rcWindow.Height));
} }
if(!_isClientAreaExtended || (_extendChromeHints.HasFlagCustom(ExtendClientAreaChromeHints.SystemChrome) && if(!_isClientAreaExtended || (_extendChromeHints.HasFlagCustom(ExtendClientAreaChromeHints.SystemChrome) &&

Loading…
Cancel
Save