summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcompositor.cpp
diff options
context:
space:
mode:
authorEven Oscar Andersen <even.oscar.andersen@qt.io>2024-06-06 14:57:14 +0200
committerEven Oscar Andersen <even.oscar.andersen@qt.io>2024-06-13 19:33:21 +0200
commit1b220e1db85dd332fe8c1eb8efd97dd302f9cee4 (patch)
treee575ac93155ed5810d7bd0f0f4be34c7e04896ef /src/plugins/platforms/wasm/qwasmcompositor.cpp
parent1943183282defdbc846813e4ceb66c1eec28fec5 (diff)
wasm: Fix handling of native windows
There are two problems 1) internal (not toplevel) windows needs to have the frameLess attribute set. Without this attribute the window is not visible 2) The backingstore needs to use the correct window, if not the symptoms are that the display is not always correctly updated. Seen in the qtdoc/examples/demos/documentviewer demo Fixes: QTBUG-125856 Change-Id: I040d963c0c130214cc70a607090faa006c02f981 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmcompositor.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp31
1 files changed, 21 insertions, 10 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index ef460f666ff..c534cce9ef5 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -55,16 +55,23 @@ bool QWasmCompositor::releaseRequestUpdateHold()
return wasEnabled;
}
-void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType)
+void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, const QRect &updateRect, UpdateRequestDeliveryType updateType)
{
auto it = m_requestUpdateWindows.find(window);
if (it == m_requestUpdateWindows.end()) {
- m_requestUpdateWindows.insert(window, updateType);
+ m_requestUpdateWindows.insert(window, std::make_tuple(updateRect, updateType));
} else {
// Already registered, but upgrade ExposeEventDeliveryType to UpdateRequestDeliveryType.
// if needed, to make sure QWindow::updateRequest's are matched.
- if (it.value() == ExposeEventDelivery && updateType == UpdateRequestDelivery)
- it.value() = UpdateRequestDelivery;
+ if (std::get<0>(it.value()) != updateRect) {
+ QRegion region;
+ region |= std::get<0>(it.value());
+ region |= updateRect;
+ std::get<0>(it.value()) = region.boundingRect();
+ }
+ if (std::get<1>(it.value()) == ExposeEventDelivery &&
+ updateType == UpdateRequestDelivery)
+ std::get<1>(it.value()) = UpdateRequestDelivery;
}
requestUpdate();
@@ -106,15 +113,20 @@ void QWasmCompositor::deliverUpdateRequests()
m_inDeliverUpdateRequest = true;
for (auto it = requestUpdateWindows.constBegin(); it != requestUpdateWindows.constEnd(); ++it) {
auto *window = it.key();
- UpdateRequestDeliveryType updateType = it.value();
- deliverUpdateRequest(window, updateType);
+
+ const QRect updateRect = std::get<0>(it.value());
+ const UpdateRequestDeliveryType updateType = std::get<1>(it.value());
+ deliverUpdateRequest(window, updateRect, updateType);
}
m_inDeliverUpdateRequest = false;
frame(requestUpdateWindows.keys());
}
-void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType)
+void QWasmCompositor::deliverUpdateRequest(
+ QWasmWindow *window,
+ const QRect &updateRect,
+ UpdateRequestDeliveryType updateType)
{
QWindow *qwindow = window->window();
@@ -126,7 +138,6 @@ void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDel
// 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.
- QRect updateRect(QPoint(0, 0), qwindow->geometry().size());
if (updateType == UpdateRequestDelivery) {
if (qwindow->isExposed() == false)
QWindowSystemInterface::handleExposeEvent(qwindow, updateRect);
@@ -136,12 +147,12 @@ void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDel
}
}
-void QWasmCompositor::handleBackingStoreFlush(QWindow *window)
+void QWasmCompositor::handleBackingStoreFlush(QWindow *window, const QRect &updateRect)
{
// Request update to flush the updated backing store content, unless we are currently
// processing an update, in which case the new content will flushed as a part of that update.
if (!m_inDeliverUpdateRequest)
- requestUpdateWindow(static_cast<QWasmWindow *>(window->handle()));
+ requestUpdateWindow(static_cast<QWasmWindow *>(window->handle()), updateRect);
}
void QWasmCompositor::frame(const QList<QWasmWindow *> &windows)