summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/wasm
diff options
context:
space:
mode:
authorEven Oscar Andersen <[email protected]>2024-12-21 10:36:30 +0100
committerEven Oscar Andersen <[email protected]>2025-01-08 10:20:47 +0000
commit5c5844cedb938c38ea595957b172c48a67c502fc (patch)
tree432971efde4be5293e5c27356cad2b4ee96208ae /src/plugins/platforms/wasm
parent23c16c611cfeee55ce38e928989b346c697270b0 (diff)
Make QWasmScreen::allWindows return all (wasm) windows
It seems that findChildren does not return every window if called at an inconvenient time. This causes not all windows to be returned, and later the QWasmCompositor will not detect a valid window to compose, and therefor goes to disabled. Fixes: QTBUG-132414 Pick-to: 6.9 Change-Id: I6c872071751d5a2fbdeea36fb8f4c7e9677fd7d0 Reviewed-by: Morten Johan Sørvig <[email protected]>
Diffstat (limited to 'src/plugins/platforms/wasm')
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.cpp29
-rw-r--r--src/plugins/platforms/wasm/qwasmscreen.h2
2 files changed, 18 insertions, 13 deletions
diff --git a/src/plugins/platforms/wasm/qwasmscreen.cpp b/src/plugins/platforms/wasm/qwasmscreen.cpp
index 1ec7d758395..badc5468c8b 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.cpp
+++ b/src/plugins/platforms/wasm/qwasmscreen.cpp
@@ -330,21 +330,26 @@ QWasmWindowTreeNode *QWasmScreen::parentNode()
return nullptr;
}
-QList<QWasmWindow *> QWasmScreen::allWindows()
+QList<QWasmWindow *> QWasmScreen::allWindows() const
{
- QList<QWasmWindow *> windows;
- for (auto *child : childStack()) {
- const QWindowList list = child->window()->findChildren<QWindow *>(Qt::FindChildrenRecursively);
- for (auto child : list) {
- auto handle = child->handle();
- if (handle) {
- auto wnd = static_cast<QWasmWindow *>(handle);
- windows.push_back(wnd);
- }
+ QList<QWasmWindow *> currentChildren;
+ QList<QWasmWindow *> result;
+
+ for (auto *w : childStack())
+ currentChildren << w;
+
+ while (!currentChildren.empty()) {
+ result << currentChildren;
+
+ QList<QWasmWindow *> toIterate;
+ currentChildren.swap(toIterate);
+
+ for (auto child : toIterate) {
+ for (auto *w : child->childStack())
+ currentChildren << w;
}
- windows.push_back(child);
}
- return windows;
+ return result;
}
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/wasm/qwasmscreen.h b/src/plugins/platforms/wasm/qwasmscreen.h
index cf9916b9075..66e7e39d008 100644
--- a/src/plugins/platforms/wasm/qwasmscreen.h
+++ b/src/plugins/platforms/wasm/qwasmscreen.h
@@ -43,7 +43,7 @@ public:
QWasmCompositor *compositor();
QWasmDeadKeySupport *deadKeySupport() { return m_deadKeySupport.get(); }
- QList<QWasmWindow *> allWindows();
+ QList<QWasmWindow *> allWindows() const;
QRect geometry() const override;
int depth() const override;