diff --git a/src/wayland/autotests/client/test_wayland_subsurface.cpp b/src/wayland/autotests/client/test_wayland_subsurface.cpp index 7e5d20f5f5..938e986d05 100644 --- a/src/wayland/autotests/client/test_wayland_subsurface.cpp +++ b/src/wayland/autotests/client/test_wayland_subsurface.cpp @@ -207,6 +207,7 @@ void TestSubSurface::testCreate() QCOMPARE(serverSubSurface->surface().data(), serverSurface); QCOMPARE(serverSurface->subSurface().data(), serverSubSurface); // children are only added after committing the surface + QEXPECT_FAIL("", "Incorrect adding of child windows to workaround QtWayland behavior", Continue); QCOMPARE(serverParentSurface->childSubSurfaces().count(), 0); // so let's commit the surface, to apply the stacking change parent->commit(Surface::CommitFlag::None); @@ -222,9 +223,12 @@ void TestSubSurface::testCreate() QVERIFY(destroyedSpy.wait()); QCOMPARE(serverSurface->subSurface(), QPointer()); // only applied after next commit + QEXPECT_FAIL("", "Incorrect removing of child windows to workaround QtWayland behavior", Continue); QCOMPARE(serverParentSurface->childSubSurfaces().count(), 1); // but the surface should be invalid - QVERIFY(serverParentSurface->childSubSurfaces().first().isNull()); + if (!serverParentSurface->childSubSurfaces().isEmpty()) { + QVERIFY(serverParentSurface->childSubSurfaces().first().isNull()); + } // committing the state should solve it parent->commit(Surface::CommitFlag::None); wl_display_flush(m_connection->display()); @@ -364,6 +368,7 @@ void TestSubSurface::testPlaceAbove() subSurfaceCreatedSpy.clear(); // so far the stacking order should still be empty + QEXPECT_FAIL("", "Incorrect adding of child windows to workaround QtWayland behavior", Continue); QVERIFY(serverSubSurface1->parentSurface()->childSubSurfaces().isEmpty()); // committing the parent should create the stacking order @@ -464,6 +469,7 @@ void TestSubSurface::testPlaceBelow() subSurfaceCreatedSpy.clear(); // so far the stacking order should still be empty + QEXPECT_FAIL("", "Incorrect adding of child windows to workaround QtWayland behavior", Continue); QVERIFY(serverSubSurface1->parentSurface()->childSubSurfaces().isEmpty()); // committing the parent should create the stacking order diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index 777b2cdf00..688da3f2f5 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -47,12 +47,10 @@ SurfaceInterface::Private::~Private() void SurfaceInterface::Private::addChild(QPointer< SubSurfaceInterface > child) { - // protocol is not precise on how to handle the addition of new sub surfaces, this follows Weston's behavior - if (subSurface.isNull() || !subSurface->isSynchronized()) { - pending.children.append(child); - } else { - subSurfacePending.children.append(child); - } + // protocol is not precise on how to handle the addition of new sub surfaces + pending.children.append(child); + subSurfacePending.children.append(child); + current.children.append(child); Q_Q(SurfaceInterface); emit q->subSurfaceTreeChanged(); QObject::connect(child.data(), &SubSurfaceInterface::positionChanged, q, &SurfaceInterface::subSurfaceTreeChanged); @@ -63,12 +61,10 @@ void SurfaceInterface::Private::addChild(QPointer< SubSurfaceInterface > child) void SurfaceInterface::Private::removeChild(QPointer< SubSurfaceInterface > child) { - // protocol is not precise on how to handle the addition of new sub surfaces, this follows Weston's behavior - if (subSurface.isNull() || !subSurface->isSynchronized()) { - pending.children.removeAll(child); - } else { - subSurfacePending.children.removeAll(child); - } + // protocol is not precise on how to handle the addition of new sub surfaces + pending.children.removeAll(child); + subSurfacePending.children.removeAll(child); + current.children.removeAll(child); Q_Q(SurfaceInterface); emit q->subSurfaceTreeChanged(); QObject::disconnect(child.data(), &SubSurfaceInterface::positionChanged, q, &SurfaceInterface::subSurfaceTreeChanged);