From 6ade020b22e0c48049bf872bd08fb49ce90c4695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 11 Nov 2024 14:14:06 +0100 Subject: [PATCH] macOS: Take QT_SCALE_FACTOR into account when applying NSWindow geometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends 31ec108dd08d6381a15e49b6fbec9337705c3b2a. Fixes: QTBUG-131093 Pick-to: 6.5 Change-Id: I1fa947e9b4e15c18e4638f0374a9980b2ae2e571 Reviewed-by: Vladimir Belyavsky Reviewed-by: Morten Johan Sørvig (cherry picked from commit 1e7581fafbaa20971b2ff649738f6b7a95084167) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/cocoa/qnswindow.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index eac0e61be9e..18c5d105cd3 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -13,6 +13,8 @@ #include +#include + Q_LOGGING_CATEGORY(lcQpaEvents, "qt.qpa.events"); static bool isMouseEvent(NSEvent *ev) @@ -233,7 +235,8 @@ NSWindow *qnswindow_cast(NSWindow *window) // client geometry based on the QWindow's positionPolicy is a noop. // Now that we have a NSWindow to read the frame from we re-apply // the QWindow geometry, which will move the NSWindow if needed. - m_platformWindow->setGeometry(window->geometry()); + m_platformWindow->setGeometry(QHighDpi::toNativeWindowGeometry(window->geometry(), window)); + m_platformWindow->setVisible(window->isVisible()); }