From 1740ed5e0e765ebd8676733243eb3eaa81f95df1 Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: 周二, 26 12月 2023 17:32:13 +0800 Subject: [PATCH] Fix window visibility inconsistency --- src/core/contexts/win32windowcontext.cpp | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index bf25bdb..84a085d 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) @@ -574,6 +573,7 @@ case RaiseWindowHook: { if (!windowId) return; + m_delegate->setWindowVisible(m_host, true); const auto hwnd = reinterpret_cast<HWND>(windowId); bringWindowToFront(hwnd); return; @@ -723,8 +723,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 +1319,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