diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp index d3ffa887e5..a6ab4431fd 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("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(Test::createSurface()); + QFETCH(Test::ShellSurfaceType, type); + QScopedPointer shellSurface(qobject_cast( + 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 transientSurface(Test::createSurface()); + QScopedPointer transientShellSurface(qobject_cast( + 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 b7291791d5..7ce764ec2d 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()