wasm: expose windows before delivering updates

Don't show a blank frame on app startup.

The wasm update request system supports two types of update
requests: Expose and UpdateRequest. It can happen that both
types of request are made for a single window, in which case
the current code prefers UpdateRequest, since those must be
delivered in order to keep QWindow in a consistent state.

However, if the window is visible but not yet exposed then
delivering the update request will not make the window paint
anything, and we end up with a blank frame.

Ideally this should be handled elsewhere and QWindow::requestUpdate()
should not be called for non-exposed windows, but in the
case does happen then sending an expose here allows us to
recover.

Change-Id: Ib53050c33ad1769ea9b9ad678896af15f87a7ecb
(cherry picked from commit 4c18ebbc1c0bddca4b19a585d2d3a5dafdefc4a3)
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
This commit is contained in:
Morten Sørvig 2023-06-09 17:09:41 +02:00
parent 66414b36fd
commit 97c40bf5bf

View File

@ -172,13 +172,18 @@ void QWasmCompositor::deliverUpdateRequests()
void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType)
{
// update by deliverUpdateRequest and expose event accordingly.
// 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)
QWindowSystemInterface::handleExposeEvent(qwindow, updateRect);
window->deliverUpdateRequest();
} else {
QWindow *qwindow = window->window();
QWindowSystemInterface::handleExposeEvent(
qwindow, QRect(QPoint(0, 0), qwindow->geometry().size()));
QWindowSystemInterface::handleExposeEvent(qwindow, updateRect);
}
}