Commit 8d4204ac authored by Martin Flöser's avatar Martin Flöser

Remove non visible internal windows from the x stacking order

Summary:
KWin always has a few internal windows around which are not visible.
A QWindow created somewhere, but not shown. Such windows should not
be part of the stacking order.

If they are it breaks code which looks at the top most window in the
stacking order like e.g. SlidebackEffect.

This change ensures that the stacking order gets updated whenever a
ShellClient gets hidden and that internal windows with isShown being
false are excluded from the stacking order.

BUG: 364483

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2636
parent e922c798
......@@ -208,6 +208,8 @@ void InternalWindowTest::testEnterLeave()
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 @@ void InternalWindowTest::testEnterLeave()
// 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()
......
......@@ -719,7 +719,9 @@ ToplevelList Workspace::xStackingOrder() const
if (waylandServer()) {
const auto clients = waylandServer()->internalClients();
for (auto c: clients) {
x_stacking << c;
if (c->isShown(false)) {
x_stacking << c;
}
}
}
return x_stacking;
......
......@@ -411,6 +411,13 @@ void Workspace::init()
}
}
);
connect(c, &ShellClient::windowHidden, this,
[this] {
x_stacking_dirty = true;
updateStackingOrder(true);
updateClientArea();
}
);
}
);
connect(w, &WaylandServer::shellClientRemoved, this,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment