Make sure that new virtual desktops can be activated by using plasma virtual desktop protocol
Summary: We need to connect to PlasmaVirtualDesktopInterface::activateRequested when a virtual desktop is created, otherwise one won't be able to activate the desktop by using the pager. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D18342
This commit is contained in:
parent
7274aed544
commit
737bb2ec86
1 changed files with 19 additions and 25 deletions
|
@ -54,19 +54,24 @@ void VirtualDesktopManager::setVirtualDesktopManagement(KWayland::Server::Plasma
|
||||||
Q_ASSERT(!m_virtualDesktopManagement);
|
Q_ASSERT(!m_virtualDesktopManagement);
|
||||||
m_virtualDesktopManagement = management;
|
m_virtualDesktopManagement = management;
|
||||||
|
|
||||||
connect(this, &VirtualDesktopManager::desktopCreated, this,
|
auto createPlasmaVirtualDesktop = [this](VirtualDesktop *desktop) {
|
||||||
[this](VirtualDesktop *desktop) {
|
PlasmaVirtualDesktopInterface *pvd = m_virtualDesktopManagement->createDesktop(desktop->id(), desktop->x11DesktopNumber() - 1);
|
||||||
using namespace KWayland::Server;
|
pvd->setName(desktop->name());
|
||||||
PlasmaVirtualDesktopInterface *pvd = m_virtualDesktopManagement->createDesktop(desktop->id(), desktop->x11DesktopNumber() - 1);
|
pvd->sendDone();
|
||||||
pvd->setName(desktop->name());
|
|
||||||
pvd->sendDone();
|
connect(desktop, &VirtualDesktop::nameChanged, pvd,
|
||||||
connect(desktop, &VirtualDesktop::nameChanged, this,
|
[desktop, pvd] {
|
||||||
[this, desktop, pvd]() {
|
pvd->setName(desktop->name());
|
||||||
pvd->setName(desktop->name());
|
}
|
||||||
}
|
);
|
||||||
);
|
connect(pvd, &PlasmaVirtualDesktopInterface::activateRequested, this,
|
||||||
}
|
[this, desktop] {
|
||||||
);
|
setCurrent(desktop);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
connect(this, &VirtualDesktopManager::desktopCreated, this, createPlasmaVirtualDesktop);
|
||||||
|
|
||||||
//handle removed: from VirtualDesktopManager to the wayland interface
|
//handle removed: from VirtualDesktopManager to the wayland interface
|
||||||
connect(this, &VirtualDesktopManager::desktopRemoved, this,
|
connect(this, &VirtualDesktopManager::desktopRemoved, this,
|
||||||
|
@ -94,19 +99,8 @@ void VirtualDesktopManager::setVirtualDesktopManagement(KWayland::Server::Plasma
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
for (quint32 i = 1; i <= count(); ++i) {
|
std::for_each(m_desktops.constBegin(), m_desktops.constEnd(), createPlasmaVirtualDesktop);
|
||||||
VirtualDesktop *internalDesktop = desktopForX11Id(i);
|
|
||||||
PlasmaVirtualDesktopInterface *desktop = m_virtualDesktopManagement->createDesktop(internalDesktop->id());
|
|
||||||
|
|
||||||
desktop->setName(internalDesktop->name());
|
|
||||||
desktop->sendDone();
|
|
||||||
|
|
||||||
connect(desktop, &PlasmaVirtualDesktopInterface::activateRequested, this,
|
|
||||||
[this, desktop] () {
|
|
||||||
setCurrent(desktopForId(desktop->id().toUtf8()));
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
//Now we are sure all ids are there
|
//Now we are sure all ids are there
|
||||||
save();
|
save();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue