From 299dfef52c0cc12de223798c5a100350c0622acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Mon, 13 Nov 2023 13:00:38 +0100 Subject: [PATCH] Don't update DPR on de-expose events There is no need to run the catch-all DPR update if the window is not visible. Pick-to: 6.6 Fixes: QTBUG-117762 Change-Id: Ib4e235fed4b21e5aa2ecafa960ab0900e2b68295 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot --- src/gui/kernel/qguiapplication.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 86715dcf9f..14b50881c7 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3274,10 +3274,12 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E // We expect that the platform plugins send DevicePixelRatioChange events. // As a fail-safe make a final check here to make sure the cached DPR value is // always up to date before sending the expose event. - const bool dprWasChanged = QWindowPrivate::get(window)->updateDevicePixelRatio(); - if (dprWasChanged) - qWarning() << "The cached device pixel ratio value was stale on window expose. " - << "Please file a QTBUG which explains how to reproduce."; + if (e->isExposed && !e->region.isEmpty()) { + const bool dprWasChanged = QWindowPrivate::get(window)->updateDevicePixelRatio(); + if (dprWasChanged) + qWarning() << "The cached device pixel ratio value was stale on window expose. " + << "Please file a QTBUG which explains how to reproduce."; + } // We treat expose events for an already exposed window as paint events if (wasExposed && p->exposed && shouldSynthesizePaintEvents) {