aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Zagorodniy <[email protected]>2018-12-13 18:47:10 +0200
committerVlad Zagorodniy <[email protected]>2018-12-14 21:15:58 +0200
commit7a28e0fe9ae21afa920f2d1c9262c2a15334c2de (patch)
treebc1196ae2e3fded60d0e5848a2a90ee5ce444818
parente86d8461ed8152f8e17858fef5f90c6ad62b7851 (diff)
[wayland] Minimize transients together with parent
Summary: If a parent window is minimized, then its transients have to be minimized as well, so the minimize behavior is the same on both X11 and Wayland. BUG: 401950 FIXED-IN: 5.15.0 Reviewers: #kwin, graesslin Reviewed By: #kwin, graesslin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D17570
-rw-r--r--autotests/integration/shell_client_test.cpp47
-rw-r--r--shell_client.cpp1
2 files changed, 48 insertions, 0 deletions
diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp
index d3ffa88..a6ab443 100644
--- a/autotests/integration/shell_client_test.cpp
+++ b/autotests/integration/shell_client_test.cpp
@@ -94,6 +94,8 @@ private Q_SLOTS:
void testNoDecorationModeRequested();
void testSendClientWithTransientToDesktop_data();
void testSendClientWithTransientToDesktop();
+ void testMinimizeWindowWithTransients_data();
+ void testMinimizeWindowWithTransients();
};
void TestShellClient::initTestCase()
@@ -1145,5 +1147,50 @@ void TestShellClient::testSendClientWithTransientToDesktop()
QCOMPARE(transient->desktop(), 1);
}
+void TestShellClient::testMinimizeWindowWithTransients_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::testMinimizeWindowWithTransients()
+{
+ // this test verifies that when minimizing/unminimizing a window all its
+ // transients will be minimized/unminimized as well
+
+ // create the main window
+ 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);
+ QVERIFY(!c->isMinimized());
+
+ // 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::red);
+ QVERIFY(transient);
+ QVERIFY(!transient->isMinimized());
+ QCOMPARE(transient->transientFor(), c);
+ QVERIFY(c->hasTransient(transient, false));
+
+ // minimize the main window, the transient should be minimized as well
+ c->minimize();
+ QVERIFY(c->isMinimized());
+ QVERIFY(transient->isMinimized());
+
+ // unminimize the main window, the transient should be unminimized as well
+ c->unminimize();
+ QVERIFY(!c->isMinimized());
+ QVERIFY(!transient->isMinimized());
+}
+
WAYLANDTEST_MAIN(TestShellClient)
#include "shell_client_test.moc"
diff --git a/shell_client.cpp b/shell_client.cpp
index b729179..7ce764e 100644
--- a/shell_client.cpp
+++ b/shell_client.cpp
@@ -1850,6 +1850,7 @@ void ShellClient::doMinimize()
} else {
emit windowShown(this);
}
+ workspace()->updateMinimizedOfTransients(this);
}
bool ShellClient::setupCompositing()