Remove no longer needed cast to Client in Workspace::sendClientToDesktop
Summary: This change removes a small difference between X11 and Wayland clients. It ensures that all transients are sent to the same desktop as the main window. A similar check is already in AbstractClient::setDesktop, so in general it already worked. This is just a special case for sendClientToDesktop which supports sending to the same desktop so that all transients are sent to that desktop. Test Plan: New test case which fails without this change Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D17546
This commit is contained in:
parent
ba0cf19286
commit
3e62f6aabe
2 changed files with 63 additions and 8 deletions
|
@ -92,6 +92,8 @@ private Q_SLOTS:
|
||||||
void testAppMenu();
|
void testAppMenu();
|
||||||
void testNoDecorationModeRequested_data();
|
void testNoDecorationModeRequested_data();
|
||||||
void testNoDecorationModeRequested();
|
void testNoDecorationModeRequested();
|
||||||
|
void testSendClientWithTransientToDesktop_data();
|
||||||
|
void testSendClientWithTransientToDesktop();
|
||||||
};
|
};
|
||||||
|
|
||||||
void TestShellClient::initTestCase()
|
void TestShellClient::initTestCase()
|
||||||
|
@ -1087,5 +1089,61 @@ void TestShellClient::testNoDecorationModeRequested()
|
||||||
QCOMPARE(c->isDecorated(), true);
|
QCOMPARE(c->isDecorated(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TestShellClient::testSendClientWithTransientToDesktop_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<Test::ShellSurfaceType>("type");
|
||||||
|
|
||||||
|
QTest::newRow("xdgShellV5") << Test::ShellSurfaceType::XdgShellV5;
|
||||||
|
QTest::newRow("xdgShellV6") << Test::ShellSurfaceType::XdgShellV6;
|
||||||
|
QTest::newRow("xdgWmBase") << Test::ShellSurfaceType::XdgShellStable;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestShellClient::testSendClientWithTransientToDesktop()
|
||||||
|
{
|
||||||
|
// this test verifies that when sending a client to a desktop all transients are also send to that desktop
|
||||||
|
|
||||||
|
VirtualDesktopManager::self()->setCount(2);
|
||||||
|
QScopedPointer<Surface> surface{Test::createSurface()};
|
||||||
|
QFETCH(Test::ShellSurfaceType, type);
|
||||||
|
QScopedPointer<XdgShellSurface> shellSurface{qobject_cast<XdgShellSurface*>(Test::createShellSurface(type, surface.data()))};
|
||||||
|
|
||||||
|
auto c = Test::renderAndWaitForShown(surface.data(), QSize(100, 50), Qt::blue);
|
||||||
|
QVERIFY(c);
|
||||||
|
|
||||||
|
// let's create a transient window
|
||||||
|
QScopedPointer<Surface> transientSurface{Test::createSurface()};
|
||||||
|
QScopedPointer<XdgShellSurface> transientShellSurface{qobject_cast<XdgShellSurface*>(Test::createShellSurface(type, transientSurface.data()))};
|
||||||
|
transientShellSurface->setTransientFor(shellSurface.data());
|
||||||
|
|
||||||
|
auto transient = Test::renderAndWaitForShown(transientSurface.data(), QSize(100, 50), Qt::blue);
|
||||||
|
QVERIFY(transient);
|
||||||
|
QCOMPARE(workspace()->activeClient(), transient);
|
||||||
|
QCOMPARE(transient->transientFor(), c);
|
||||||
|
QVERIFY(c->transients().contains(transient));
|
||||||
|
|
||||||
|
QCOMPARE(c->desktop(), 1);
|
||||||
|
QVERIFY(!c->isOnAllDesktops());
|
||||||
|
QCOMPARE(transient->desktop(), 1);
|
||||||
|
QVERIFY(!transient->isOnAllDesktops());
|
||||||
|
workspace()->slotWindowToDesktop(2);
|
||||||
|
|
||||||
|
QCOMPARE(c->desktop(), 1);
|
||||||
|
QCOMPARE(transient->desktop(), 2);
|
||||||
|
|
||||||
|
// activate c
|
||||||
|
workspace()->activateClient(c);
|
||||||
|
QCOMPARE(workspace()->activeClient(), c);
|
||||||
|
QVERIFY(c->isActive());
|
||||||
|
|
||||||
|
// and send it to the desktop it's already on
|
||||||
|
QCOMPARE(c->desktop(), 1);
|
||||||
|
QCOMPARE(transient->desktop(), 2);
|
||||||
|
workspace()->slotWindowToDesktop(1);
|
||||||
|
|
||||||
|
// which should move the transient back to the desktop
|
||||||
|
QCOMPARE(c->desktop(), 1);
|
||||||
|
QCOMPARE(transient->desktop(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
WAYLANDTEST_MAIN(TestShellClient)
|
WAYLANDTEST_MAIN(TestShellClient)
|
||||||
#include "shell_client_test.moc"
|
#include "shell_client_test.moc"
|
||||||
|
|
|
@ -1169,14 +1169,11 @@ void Workspace::sendClientToDesktop(AbstractClient* c, int desk, bool dont_activ
|
||||||
|
|
||||||
c->checkWorkspacePosition( QRect(), old_desktop );
|
c->checkWorkspacePosition( QRect(), old_desktop );
|
||||||
|
|
||||||
if (Client *client = dynamic_cast<Client*>(c)) {
|
auto transients_stacking_order = ensureStackingOrder(c->transients());
|
||||||
// TODO: adjust transients for non-X11
|
for (auto it = transients_stacking_order.constBegin();
|
||||||
auto transients_stacking_order = ensureStackingOrder(client->transients());
|
it != transients_stacking_order.constEnd();
|
||||||
for (auto it = transients_stacking_order.constBegin();
|
++it)
|
||||||
it != transients_stacking_order.constEnd();
|
sendClientToDesktop(*it, desk, dont_activate);
|
||||||
++it)
|
|
||||||
sendClientToDesktop(*it, desk, dont_activate);
|
|
||||||
}
|
|
||||||
updateClientArea();
|
updateClientArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue