From e66ad9c80c88a0efad81ad05b120709cbaf022c3 Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sat, 12 Aug 2023 04:01:21 +0400 Subject: [PATCH] Avoid additional calculations in WindowHelper::updateMargins --- ui/platform/win/ui_window_win.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/ui/platform/win/ui_window_win.cpp b/ui/platform/win/ui_window_win.cpp index 03ceee6..dca46cf 100644 --- a/ui/platform/win/ui_window_win.cpp +++ b/ui/platform/win/ui_window_win.cpp @@ -851,19 +851,11 @@ void WindowHelper::updateMargins() { _updatingMargins = true; const auto guard = gsl::finally([&] { _updatingMargins = false; }); - RECT r, a; - - GetClientRect(_handle, &r); - a = r; - + RECT r{}; const auto style = GetWindowLongPtr(_handle, GWL_STYLE); const auto styleEx = GetWindowLongPtr(_handle, GWL_EXSTYLE); AdjustWindowRectEx(&a, style, false, styleEx); - auto margins = QMargins( - a.left - r.left, - a.top - r.top, - r.right - a.right, - r.bottom - a.bottom); + auto margins = QMargins(r.left, r.top, -r.right, -r.bottom); if (style & WS_MAXIMIZE) { RECT w, m; GetWindowRect(_handle , &w);