From 454068232eae457c8f62f94b70e17b0ef8b7a74a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Tue, 10 Oct 2023 16:15:40 +0200 Subject: [PATCH] highdpi: Update high-DPI in QWSI::handleScreenLogicalDotsPerInchChange MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update m_active early during DPI change to make scaling calls made during the DPI change use the new value. The existing call to updateHighDpiScaling() in QGuiApplicationPrivate:: processScreenLogicalDotsPerInchChange() is supposed to take care of this, however that call is made after the geometry change event is crated (with incorrect geometry) Pick-to: 6.7 Change-Id: Ia0f6006c90355ec69ef92b88a020089ab21e072d Reviewed-by: Tor Arne Vestbø --- src/gui/kernel/qwindowsysteminterface.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 11af8fcbc36..1875594300c 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -814,6 +814,11 @@ void QWindowSystemInterface::handleScreenGeometryChange(QScreen *screen, const Q void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen, qreal dpiX, qreal dpiY) { + // Keep QHighDpiScaling::m_active in sync with platform screen state, in + // order to make scaling calls made during DPI change use the new state. + // FIXME: Remove when QHighDpiScaling::m_active has been removed. + QHighDpiScaling::updateHighDpiScaling(); + const QDpi effectiveDpi = QPlatformScreen::overrideDpi(QDpi{dpiX, dpiY}); handleWindowSystemEvent(screen, effectiveDpi.first, effectiveDpi.second);