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
Change-Id: I6c872071751d5a2fbdeea36fb8f4c7e9677fd7d0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit 5c5844cedb938c38ea595957b172c48a67c502fc)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Even Oscar Andersen 2024-12-21 10:36:30 +01:00 committed by Qt Cherry-pick Bot
parent 83cb2ca344
commit 887601bf0e
2 changed files with 18 additions and 13 deletions

View File

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

View File

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