diff --git a/autotests/integration/plasma_surface_test.cpp b/autotests/integration/plasma_surface_test.cpp --- a/autotests/integration/plasma_surface_test.cpp +++ b/autotests/integration/plasma_surface_test.cpp @@ -63,6 +63,7 @@ void testPanelTypeHasStrut(); void testPanelActivate_data(); void testPanelActivate(); + void testKeepOnTop(); private: KWayland::Client::Compositor *m_compositor = nullptr; @@ -447,5 +448,35 @@ QCOMPARE(panel->isActive(), active); } +void PlasmaSurfaceTest::testKeepOnTop() +{ + QScopedPointer surface(Test::createSurface()); + QVERIFY(!surface.isNull()); + QScopedPointer shellSurface(Test::createShellSurface(Test::ShellSurfaceType::WlShell, surface.data())); + QVERIFY(!shellSurface.isNull()); + QScopedPointer plasmaSurface(m_plasmaShell->createSurface(surface.data())); + QVERIFY(!plasmaSurface.isNull()); + + + auto popup = Test::renderAndWaitForShown(surface.data(), QSize(100, 200), Qt::blue); + QVERIFY(popup); + QSignalSpy keepAboveSpy(popup, &AbstractClient::keepAboveChanged); + + //default state + QCOMPARE(popup->keepAbove(), false); + + //set + plasmaSurface->setPopupBehavior(KWayland::Client::PlasmaShellSurface::PopupBehavior::AlwaysOnTop); + keepAboveSpy.wait(); + QCOMPARE(popup->keepAbove(), true); + + //revert back to default + plasmaSurface->setPopupBehavior(0); + keepAboveSpy.wait(); + QCOMPARE(popup->keepAbove(), false); +} + + + WAYLANDTEST_MAIN(PlasmaSurfaceTest) #include "plasma_surface_test.moc" diff --git a/shell_client.cpp b/shell_client.cpp --- a/shell_client.cpp +++ b/shell_client.cpp @@ -1335,14 +1335,20 @@ workspace()->updateClientArea(); } }; + auto updatePopupFlags = [this, surface] { + setKeepAbove(surface->popupBehavior() & PlasmaShellSurfaceInterface::PopupBehavior::AlwaysOnTop); + }; connect(surface, &PlasmaShellSurfaceInterface::positionChanged, this, updatePosition); connect(surface, &PlasmaShellSurfaceInterface::roleChanged, this, updateRole); connect(surface, &PlasmaShellSurfaceInterface::panelBehaviorChanged, this, [this] { updateShowOnScreenEdge(); workspace()->updateClientArea(); } ); + + connect(surface, &PlasmaShellSurfaceInterface::popupBehaviorChanged, this, updatePopupFlags); + connect(surface, &PlasmaShellSurfaceInterface::panelAutoHideHideRequested, this, [this] { hideClient(true); @@ -1357,6 +1363,7 @@ m_plasmaShellSurface->showAutoHidingPanel(); } ); + updatePopupFlags(); updatePosition(); updateRole(); updateShowOnScreenEdge();