summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rosca <nowrep@gmail.com>2023-04-17 13:37:47 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-04-19 15:26:38 +0000
commite90657f429639983defd7556768a4f71909d13b6 (patch)
tree086bb04425e4642f7ad6cf5575e9f0651d90df9f
parent6a81c5d4c50a92c7550fe66066de8a82a5020b01 (diff)
downloadqtwayland-e90657f429639983defd7556768a4f71909d13b6.tar.gz
QWaylandWindow: Init parent wl_surface when creating subsurface
Fixes recreating subsurfaces after hiding and then again showing the window. Change-Id: I2e3e7ceb42ec6b25cb64db260dfb74f6ebb10d27 Reviewed-by: David Edmundson <davidedmundson@kde.org> (cherry picked from commit d06d66fad70d7c61559211b6f489b94d1c3a8a05) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/client/qwaylandwindow.cpp2
-rw-r--r--tests/auto/client/surface/tst_surface.cpp4
2 files changed, 6 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index d2199df4..bb1d944c 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -125,6 +125,8 @@ void QWaylandWindow::initWindow()
Q_ASSERT(!mSubSurfaceWindow);
auto *parent = static_cast<QWaylandWindow *>(QPlatformWindow::parent());
+ if (!parent->mSurface)
+ parent->initializeWlSurface();
if (parent->wlSurface()) {
if (::wl_subsurface *subsurface = mDisplay->createSubSurface(this, parent))
mSubSurfaceWindow = new QWaylandSubSurface(this, parent, subsurface);
diff --git a/tests/auto/client/surface/tst_surface.cpp b/tests/auto/client/surface/tst_surface.cpp
index 083bc4fa..b583390f 100644
--- a/tests/auto/client/surface/tst_surface.cpp
+++ b/tests/auto/client/surface/tst_surface.cpp
@@ -199,6 +199,10 @@ void tst_surface::createSubsurfaceForHiddenParent()
// Make sure the client doesn't quit before it has a chance to crash
xdgPingAndWaitForPong();
+
+ // Make sure the subsurface was actually created
+ const Subsurface *subsurface = exec([=] {return subSurface(0);});
+ QVERIFY(subsurface);
}
QCOMPOSITOR_TEST_MAIN(tst_surface)