From c8a5a82994e513acb00ba0e1f0b882ccbb18a6db Mon Sep 17 00:00:00 2001
From: Sine Striker <trueful@163.com>
Date: 周二, 26 12月 2023 05:15:47 +0800
Subject: [PATCH] clean code

---
 src/core/contexts/win32windowcontext.cpp |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp
index bf25bdb..8f5a9b6 100644
--- a/src/core/contexts/win32windowcontext.cpp
+++ b/src/core/contexts/win32windowcontext.cpp
@@ -9,7 +9,6 @@
 #include <QtGui/QGuiApplication>
 #include <QtGui/QPainter>
 #include <QtGui/QPalette>
-#include <QtGui/QStyleHints>
 
 #include <QtGui/private/qhighdpiscaling_p.h>
 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@@ -723,8 +722,8 @@
         auto hWnd = reinterpret_cast<HWND>(winId);
 
         if (!isSystemBorderEnabled()) {
-            setWindowAttribute(QStringLiteral("extra-margins"),
-                               QVariant::fromValue(QMargins(1, 1, 1, 1)));
+            static auto margins = QVariant::fromValue(QMargins(1, 1, 1, 1));
+            setWindowAttribute(QStringLiteral("extra-margins"), margins);
         }
 
         {
@@ -1319,12 +1318,12 @@
                                                  LPARAM lParam, LRESULT *result) {
         switch (message) {
             case WM_SHOWWINDOW: {
-                if (!centered) {
+                if (!initialCentered) {
                     // If wParam is TRUE, the window is being shown.
                     // If lParam is zero, the message was sent because of a call to the ShowWindow
                     // function.
                     if (wParam && !lParam) {
-                        centered = true;
+                        initialCentered = true;
                         moveWindowToDesktopCenter(hWnd);
                     }
                 }

--
Gitblit v1.9.1