Browse Source

Merge pull request #5736 from AvaloniaUI/extended-client-area-win32-maintain-size

maintain the client size when switching between extended and non exte…
pull/5741/head
Dan Walmsley 6 years ago
committed by GitHub
parent
commit
e99a95ecca
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      src/Windows/Avalonia.Win32/WindowImpl.cs

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

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

Loading…
Cancel
Save