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
icc-effect-5.14.5
Martin Gräßlin 2016-08-31 16:08:25 +02:00
parent e922c79897
commit 8d4204ac0d
3 changed files with 22 additions and 1 deletions

View File

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

View File

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

View File

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