From 91b6436de8fdcefcdfc0c1e41115ed92d8833c1d 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. Fixes: QTBUG-117762 Change-Id: Ib4e235fed4b21e5aa2ecafa960ab0900e2b68295 Reviewed-by: David Edmundson Reviewed-by: Qt CI Bot (cherry picked from commit 299dfef52c0cc12de223798c5a100350c0622acb) Reviewed-by: Qt Cherry-pick 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 690a6f24123..ae5e33e4ac9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -3271,10 +3271,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) {