summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm/qwasmcompositor.cpp
diff options
context:
space:
mode:
authorMikolaj Boc <mikolaj.boc@qt.io>2023-03-24 13:47:02 +0100
committerMikoĊ‚aj Boc <Mikolaj.Boc@qt.io>2023-03-28 13:45:24 +0000
commit80c1406371d10cd8536de988195f00ddbc1c25a2 (patch)
tree3f1955b466419267ba7629efd41bd09d9d15408c /src/plugins/platforms/wasm/qwasmcompositor.cpp
parentc4b62ee501741113c0acea6c5f404d15c23fafc3 (diff)
Remove the redundant QWasmCompositor::requestUpdateAllWindows
Now that the browser compositor is used for rendering windows, the method has become redundant, as windows that got resized during screen resize will schedule their updates directly with the compositor. This also fixes an assertion in QPlatformWindow::hasPendingUpdateRequest as no windows without pending update requests will now have update requests delivered. Also offers a significant speedup with multiple restored window setups. Fixes: QTBUG-112289 Change-Id: Ie5dff69c04d66c4aef8351adef0da8530daf7ab8 Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmcompositor.cpp')
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 922e802732c..5cb111d59ab 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -151,12 +151,6 @@ QWindow *QWasmCompositor::keyWindow() const
return m_activeWindow ? m_activeWindow->window() : nullptr;
}
-void QWasmCompositor::requestUpdateAllWindows()
-{
- m_requestUpdateAllWindows = true;
- requestUpdate();
-}
-
void QWasmCompositor::requestUpdateWindow(QWasmWindow *window, UpdateRequestDeliveryType updateType)
{
auto it = m_requestUpdateWindows.find(window);
@@ -198,36 +192,27 @@ void QWasmCompositor::deliverUpdateRequests()
// update set.
auto requestUpdateWindows = m_requestUpdateWindows;
m_requestUpdateWindows.clear();
- bool requestUpdateAllWindows = m_requestUpdateAllWindows;
- m_requestUpdateAllWindows = false;
// Update window content, either all windows or a spesific set of windows. Use the correct
// update type: QWindow subclasses expect that requested and delivered updateRequests matches
// exactly.
m_inDeliverUpdateRequest = true;
- if (requestUpdateAllWindows) {
- for (QWasmWindow *window : m_windowStack) {
- auto it = requestUpdateWindows.find(window);
- UpdateRequestDeliveryType updateType =
- (it == m_requestUpdateWindows.end() ? ExposeEventDelivery : it.value());
- deliverUpdateRequest(window, updateType);
- }
- } else {
- for (auto it = requestUpdateWindows.constBegin(); it != requestUpdateWindows.constEnd(); ++it) {
- auto *window = it.key();
- UpdateRequestDeliveryType updateType = it.value();
- deliverUpdateRequest(window, updateType);
- }
+
+ for (auto it = requestUpdateWindows.constBegin(); it != requestUpdateWindows.constEnd(); ++it) {
+ auto *window = it.key();
+ UpdateRequestDeliveryType updateType = it.value();
+ deliverUpdateRequest(window, updateType);
}
+
m_inDeliverUpdateRequest = false;
- frame(requestUpdateAllWindows, requestUpdateWindows.keys());
+ frame(requestUpdateWindows.keys());
}
void QWasmCompositor::deliverUpdateRequest(QWasmWindow *window, UpdateRequestDeliveryType updateType)
{
// update by deliverUpdateRequest and expose event accordingly.
if (updateType == UpdateRequestDelivery) {
- window->QPlatformWindow::deliverUpdateRequest();
+ window->deliverUpdateRequest();
} else {
QWindow *qwindow = window->window();
QWindowSystemInterface::handleExposeEvent(
@@ -248,17 +233,12 @@ int dpiScaled(qreal value)
return value * (qreal(qt_defaultDpiX()) / 96.0);
}
-void QWasmCompositor::frame(bool all, const QList<QWasmWindow *> &windows)
+void QWasmCompositor::frame(const QList<QWasmWindow *> &windows)
{
- if (!m_isEnabled || m_windowStack.empty() || !screen())
+ if (!m_isEnabled || !screen())
return;
- if (all) {
- std::for_each(m_windowStack.rbegin(), m_windowStack.rend(),
- [](QWasmWindow *window) { window->paint(); });
- } else {
- std::for_each(windows.begin(), windows.end(), [](QWasmWindow *window) { window->paint(); });
- }
+ std::for_each(windows.begin(), windows.end(), [](QWasmWindow *window) { window->paint(); });
}
void QWasmCompositor::onTopWindowChanged()