wasm: send DPR change event on window update

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 <morten.sorvig@qt.io>
(cherry picked from commit b8584173ab6a3fc4e034bc237b34f4968528b0f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Morten Sørvig 2024-03-01 19:28:40 +01:00 committed by Qt Cherry-pick Bot
parent be78514b20
commit 4f8d01b436

View File

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