1From e0051310e404734bb1fcd8e1f6bc8a4c03d536ef Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Wed, 4 Nov 2020 11:42:23 +0800 4Subject: [PATCH 13/17] qwaylandwindow: Fix losing parent relationship after 5 reset 6 7Reset all children to reflush the parent relationship. 8 9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 10--- 11 src/client/qwaylandwindow.cpp | 20 ++++++++++++++++++++ 12 1 file changed, 20 insertions(+) 13 14diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp 15index 9cba945..d1b113c 100644 16--- a/src/client/qwaylandwindow.cpp 17+++ b/src/client/qwaylandwindow.cpp 18@@ -242,6 +242,26 @@ void QWaylandWindow::initializeWlSurface() 19 mSurface->m_window = this; 20 } 21 emit wlSurfaceCreated(); 22+ 23+ // Reset all children to reflush parent relationship 24+ QObjectList childObjects = window()->children(); 25+ for (int i = 0; i < childObjects.size(); i ++) { 26+ QObject *object = childObjects.at(i); 27+ 28+ if (!object->isWindowType()) 29+ continue; 30+ 31+ QWindow *childWindow = static_cast<QWindow *>(object); 32+ if (!childWindow->isVisible()) 33+ return; 34+ 35+ QWaylandWindow *childWaylandWindow = 36+ const_cast<QWaylandWindow *>(static_cast<const QWaylandWindow *>(childWindow->handle())); 37+ 38+ childWaylandWindow->reset(); 39+ childWaylandWindow->setParent(this); 40+ childWindow->setVisible(true); 41+ } 42 } 43 44 bool QWaylandWindow::shouldCreateShellSurface() const 45-- 462.20.1 47 48