Add rows info to the plasma virtual desktop protocol

Summary:
in order for the pager to work correctly and not having to use a weird mix of wayland and dbus apis, the rows
number needs to be in the protocol

Test Plan: new passing autotest

Reviewers: #plasma, #kwin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: zzag, davidedmundson, hein, kde-frameworks-devel

Tags: #frameworks

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D17691
This commit is contained in:
Marco Martin 2019-01-22 10:18:46 +01:00
parent 5d775a4e28
commit ee1e49ad68
3 changed files with 32 additions and 3 deletions

View file

@ -46,6 +46,7 @@ private Q_SLOTS:
void cleanup();
void testCreate();
void testSetRows();
void testConnectNewClient();
void testDestroy();
void testActivate();
@ -268,6 +269,18 @@ void TestVirtualDesktop::testCreate()
}
}
void TestVirtualDesktop::testSetRows()
{
//rebuild some desktops
testCreate();
QSignalSpy rowsChangedSpy(m_plasmaVirtualDesktopManagement, &PlasmaVirtualDesktopManagement::rowsChanged);
m_plasmaVirtualDesktopManagementInterface->setRows(3);
QVERIFY(rowsChangedSpy.wait());
QCOMPARE(m_plasmaVirtualDesktopManagement->rows(), 3);
}
void TestVirtualDesktop::testConnectNewClient()
{
//rebuild some desktops

View file

@ -91,7 +91,7 @@ private:
static const quint32 s_version;
};
const quint32 PlasmaVirtualDesktopManagementInterface::Private::s_version = 1;
const quint32 PlasmaVirtualDesktopManagementInterface::Private::s_version = 2;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
const struct org_kde_plasma_virtual_desktop_management_interface PlasmaVirtualDesktopManagementInterface::Private::s_interface = {
@ -190,6 +190,21 @@ PlasmaVirtualDesktopManagementInterface::Private *PlasmaVirtualDesktopManagement
return reinterpret_cast<Private*>(d.data());
}
void PlasmaVirtualDesktopManagementInterface::setRows(quint32 rows)
{
if (rows == 0) {
return;
}
Q_D();
for (auto it = d->resources.constBegin(); it != d->resources.constEnd(); ++it) {
if (wl_resource_get_version(*it) < ORG_KDE_PLASMA_VIRTUAL_DESKTOP_MANAGEMENT_ROWS_SINCE_VERSION) {
continue;
}
org_kde_plasma_virtual_desktop_management_send_rows(*it, rows);
}
}
PlasmaVirtualDesktopInterface *PlasmaVirtualDesktopManagementInterface::desktop(const QString &id)
{
Q_D();

View file

@ -46,9 +46,10 @@ public:
virtual ~PlasmaVirtualDesktopManagementInterface();
/**
* Sets a new layout for this desktop grid.
* Sets how many rows the virtual desktops should be laid into
* @since 5.55
*/
void setLayout(quint32 rows, quint32 columns);
void setRows(quint32 rows);
/**
* @returns A desktop identified uniquely by this id.