diff --git a/src/wayland/autotests/client/test_plasma_window_model.cpp b/src/wayland/autotests/client/test_plasma_window_model.cpp index c44e13cb3a..1c5241902b 100644 --- a/src/wayland/autotests/client/test_plasma_window_model.cpp +++ b/src/wayland/autotests/client/test_plasma_window_model.cpp @@ -70,6 +70,7 @@ private Q_SLOTS: void testIsOnAllDesktops(); void testIsDemandingAttention(); void testSkipTaskbar(); + void testSkipSwitcher(); void testIsShadeable(); void testIsShaded(); void testIsMovable(); @@ -235,6 +236,7 @@ void PlasmaWindowModelTest::testRoleNames_data() QTest::newRow("IsOnAllDesktops") << int(PlasmaWindowModel::IsOnAllDesktops) << QByteArrayLiteral("IsOnAllDesktops"); QTest::newRow("IsDemandingAttention") << int(PlasmaWindowModel::IsDemandingAttention) << QByteArrayLiteral("IsDemandingAttention"); QTest::newRow("SkipTaskbar") << int(PlasmaWindowModel::SkipTaskbar) << QByteArrayLiteral("SkipTaskbar"); + QTest::newRow("SkipSwitcher") << int(PlasmaWindowModel::SkipSwitcher) << QByteArrayLiteral("SkipSwitcher"); QTest::newRow("IsShadeable") << int(PlasmaWindowModel::IsShadeable) << QByteArrayLiteral("IsShadeable"); QTest::newRow("IsShaded") << int(PlasmaWindowModel::IsShaded) << QByteArrayLiteral("IsShaded"); QTest::newRow("IsMovable") << int(PlasmaWindowModel::IsMovable) << QByteArrayLiteral("IsMovable"); @@ -414,6 +416,11 @@ void PlasmaWindowModelTest::testSkipTaskbar() QVERIFY(testBooleanData(PlasmaWindowModel::SkipTaskbar, &PlasmaWindowInterface::setSkipTaskbar)); } +void PlasmaWindowModelTest::testSkipSwitcher() +{ + QVERIFY(testBooleanData(PlasmaWindowModel::SkipSwitcher, &PlasmaWindowInterface::setSkipSwitcher)); +} + void PlasmaWindowModelTest::testIsShadeable() { QVERIFY(testBooleanData(PlasmaWindowModel::IsShadeable, &PlasmaWindowInterface::setShadeable)); diff --git a/src/wayland/autotests/client/test_plasmashell.cpp b/src/wayland/autotests/client/test_plasmashell.cpp index 0cfc83d5a8..2e9b538f42 100644 --- a/src/wayland/autotests/client/test_plasmashell.cpp +++ b/src/wayland/autotests/client/test_plasmashell.cpp @@ -47,6 +47,7 @@ private Q_SLOTS: void testRole(); void testPosition(); void testSkipTaskbar(); + void testSkipSwitcher(); void testPanelBehavior_data(); void testPanelBehavior(); void testAutoHidePanel(); @@ -297,6 +298,41 @@ void TestPlasmaShell::testSkipTaskbar() QVERIFY(!sps->skipTaskbar()); } +void TestPlasmaShell::testSkipSwitcher() +{ + // this test verifies that Skip Switcher is properly passed to server + QSignalSpy plasmaSurfaceCreatedSpy(m_plasmaShellInterface, &PlasmaShellInterface::surfaceCreated); + QVERIFY(plasmaSurfaceCreatedSpy.isValid()); + + QScopedPointer s(m_compositor->createSurface()); + QScopedPointer ps(m_plasmaShell->createSurface(s.data())); + QVERIFY(plasmaSurfaceCreatedSpy.wait()); + QCOMPARE(plasmaSurfaceCreatedSpy.count(), 1); + + // verify that we got a plasma shell surface + auto sps = plasmaSurfaceCreatedSpy.first().first().value(); + QVERIFY(sps); + QVERIFY(sps->surface()); + QVERIFY(!sps->skipSwitcher()); + + // now change + QSignalSpy skipSwitcherChangedSpy(sps, &PlasmaShellSurfaceInterface::skipSwitcherChanged); + QVERIFY(skipSwitcherChangedSpy.isValid()); + ps->setSkipSwitcher(true); + QVERIFY(skipSwitcherChangedSpy.wait()); + QVERIFY(sps->skipSwitcher()); + // setting to same again should not emit the signal + ps->setSkipSwitcher(true); + QEXPECT_FAIL("", "Should not be emitted if not changed", Continue); + QVERIFY(!skipSwitcherChangedSpy.wait(100)); + QVERIFY(sps->skipSwitcher()); + + // setting to false should change again + ps->setSkipSwitcher(false); + QVERIFY(skipSwitcherChangedSpy.wait()); + QVERIFY(!sps->skipSwitcher()); +} + void TestPlasmaShell::testPanelBehavior_data() { QTest::addColumn("client"); diff --git a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp index 2ec42f77ac..353d3ae392 100644 --- a/src/wayland/autotests/client/test_wayland_windowmanagement.cpp +++ b/src/wayland/autotests/client/test_wayland_windowmanagement.cpp @@ -407,6 +407,7 @@ void TestWindowManagement::testRequestsBoolean_data() QTest::newRow("maximizable") << &PlasmaWindowInterface::maximizeableRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MAXIMIZABLE); QTest::newRow("fullscreenable") << &PlasmaWindowInterface::fullscreenableRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_FULLSCREENABLE); QTest::newRow("skiptaskbar") << &PlasmaWindowInterface::skipTaskbarRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPTASKBAR); + QTest::newRow("skipSwitcher") << &PlasmaWindowInterface::skipSwitcherRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER); QTest::newRow("shadeable") << &PlasmaWindowInterface::shadeableRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE); QTest::newRow("shaded") << &PlasmaWindowInterface::shadedRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADED); QTest::newRow("movable") << &PlasmaWindowInterface::movableRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MOVABLE); diff --git a/src/wayland/plasmashell_interface.cpp b/src/wayland/plasmashell_interface.cpp index ccf3e17176..7540d1eb47 100644 --- a/src/wayland/plasmashell_interface.cpp +++ b/src/wayland/plasmashell_interface.cpp @@ -50,7 +50,7 @@ private: static const quint32 s_version; }; -const quint32 PlasmaShellInterface::Private::s_version = 4; +const quint32 PlasmaShellInterface::Private::s_version = 5; PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d) : Global::Private(d, &org_kde_plasma_shell_interface, s_version) @@ -76,6 +76,7 @@ public: bool m_positionSet = false; PanelBehavior m_panelBehavior = PanelBehavior::AlwaysVisible; bool m_skipTaskbar = false; + bool m_skipSwitcher = false; bool panelTakesFocus = false; private: @@ -85,6 +86,7 @@ private: static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); static void setPanelBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); static void setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip); + static void setSkipSwitcherCallback(wl_client *client, wl_resource *resource, uint32_t skip); static void panelAutoHideHideCallback(wl_client *client, wl_resource *resource); static void panelAutoHideShowCallback(wl_client *client, wl_resource *resource); static void panelTakesFocusCallback(wl_client *client, wl_resource *resource, uint32_t takesFocus); @@ -165,7 +167,8 @@ const struct org_kde_plasma_surface_interface PlasmaShellSurfaceInterface::Priva setSkipTaskbarCallback, panelAutoHideHideCallback, panelAutoHideShowCallback, - panelTakesFocusCallback + panelTakesFocusCallback, + setSkipSwitcherCallback }; #endif @@ -277,6 +280,14 @@ void PlasmaShellSurfaceInterface::Private::setSkipTaskbarCallback(wl_client *cli emit s->q_func()->skipTaskbarChanged(); } +void PlasmaShellSurfaceInterface::Private::setSkipSwitcherCallback(wl_client *client, wl_resource *resource, uint32_t skip) +{ + auto s = cast(resource); + Q_ASSERT(client == *s->client); + s->m_skipSwitcher = (bool)skip; + emit s->q_func()->skipSwitcherChanged(); +} + void PlasmaShellSurfaceInterface::Private::panelAutoHideHideCallback(wl_client *client, wl_resource *resource) { auto s = cast(resource); @@ -361,6 +372,12 @@ bool PlasmaShellSurfaceInterface::skipTaskbar() const return d->m_skipTaskbar; } +bool PlasmaShellSurfaceInterface::skipSwitcher() const +{ + Q_D(); + return d->m_skipSwitcher; +} + void PlasmaShellSurfaceInterface::hideAutoHidingPanel() { Q_D(); diff --git a/src/wayland/plasmashell_interface.h b/src/wayland/plasmashell_interface.h index dbc26affb5..73033350bc 100644 --- a/src/wayland/plasmashell_interface.h +++ b/src/wayland/plasmashell_interface.h @@ -135,9 +135,16 @@ public: * @returns true if this window doesn't want to be listed * in the taskbar * @since 5.5 - */ + **/ bool skipTaskbar() const; + /** + * @returns true if this window doesn't want to be listed + * in a window switcher + * @since 5.45 + **/ + bool skipSwitcher() const; + /** * Informs the PlasmaShellSurfaceInterface that the auto-hiding panel got hidden. * Once it is shown again the method {@link showAutoHidingPanel} should be used. @@ -192,6 +199,10 @@ Q_SIGNALS: * A change in the skip taskbar property has been requested */ void skipTaskbarChanged(); + /** + * A change in the skip switcher property has been requested + **/ + void skipSwitcherChanged(); /** * A surface with Role Panel and PanelBehavior AutoHide requested to be hidden. diff --git a/src/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index cfcadfb02d..7c954c2836 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -119,7 +119,7 @@ private: static const struct org_kde_plasma_window_interface s_interface; }; -const quint32 PlasmaWindowManagementInterface::Private::s_version = 7; +const quint32 PlasmaWindowManagementInterface::Private::s_version = 9; PlasmaWindowManagementInterface::Private::Private(PlasmaWindowManagementInterface *q, Display *d) : Global::Private(d, &org_kde_plasma_window_management_interface, s_version) @@ -602,6 +602,9 @@ void PlasmaWindowInterface::Private::setStateCallback(wl_client *client, wl_reso if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPTASKBAR) { emit p->q->skipTaskbarRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPTASKBAR); } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER) { + emit p->q->skipSwitcherRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER); + } if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE) { emit p->q->shadeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE); } @@ -761,6 +764,11 @@ void PlasmaWindowInterface::setSkipTaskbar(bool set) d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPTASKBAR, set); } +void PlasmaWindowInterface::setSkipSwitcher(bool skip) +{ + d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER, skip); +} + #ifndef KWAYLANDSERVER_NO_DEPRECATED void PlasmaWindowInterface::setThemedIconName(const QString &iconName) { diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index c627840445..4f07ed7c1d 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -108,6 +108,7 @@ public: void setMaximizeable(bool set); void setFullscreenable(bool set); void setSkipTaskbar(bool skip); + void setSkipSwitcher(bool skip); /** * @deprecated since 5.28 use setIcon * @see setIcon @@ -204,6 +205,7 @@ Q_SIGNALS: void maximizeableRequested(bool set); void fullscreenableRequested(bool set); void skipTaskbarRequested(bool set); + void skipSwitcherRequested(bool set); QRect minimizedGeometriesChanged(); /** * @since 5.22 diff --git a/src/wayland/tests/plasmasurfacetest.cpp b/src/wayland/tests/plasmasurfacetest.cpp index b495b97d2a..17c74e5a78 100644 --- a/src/wayland/tests/plasmasurfacetest.cpp +++ b/src/wayland/tests/plasmasurfacetest.cpp @@ -49,6 +49,10 @@ public: m_skipTaskbar = set; } + void setSkipSwitcher(bool set) { + m_skipSwitcher = set; + } + private: void setupRegistry(Registry *registry); void render(); @@ -64,6 +68,7 @@ private: PlasmaShellSurface *m_plasmaShellSurface = nullptr; PlasmaShellSurface::Role m_role = PlasmaShellSurface::Role::Normal; bool m_skipTaskbar = false; + bool m_skipSwitcher = false; }; PlasmaSurfaceTest::PlasmaSurfaceTest(QObject *parent) @@ -136,6 +141,7 @@ void PlasmaSurfaceTest::setupRegistry(Registry *registry) m_plasmaShellSurface = m_plasmaShell->createSurface(m_surface, this); Q_ASSERT(m_plasmaShellSurface); m_plasmaShellSurface->setSkipTaskbar(m_skipTaskbar); + m_plasmaShellSurface->setSkipSwitcher(m_skipSwitcher); m_plasmaShellSurface->setRole(m_role); render(); } @@ -177,6 +183,9 @@ int main(int argc, char **argv) QCommandLineOption skipTaskbarOption(QStringLiteral("skipTaskbar")); parser.addOption(skipTaskbarOption); parser.process(app); + QCommandLineOption skipSwitcherOption(QStringLiteral("skipSwitcher")); + parser.addOption(skipSwitcherOption); + parser.process(app); PlasmaSurfaceTest client; @@ -192,6 +201,7 @@ int main(int argc, char **argv) client.setRole(PlasmaShellSurface::Role::ToolTip); } client.setSkipTaskbar(parser.isSet(skipTaskbarOption)); + client.setSkipSwitcher(parser.isSet(skipSwitcherOption)); client.init();