diff --git a/.arclint b/.arclint deleted file mode 100644 --- a/.arclint +++ /dev/null @@ -1,20 +0,0 @@ -{ - "exclude": "(^test/)", - "linters": { - "spelling": { - "type": "spelling" - }, - "merge-conflict": { - "type": "merge-conflict" - }, - "xml": { - "type": "xml", - "include": "(\\.xml$)" - }, - "cppcheck": { - "type": "cppcheck", - "include": "(\\.(cpp|h|cxx|hpp)$)", - "flags": ["--language=c++", "--std=c++11"] - } - } -} diff --git a/autotests/client/test_plasma_window_model.cpp b/autotests/client/test_plasma_window_model.cpp --- a/autotests/client/test_plasma_window_model.cpp +++ b/autotests/client/test_plasma_window_model.cpp @@ -71,6 +71,7 @@ void testIsDemandingAttention(); void testSkipTaskbar(); void testSkipSwitcher(); + void testSkipPager(); void testIsShadeable(); void testIsShaded(); void testIsMovable(); @@ -237,6 +238,7 @@ 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("SkipPager") << int(PlasmaWindowModel::SkipPager) << QByteArrayLiteral("SkipPager"); QTest::newRow("IsShadeable") << int(PlasmaWindowModel::IsShadeable) << QByteArrayLiteral("IsShadeable"); QTest::newRow("IsShaded") << int(PlasmaWindowModel::IsShaded) << QByteArrayLiteral("IsShaded"); QTest::newRow("IsMovable") << int(PlasmaWindowModel::IsMovable) << QByteArrayLiteral("IsMovable"); @@ -331,6 +333,7 @@ QTest::newRow("IsShadeable") << int(PlasmaWindowModel::IsShadeable) << QVariant(false); QTest::newRow("IsShaded") << int(PlasmaWindowModel::IsShaded) << QVariant(false); QTest::newRow("SkipTaskbar") << int(PlasmaWindowModel::SkipTaskbar) << QVariant(false); + QTest::newRow("SkipPager") << int(PlasmaWindowModel::SkipPager) << QVariant(false); QTest::newRow("IsMovable") << int(PlasmaWindowModel::IsMovable) << QVariant(false); QTest::newRow("IsResizable") << int(PlasmaWindowModel::IsResizable) << QVariant(false); QTest::newRow("IsVirtualDesktopChangeable") << int(PlasmaWindowModel::IsVirtualDesktopChangeable) << QVariant(false); @@ -421,6 +424,11 @@ QVERIFY(testBooleanData(PlasmaWindowModel::SkipSwitcher, &PlasmaWindowInterface::setSkipSwitcher)); } +void PlasmaWindowModelTest::testSkipPager() +{ + QVERIFY(testBooleanData(PlasmaWindowModel::SkipPager, &PlasmaWindowInterface::setSkipPager)); +} + void PlasmaWindowModelTest::testIsShadeable() { QVERIFY(testBooleanData(PlasmaWindowModel::IsShadeable, &PlasmaWindowInterface::setShadeable)); @@ -851,6 +859,7 @@ QTest::newRow("maximizeable") << &PlasmaWindow::maximizeableChanged << qVariantFromValue(&PlasmaWindowInterface::setMaximizeable) << QVariant(true); QTest::newRow("fullscreenable") << &PlasmaWindow::fullscreenableChanged << qVariantFromValue(&PlasmaWindowInterface::setFullscreenable) << QVariant(true); QTest::newRow("skipTaskbar") << &PlasmaWindow::skipTaskbarChanged << qVariantFromValue(&PlasmaWindowInterface::setSkipTaskbar) << QVariant(true); + QTest::newRow("skipPager") << &PlasmaWindow::skipPagerChanged << qVariantFromValue(&PlasmaWindowInterface::setSkipPager) << QVariant(true); QTest::newRow("shadeable") << &PlasmaWindow::shadeableChanged << qVariantFromValue(&PlasmaWindowInterface::setShadeable) << QVariant(true); QTest::newRow("shaded") << &PlasmaWindow::shadedChanged << qVariantFromValue(&PlasmaWindowInterface::setShaded) << QVariant(true); QTest::newRow("movable") << &PlasmaWindow::movableChanged << qVariantFromValue(&PlasmaWindowInterface::setMovable) << QVariant(true); diff --git a/autotests/client/test_plasmashell.cpp b/autotests/client/test_plasmashell.cpp --- a/autotests/client/test_plasmashell.cpp +++ b/autotests/client/test_plasmashell.cpp @@ -48,6 +48,7 @@ void testPosition(); void testSkipTaskbar(); void testSkipSwitcher(); + void testSkipPager(); void testPanelBehavior_data(); void testPanelBehavior(); void testAutoHidePanel(); @@ -333,6 +334,42 @@ QVERIFY(!sps->skipSwitcher()); } +void TestPlasmaShell::testSkipPager() +{ + // this test verifies that Skip Pager 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->skipPager()); + + // now change + QSignalSpy skipPagerChangedSpy(sps, &PlasmaShellSurfaceInterface::skipPagerChanged); + QVERIFY(skipPagerChangedSpy.isValid()); + ps->setSkipPager(true); + QVERIFY(skipPagerChangedSpy.wait()); + QVERIFY(sps->skipPager()); + // setting to same again should not emit the signal + ps->setSkipPager(true); + QEXPECT_FAIL("", "Should not be emitted if not changed", Continue); + QVERIFY(!skipPagerChangedSpy.wait(100)); + QVERIFY(sps->skipPager()); + + // setting to false should change again + ps->setSkipPager(false); + QVERIFY(skipPagerChangedSpy.wait()); + QVERIFY(!sps->skipPager()); +} + + void TestPlasmaShell::testPanelBehavior_data() { QTest::addColumn("client"); diff --git a/autotests/client/test_wayland_windowmanagement.cpp b/autotests/client/test_wayland_windowmanagement.cpp --- a/autotests/client/test_wayland_windowmanagement.cpp +++ b/autotests/client/test_wayland_windowmanagement.cpp @@ -408,6 +408,7 @@ 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("skipPager") << &PlasmaWindowInterface::skipPagerRequested << int(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPPAGER); 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/client/plasmashell.h b/src/client/plasmashell.h --- a/src/client/plasmashell.h +++ b/src/client/plasmashell.h @@ -294,6 +294,12 @@ */ void setSkipSwitcher(bool skip); + /** + * Setting this bit on a window will cause it to be excluded from desktop pagers + * @since 5.xx + **/ + void setSkipPager(bool skip); + /** * Requests to hide a surface with Role Panel and PanelBahvior AutoHide. * diff --git a/src/client/plasmashell.cpp b/src/client/plasmashell.cpp --- a/src/client/plasmashell.cpp +++ b/src/client/plasmashell.cpp @@ -327,6 +327,11 @@ org_kde_plasma_surface_set_skip_switcher(d->surface, skip); } +void PlasmaShellSurface::setSkipPager(bool skip) +{ + org_kde_plasma_surface_set_skip_pager(d->surface, skip); +} + void PlasmaShellSurface::requestHideAutoHidingPanel() { org_kde_plasma_surface_panel_auto_hide_hide(d->surface); diff --git a/src/client/plasmawindowmanagement.h b/src/client/plasmawindowmanagement.h --- a/src/client/plasmawindowmanagement.h +++ b/src/client/plasmawindowmanagement.h @@ -347,6 +347,11 @@ * @see skipSwitcherChanged **/ bool skipSwitcher() const; + /** + * @returns Whether the window should be ignored by the desktop pager + * @see skipPagerChanged + */ + bool skipPager() const; /** * @returns The icon of the window. * @see iconChanged @@ -566,6 +571,11 @@ * @see skipSwitcher **/ void skipSwitcherChanged(); + /** + * The skip pager state has changed + * @see skipPager + **/ + void skipPagerChanged(); /** * The window icon changed. * @see icon diff --git a/src/client/plasmawindowmanagement.cpp b/src/client/plasmawindowmanagement.cpp --- a/src/client/plasmawindowmanagement.cpp +++ b/src/client/plasmawindowmanagement.cpp @@ -83,6 +83,7 @@ bool fullscreenable = false; bool skipTaskbar = false; bool skipSwitcher = false; + bool skipPager = false; bool shadeable = false; bool shaded = false; bool movable = false; @@ -122,6 +123,7 @@ void setFullscreenable(bool set); void setSkipTaskbar(bool skip); void setSkipSwitcher(bool skip); + void setSkipPager(bool skip); void setShadeable(bool set); void setShaded(bool set); void setMovable(bool set); @@ -476,6 +478,7 @@ p->setMinimizeable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MINIMIZABLE); p->setSkipTaskbar(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPTASKBAR); p->setSkipSwitcher(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER); + p->setSkipPager(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPPAGER); p->setShadeable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE); p->setShaded(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADED); p->setMovable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MOVABLE); @@ -683,6 +686,15 @@ emit q->skipSwitcherChanged(); } +void PlasmaWindow::Private::setSkipPager(bool skip) +{ + if (skipPager == skip) { + return; + } + skipPager = skip; + emit q->skipPagerChanged(); +} + void PlasmaWindow::Private::setShadeable(bool set) { if (shadeable == set) { @@ -862,6 +874,11 @@ return d->skipSwitcher; } +bool PlasmaWindow::skipPager() const +{ + return d->skipPager; +} + QIcon PlasmaWindow::icon() const { return d->icon; diff --git a/src/client/plasmawindowmodel.h b/src/client/plasmawindowmodel.h --- a/src/client/plasmawindowmodel.h +++ b/src/client/plasmawindowmodel.h @@ -110,6 +110,10 @@ * @since 5.47 */ SkipSwitcher, + /** + * @since 5.xx + */ + SkipPager }; Q_ENUM(AdditionalRoles) diff --git a/src/client/plasmawindowmodel.cpp b/src/client/plasmawindowmodel.cpp --- a/src/client/plasmawindowmodel.cpp +++ b/src/client/plasmawindowmodel.cpp @@ -136,6 +136,10 @@ QObject::connect(window, &PlasmaWindow::skipSwitcherChanged, q, [window, this] { this->dataChanged(window, SkipSwitcher); } ); + + QObject::connect(window, &PlasmaWindow::skipPagerChanged, q, + [window, this] { this->dataChanged(window, SkipPager); } + ); QObject::connect(window, &PlasmaWindow::shadeableChanged, q, [window, this] { this->dataChanged(window, IsShadeable); } @@ -259,6 +263,8 @@ return window->skipTaskbar(); } else if (role == SkipSwitcher) { return window->skipSwitcher(); + } else if (role == SkipPager) { + return window->skipPager(); } else if (role == IsShadeable) { return window->isShadeable(); } else if (role == IsShaded) { diff --git a/src/client/protocols/plasma-shell.xml b/src/client/protocols/plasma-shell.xml --- a/src/client/protocols/plasma-shell.xml +++ b/src/client/protocols/plasma-shell.xml @@ -130,7 +130,7 @@ --> - + An interface that may be implemented by a wl_surface, for implementations that provide the shell user interface. @@ -393,5 +393,13 @@ + + + + Setting this bit will indicate that the window should not be shown in the desktop pager. + + + + diff --git a/src/client/protocols/plasma-window-management.xml b/src/client/protocols/plasma-window-management.xml --- a/src/client/protocols/plasma-window-management.xml +++ b/src/client/protocols/plasma-window-management.xml @@ -17,7 +17,7 @@ along with this program. If not, see . ]]> - + This interface manages application windows. It provides requests to show and hide the desktop and emits @@ -47,6 +47,7 @@ + diff --git a/src/server/plasmashell_interface.h b/src/server/plasmashell_interface.h --- a/src/server/plasmashell_interface.h +++ b/src/server/plasmashell_interface.h @@ -176,12 +176,20 @@ **/ bool panelTakesFocus() const; + /** + * @returns true if this window should not be listed in + * the desktop pager + * @since 5.xx + **/ + bool skipPager() const; + /** * @returns The PlasmaShellSurfaceInterface for the @p native resource. * @since 5.5 **/ static PlasmaShellSurfaceInterface *get(wl_resource *native); + Q_SIGNALS: /** * A change of global position has been requested. @@ -203,6 +211,10 @@ * A change in the skip switcher property has been requested **/ void skipSwitcherChanged(); + /** + * A change in the skip pager property has been requested + **/ + void skipPagerChanged(); /** * A surface with Role Panel and PanelBehavior AutoHide requested to be hidden. diff --git a/src/server/plasmashell_interface.cpp b/src/server/plasmashell_interface.cpp --- a/src/server/plasmashell_interface.cpp +++ b/src/server/plasmashell_interface.cpp @@ -77,6 +77,7 @@ PanelBehavior m_panelBehavior = PanelBehavior::AlwaysVisible; bool m_skipTaskbar = false; bool m_skipSwitcher = false; + bool m_skipPager = false; bool panelTakesFocus = false; private: @@ -87,6 +88,7 @@ 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 setSkipPagerCallback(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); @@ -168,7 +170,8 @@ panelAutoHideHideCallback, panelAutoHideShowCallback, panelTakesFocusCallback, - setSkipSwitcherCallback + setSkipSwitcherCallback, + setSkipPagerCallback }; #endif @@ -288,6 +291,14 @@ emit s->q_func()->skipSwitcherChanged(); } +void PlasmaShellSurfaceInterface::Private::setSkipPagerCallback(wl_client *client, wl_resource *resource, uint32_t skip) +{ + auto s = cast(resource); + Q_ASSERT(client == *s->client); + s->m_skipPager = (bool)skip; + emit s->q_func()->skipPagerChanged(); +} + void PlasmaShellSurfaceInterface::Private::panelAutoHideHideCallback(wl_client *client, wl_resource *resource) { auto s = cast(resource); @@ -378,6 +389,12 @@ return d->m_skipSwitcher; } +bool PlasmaShellSurfaceInterface::skipPager() const +{ + Q_D(); + return d->m_skipPager; +} + void PlasmaShellSurfaceInterface::hideAutoHidingPanel() { Q_D(); diff --git a/src/server/plasmawindowmanagement_interface.h b/src/server/plasmawindowmanagement_interface.h --- a/src/server/plasmawindowmanagement_interface.h +++ b/src/server/plasmawindowmanagement_interface.h @@ -109,6 +109,7 @@ void setFullscreenable(bool set); void setSkipTaskbar(bool skip); void setSkipSwitcher(bool skip); + void setSkipPager(bool skip); /** * @deprecated since 5.28 use setIcon * @see setIcon @@ -206,6 +207,7 @@ void fullscreenableRequested(bool set); void skipTaskbarRequested(bool set); void skipSwitcherRequested(bool set); + void skipPagerRequested(bool set); QRect minimizedGeometriesChanged(); /** * @since 5.22 diff --git a/src/server/plasmawindowmanagement_interface.cpp b/src/server/plasmawindowmanagement_interface.cpp --- a/src/server/plasmawindowmanagement_interface.cpp +++ b/src/server/plasmawindowmanagement_interface.cpp @@ -605,6 +605,9 @@ 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_SKIPPAGER) { + emit p->q->skipPagerRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPPAGER); + } if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE) { emit p->q->shadeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADEABLE); } @@ -769,6 +772,11 @@ d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPSWITCHER, skip); } +void PlasmaWindowInterface::setSkipPager(bool skip) +{ + d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SKIPPAGER, skip); +} + #ifndef KWAYLANDSERVER_NO_DEPRECATED void PlasmaWindowInterface::setThemedIconName(const QString &iconName) { diff --git a/tests/plasmasurfacetest.cpp b/tests/plasmasurfacetest.cpp --- a/tests/plasmasurfacetest.cpp +++ b/tests/plasmasurfacetest.cpp @@ -53,6 +53,10 @@ m_skipSwitcher = set; } + void setSkipPager(bool set) { + m_skipPager = set; + } + private: void setupRegistry(Registry *registry); void render(); @@ -69,6 +73,7 @@ PlasmaShellSurface::Role m_role = PlasmaShellSurface::Role::Normal; bool m_skipTaskbar = false; bool m_skipSwitcher = false; + bool m_skipPager = false; }; PlasmaSurfaceTest::PlasmaSurfaceTest(QObject *parent) @@ -142,6 +147,7 @@ Q_ASSERT(m_plasmaShellSurface); m_plasmaShellSurface->setSkipTaskbar(m_skipTaskbar); m_plasmaShellSurface->setSkipSwitcher(m_skipSwitcher); + m_plasmaShellSurface->setSkipPager(m_skipPager); m_plasmaShellSurface->setRole(m_role); render(); } @@ -186,6 +192,9 @@ QCommandLineOption skipSwitcherOption(QStringLiteral("skipSwitcher")); parser.addOption(skipSwitcherOption); parser.process(app); + QCommandLineOption skipPagerOption(QStringLiteral("skipPager")); + parser.addOption(skipPagerOption); + parser.process(app); PlasmaSurfaceTest client; @@ -202,6 +211,7 @@ } client.setSkipTaskbar(parser.isSet(skipTaskbarOption)); client.setSkipSwitcher(parser.isSet(skipSwitcherOption)); + client.setSkipPager(parser.isSet(skipPagerOption)); client.init();