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
This commit is contained in:
Eike Hein 2016-04-20 01:13:08 +09:00
parent 90e80a548c
commit 9d3cea7092
3 changed files with 24 additions and 0 deletions

View file

@ -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();

View file

@ -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);
}
}
}

View file

@ -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;