diff --git a/autotests/integration/placement_test.cpp b/autotests/integration/placement_test.cpp --- a/autotests/integration/placement_test.cpp +++ b/autotests/integration/placement_test.cpp @@ -58,6 +58,7 @@ void testPlaceSmart(); void testPlaceZeroCornered(); void testPlaceMaximized(); + void testPlaceMaximizedLeavesFullscreen(); void testPlaceCentered(); void testPlaceUnderMouse(); void testPlaceCascaded(); @@ -204,6 +205,41 @@ } } +void TestPlacement::testPlaceMaximizedLeavesFullscreen() +{ + setPlacementPolicy(Placement::Maximizing); + + // add a top panel + QScopedPointer panelSurface(Test::createSurface()); + QScopedPointer panelShellSurface(Test::createXdgShellStableSurface(panelSurface.data())); + QScopedPointer plasmaSurface(Test::waylandPlasmaShell()->createSurface(panelSurface.data())); + plasmaSurface->setRole(PlasmaShellSurface::Role::Panel); + plasmaSurface->setPosition(QPoint(0, 0)); + Test::renderAndWaitForShown(panelSurface.data(), QSize(1280, 20), Qt::blue); + + QScopedPointer testParent(new QObject); + + // all windows should be initially fullscreen with an initial configure size sent, despite the policy + for (int i = 0; i < 4; i++) { + auto surface = Test::createSurface(testParent.data()); + auto shellSurface = Test::createXdgShellStableSurface(surface, surface, Test::CreationSetup::CreateOnly); + shellSurface->setFullscreen(true); + QSignalSpy configSpy(shellSurface, &XdgShellSurface::configureRequested); + surface->commit(Surface::CommitFlag::None); + configSpy.wait(); + + auto initiallyConfiguredSize = configSpy[0][0].toSize(); + auto initiallyConfiguredStates = configSpy[0][1].value(); + shellSurface->ackConfigure(configSpy[0][2].toUInt()); + + auto c = Test::renderAndWaitForShown(surface, initiallyConfiguredSize, Qt::red); + + QVERIFY(initiallyConfiguredStates & XdgShellSurface::State::Fullscreen); + QCOMPARE(initiallyConfiguredSize, QSize(1280, 1024 )); + QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024)); + } +} + void TestPlacement::testPlaceCentered() { // This test verifies that Centered placement policy works. diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -112,6 +112,7 @@ void testXdgNeverCommitted(); void testXdgInitialState(); void testXdgInitiallyMaximised(); + void testXdgInitiallyFullscreen(); void testXdgInitiallyMinimized(); void testXdgWindowGeometry(); }; @@ -1243,6 +1244,32 @@ QCOMPARE(c->size(), QSize(1280, 1024)); } +void TestXdgShellClient::testXdgInitiallyFullscreen() +{ + QScopedPointer surface(Test::createSurface()); + QScopedPointer shellSurface(Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); + QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); + + shellSurface->setFullscreen(true); + surface->commit(Surface::CommitFlag::None); + + configureRequestedSpy.wait(); + + QCOMPARE(configureRequestedSpy.count(), 1); + + const auto size = configureRequestedSpy.first()[0].value(); + const auto state = configureRequestedSpy.first()[1].value(); + + QCOMPARE(size, QSize(1280, 1024)); + QVERIFY(state & KWayland::Client::XdgShellSurface::State::Fullscreen); + + shellSurface->ackConfigure(configureRequestedSpy.first()[2].toUInt()); + + auto c = Test::renderAndWaitForShown(surface.data(), size, Qt::blue); + QCOMPARE(c->isFullScreen(), true); + QCOMPARE(c->size(), QSize(1280, 1024)); +} + void TestXdgShellClient::testXdgInitiallyMinimized() { QScopedPointer surface(Test::createSurface()); diff --git a/xdgshellclient.cpp b/xdgshellclient.cpp --- a/xdgshellclient.cpp +++ b/xdgshellclient.cpp @@ -222,6 +222,10 @@ updateWindowRules(Rules::All); } + if (isFullScreen()) { + needsPlacement = false; + } + if (needsPlacement) { const QRect area = workspace()->clientArea(PlacementArea, Screens::self()->current(), desktop()); placeIn(area);