From 172de036be36360e996f2d2e5b201bde8b122b76 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Tue, 5 May 2020 14:15:21 -0300 Subject: [PATCH] fix glitch with window decorations transitioning from fullscreen to maximized. --- src/Windows/Avalonia.Win32/WindowImpl.cs | 34 ++++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Windows/Avalonia.Win32/WindowImpl.cs b/src/Windows/Avalonia.Win32/WindowImpl.cs index 15261fe1c4..549a568fa2 100644 --- a/src/Windows/Avalonia.Win32/WindowImpl.cs +++ b/src/Windows/Avalonia.Win32/WindowImpl.cs @@ -801,6 +801,11 @@ namespace Avalonia.Win32 SetStyle(style); } + if (oldProperties.IsFullScreen != newProperties.IsFullScreen) + { + SetFullScreen(newProperties.IsFullScreen); + } + if ((oldProperties.Decorations != newProperties.Decorations) || forceChanges) { var style = GetStyle(); @@ -816,22 +821,22 @@ namespace Avalonia.Win32 style &= ~fullDecorationFlags; } - var margins = new MARGINS - { - cyBottomHeight = newProperties.Decorations == SystemDecorations.BorderOnly ? 1 : 0 - }; - - DwmExtendFrameIntoClientArea(_hwnd, ref margins); - - GetClientRect(_hwnd, out var oldClientRect); - var oldClientRectOrigin = new POINT(); - ClientToScreen(_hwnd, ref oldClientRectOrigin); - oldClientRect.Offset(oldClientRectOrigin); - SetStyle(style); if (!_isFullScreenActive) { + var margins = new MARGINS + { + cyBottomHeight = newProperties.Decorations == SystemDecorations.BorderOnly ? 1 : 0 + }; + + DwmExtendFrameIntoClientArea(_hwnd, ref margins); + + GetClientRect(_hwnd, out var oldClientRect); + var oldClientRectOrigin = new POINT(); + ClientToScreen(_hwnd, ref oldClientRectOrigin); + oldClientRect.Offset(oldClientRectOrigin); + var newRect = oldClientRect; if (newProperties.Decorations == SystemDecorations.Full) @@ -844,11 +849,6 @@ namespace Avalonia.Win32 SetWindowPosFlags.SWP_FRAMECHANGED); } } - - if (oldProperties.IsFullScreen != newProperties.IsFullScreen) - { - SetFullScreen(newProperties.IsFullScreen); - } } #if USE_MANAGED_DRAG