From 4f8d01b43669a82533a93df44fcd76b10e01f955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20S=C3=B8rvig?= Date: Fri, 1 Mar 2024 19:28:40 +0100 Subject: [PATCH] wasm: send DPR change event on window update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Qt Gui expects that the platform sends DPR update notifications if the DPR value has changed, before sending expose/paint events or delivering update request events. The most straightforward implementation is to send the DPR update event unconditionally and let Qt Gui determine if the DPR value has changed, especially if the native platform does not provide DPR change events. Pick-to: 6.6 Change-Id: Ica7a24a458b3b01f1c7b2e1e09d342114dc71331 Reviewed-by: Morten Johan Sørvig (cherry picked from commit b8584173ab6a3fc4e034bc237b34f4968528b0f3) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/wasm/qwasmcompositor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp index 66eaea62faa..ef38e4db2e8 100644 --- a/src/plugins/platforms/wasm/qwasmcompositor.cpp +++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp @@ -99,11 +99,16 @@ void QWasmCompositor::deliverUpdateRequests() void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType) { + QWindow *qwindow = window->window(); + + // Make sure the DPR value for the window is up to date on expose/repaint. + // FIXME: listen to native DPR change events instead, if/when available. + QWindowSystemInterface::handleWindowDevicePixelRatioChanged(qwindow); + // Update by deliverUpdateRequest and expose event according to requested update // type. If the window has not yet been exposed then we must expose it first regardless // of update type. The deliverUpdateRequest must still be sent in this case in order // to maintain correct window update state. - QWindow *qwindow = window->window(); QRect updateRect(QPoint(0, 0), qwindow->geometry().size()); if (updateType == UpdateRequestDelivery) { if (qwindow->isExposed() == false)