diff --git a/autotests/integration/internal_window.cpp b/autotests/integration/internal_window.cpp --- a/autotests/integration/internal_window.cpp +++ b/autotests/integration/internal_window.cpp @@ -208,6 +208,8 @@ QVERIFY(c->isInternal()); QCOMPARE(workspace()->findToplevel(&win), c); QCOMPARE(c->geometry(), QRect(0, 0, 100, 100)); + QVERIFY(c->isShown(false)); + QVERIFY(workspace()->xStackingOrder().contains(c)); QSignalSpy enterSpy(&win, &HelperWindow::entered); QVERIFY(enterSpy.isValid()); @@ -236,6 +238,16 @@ // inside the mask we should still get an enter kwinApp()->platform()->pointerMotion(QPoint(25, 27), timestamp++); QTRY_COMPARE(enterSpy.count(), 2); + + // hide the window, which should be removed from the stacking order + win.hide(); + QTRY_VERIFY(!c->isShown(false)); + QVERIFY(!workspace()->xStackingOrder().contains(c)); + + // show again + win.show(); + QTRY_VERIFY(c->isShown(false)); + QVERIFY(workspace()->xStackingOrder().contains(c)); } void InternalWindowTest::testPointerPressRelease() diff --git a/layers.cpp b/layers.cpp --- a/layers.cpp +++ b/layers.cpp @@ -719,7 +719,9 @@ if (waylandServer()) { const auto clients = waylandServer()->internalClients(); for (auto c: clients) { - x_stacking << c; + if (c->isShown(false)) { + x_stacking << c; + } } } return x_stacking; diff --git a/workspace.cpp b/workspace.cpp --- a/workspace.cpp +++ b/workspace.cpp @@ -411,6 +411,13 @@ } } ); + connect(c, &ShellClient::windowHidden, this, + [this] { + x_stacking_dirty = true; + updateStackingOrder(true); + updateClientArea(); + } + ); } ); connect(w, &WaylandServer::shellClientRemoved, this,