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 @@ -64,6 +64,7 @@ void testIsShaded(); void testIsMovable(); void testIsResizable(); + void testIsVirtualDesktopChangeable(); void testTitle(); void testAppId(); void testVirtualDesktop(); @@ -223,6 +224,7 @@ QTest::newRow("IsShaded") << int(PlasmaWindowModel::IsShaded) << QByteArrayLiteral("IsShaded"); QTest::newRow("IsMovable") << int(PlasmaWindowModel::IsMovable) << QByteArrayLiteral("IsMovable"); QTest::newRow("IsResizable") << int(PlasmaWindowModel::IsResizable) << QByteArrayLiteral("IsResizable"); + QTest::newRow("IsVirtualDesktopChangeable") << int(PlasmaWindowModel::IsVirtualDesktopChangeable) << QByteArrayLiteral("IsVirtualDesktopChangeable"); } void PlasmaWindowModelTest::testRoleNames() @@ -305,6 +307,7 @@ QTest::newRow("SkipTaskbar") << int(PlasmaWindowModel::SkipTaskbar) << 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); } void PlasmaWindowModelTest::testDefaultData() @@ -404,6 +407,11 @@ QVERIFY(testBooleanData(PlasmaWindowModel::IsResizable, &PlasmaWindowInterface::setResizable)); } +void PlasmaWindowModelTest::testIsVirtualDesktopChangeable() +{ + QVERIFY(testBooleanData(PlasmaWindowModel::IsVirtualDesktopChangeable, &PlasmaWindowInterface::setVirtualDesktopChangeable)); +} + void PlasmaWindowModelTest::testTitle() { auto model = m_pw->createWindowModel(); diff --git a/src/client/plasmawindowmanagement.h b/src/client/plasmawindowmanagement.h --- a/src/client/plasmawindowmanagement.h +++ b/src/client/plasmawindowmanagement.h @@ -238,6 +238,10 @@ * @since 5.7 */ bool isResizable() const; + /** + * @since 5.7 + */ + bool isVirtualDesktopChangeable() const; void requestActivate(); void requestClose(); @@ -320,6 +324,10 @@ * @since 5.7 */ void resizableChanged(); + /** + * @since 5.7 + */ + void virtualDesktopChangeableChanged(); void unmapped(); private: diff --git a/src/client/plasmawindowmanagement.cpp b/src/client/plasmawindowmanagement.cpp --- a/src/client/plasmawindowmanagement.cpp +++ b/src/client/plasmawindowmanagement.cpp @@ -267,6 +267,7 @@ bool shaded = false; bool movable = false; bool resizable = false; + bool virtualDesktopChangeable = false; QIcon icon; private: @@ -293,6 +294,7 @@ void setShaded(bool set); void setMovable(bool set); void setResizable(bool set); + void setVirtualDesktopChangeable(bool set); static Private *cast(void *data) { return reinterpret_cast(data); @@ -376,6 +378,7 @@ p->setShaded(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_SHADED); p->setMovable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_MOVABLE); p->setResizable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_RESIZABLE); + p->setVirtualDesktopChangeable(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_VIRTUAL_DESKTOP_CHANGEABLE); } void PlasmaWindow::Private::themedIconNameChangedCallback(void *data, org_kde_plasma_window *window, const char *name) @@ -540,6 +543,15 @@ emit q->resizableChanged(); } +void PlasmaWindow::Private::setVirtualDesktopChangeable(bool set) +{ + if (virtualDesktopChangeable == set) { + return; + } + virtualDesktopChangeable = set; + emit q->virtualDesktopChangeableChanged(); +} + PlasmaWindow::Private::Private(org_kde_plasma_window *w, quint32 internalId, PlasmaWindow *q) : internalId(internalId) , q(q) @@ -690,6 +702,11 @@ return d->movable; } +bool PlasmaWindow::isVirtualDesktopChangeable() const +{ + return d->virtualDesktopChangeable; +} + void PlasmaWindow::requestActivate() { org_kde_plasma_window_set_state(d->window, diff --git a/src/client/plasmawindowmodel.h b/src/client/plasmawindowmodel.h --- a/src/client/plasmawindowmodel.h +++ b/src/client/plasmawindowmodel.h @@ -90,7 +90,11 @@ /** * @since 5.7 */ - IsResizable + IsResizable, + /** + * @since 5.7 + */ + IsVirtualDesktopChangeable }; explicit PlasmaWindowModel(PlasmaWindowManagement *parent); diff --git a/src/client/plasmawindowmodel.cpp b/src/client/plasmawindowmodel.cpp --- a/src/client/plasmawindowmodel.cpp +++ b/src/client/plasmawindowmodel.cpp @@ -147,6 +147,10 @@ QObject::connect(window, &PlasmaWindow::resizableChanged, [window, this] { this->dataChanged(window, IsResizable); } ); + + QObject::connect(window, &PlasmaWindow::virtualDesktopChangeableChanged, + [window, this] { this->dataChanged(window, IsVirtualDesktopChangeable); } + ); } void PlasmaWindowModel::Private::dataChanged(PlasmaWindow *window, int role) @@ -247,6 +251,8 @@ return window->isMovable(); } else if (role == IsResizable) { return window->isResizable(); + } else if (role == IsVirtualDesktopChangeable) { + return window->isVirtualDesktopChangeable(); } return QVariant(); 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 @@ -45,6 +45,7 @@ + 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 @@ -101,6 +101,10 @@ * @since 5.7 */ void setResizable(bool set); + /** + * @since 5.7 + */ + void setVirtualDesktopChangeable(bool set); void unmap(); @@ -151,6 +155,10 @@ * @since 5.7 */ void resizableRequested(bool set); + /** + * @since 5.7 + */ + void virtualDesktopChangeableRequested(bool set); private: friend class PlasmaWindowManagementInterface; 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 @@ -475,6 +475,9 @@ if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_RESIZABLE) { emit p->q->resizableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_RESIZABLE); } + if (flags & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_VIRTUAL_DESKTOP_CHANGEABLE) { + emit p->q->virtualDesktopChangeableRequested(state & ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_VIRTUAL_DESKTOP_CHANGEABLE); + } } void PlasmaWindowInterface::Private::setMinimizedGeometryCallback(wl_client *client, wl_resource *resource, wl_resource *panel, uint32_t x, uint32_t y, uint32_t width, uint32_t height) @@ -639,5 +642,10 @@ d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_RESIZABLE, set); } +void PlasmaWindowInterface::setVirtualDesktopChangeable(bool set) +{ + d->setState(ORG_KDE_PLASMA_WINDOW_MANAGEMENT_STATE_VIRTUAL_DESKTOP_CHANGEABLE, set); +} + } }