From 9d3cea7092b1694a5d9bd7c096df757be1251b82 Mon Sep 17 00:00:00 2001 From: Eike Hein Date: Wed, 20 Apr 2016 01:13:08 +0900 Subject: [PATCH] Add a virtual_desktop_changable state to the window protocol. Summary: Analogous to NET::ActionChangeDesktop. KWindowInfo::actionSupported(NET::ActionChangeDesktop) is hardcoded to return true in kwin, but that's not how it should be; as this will be fixed later the Wayland protocol needs this state bit as well for parity. Test Plan: PlasmaWindowModel test is extended. Reviewers: graesslin Subscribers: plasma-devel Projects: #plasma Differential Revision: https://phabricator.kde.org/D1448 --- src/wayland/autotests/client/test_plasma_window_model.cpp | 8 ++++++++ src/wayland/plasmawindowmanagement_interface.cpp | 8 ++++++++ src/wayland/plasmawindowmanagement_interface.h | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/src/wayland/autotests/client/test_plasma_window_model.cpp b/src/wayland/autotests/client/test_plasma_window_model.cpp index d77ef5dbb0..78b8da1864 100644 --- a/src/wayland/autotests/client/test_plasma_window_model.cpp +++ b/src/wayland/autotests/client/test_plasma_window_model.cpp @@ -64,6 +64,7 @@ private Q_SLOTS: void testIsShaded(); void testIsMovable(); void testIsResizable(); + void testIsVirtualDesktopChangeable(); void testTitle(); void testAppId(); void testVirtualDesktop(); @@ -223,6 +224,7 @@ void PlasmaWindowModelTest::testRoleNames_data() 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 @@ void PlasmaWindowModelTest::testDefaultData_data() 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 @@ void PlasmaWindowModelTest::testIsResizable() 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/wayland/plasmawindowmanagement_interface.cpp b/src/wayland/plasmawindowmanagement_interface.cpp index 60b1ed6b41..942ddca34d 100644 --- a/src/wayland/plasmawindowmanagement_interface.cpp +++ b/src/wayland/plasmawindowmanagement_interface.cpp @@ -475,6 +475,9 @@ void PlasmaWindowInterface::Private::setStateCallback(wl_client *client, wl_reso 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 @@ void PlasmaWindowInterface::setResizable(bool set) 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); +} + } } diff --git a/src/wayland/plasmawindowmanagement_interface.h b/src/wayland/plasmawindowmanagement_interface.h index 381c72ec8a..00bbc8f284 100644 --- a/src/wayland/plasmawindowmanagement_interface.h +++ b/src/wayland/plasmawindowmanagement_interface.h @@ -101,6 +101,10 @@ public: * @since 5.7 */ void setResizable(bool set); + /** + * @since 5.7 + */ + void setVirtualDesktopChangeable(bool set); void unmap(); @@ -151,6 +155,10 @@ Q_SIGNALS: * @since 5.7 */ void resizableRequested(bool set); + /** + * @since 5.7 + */ + void virtualDesktopChangeableRequested(bool set); private: friend class PlasmaWindowManagementInterface;