highdpi: Update high-DPI in QWSI::handleScreenLogicalDotsPerInchChange

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ø <tor.arne.vestbo@qt.io>
This commit is contained in:
Morten Sørvig 2023-10-10 16:15:40 +02:00 committed by Morten Johan Sørvig
parent 4ae537e67c
commit 454068232e

View File

@ -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<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent>(screen,
effectiveDpi.first, effectiveDpi.second);