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 <davidedmundson@kde.org>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit 299dfef52c0cc12de223798c5a100350c0622acb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2023-11-13 13:00:38 +01:00 committed by Qt Cherry-pick Bot
parent 567bd61dbc
commit 91b6436de8

View File

@ -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) {