From fd55e9b71b03282de682e9b8ac01f1b6801d25a9 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 12 Aug 2023 04:05:08 +0400 Subject: [PATCH] Adapt WindowHelper::updateMargins for Windows 11 native resize --- ui/platform/win/ui_window_win.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/platform/win/ui_window_win.cpp b/ui/platform/win/ui_window_win.cpp index 3aba67d..5fe828b 100644 --- a/ui/platform/win/ui_window_win.cpp +++ b/ui/platform/win/ui_window_win.cpp @@ -865,7 +865,7 @@ void WindowHelper::updateWindowFrameColors(bool active) { } void WindowHelper::updateMargins() { - if (::Platform::IsWindows11OrGreater() || _updatingMargins) return; + if (_updatingMargins) return; _updatingMargins = true; const auto guard = gsl::finally([&] { _updatingMargins = false; }); @@ -879,7 +879,9 @@ void WindowHelper::updateMargins() { } else { AdjustWindowRectEx(&r, style, false, styleEx); } - auto margins = QMargins(r.left, r.top, -r.right, -r.bottom); + auto margins = ::Platform::IsWindows11OrGreater() + ? QMargins(0, r.top, 0, 0) + : QMargins(r.left, r.top, -r.right, -r.bottom); if (style & WS_MAXIMIZE) { RECT w, m; GetWindowRect(_handle , &w); @@ -936,7 +938,6 @@ void WindowHelper::updateMargins() { } void WindowHelper::fixMaximizedWindow() { - if (::Platform::IsWindows11OrGreater()) return; const auto style = GetWindowLongPtr(_handle, GWL_STYLE); if (style & WS_MAXIMIZE) { auto w = RECT();