QWaylandWindow: Init parent wl_surface when creating subsurface

Fixes recreating subsurfaces after hiding and then again showing
the window.

Pick-to: 6.5
Change-Id: I2e3e7ceb42ec6b25cb64db260dfb74f6ebb10d27
Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
David Rosca 2023-04-17 13:37:47 +02:00
parent d66e8f148f
commit 4f8399d307
2 changed files with 6 additions and 0 deletions

View File

@ -131,6 +131,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);

View File

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