[wayland] Send only clients that were on the removed desktop to a new desktop

Summary:
Currently, if a virtual desktop was removed, then we'll try to send all
clients to the last virtual desktop even though most of those clients
weren't present on the removed virtual desktop.

Test Plan: Manually.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17576
This commit is contained in:
Vlad Zagorodniy 2018-12-14 13:05:53 +02:00
parent 3e62f6aabe
commit a0fe38c9b3
2 changed files with 6 additions and 6 deletions

View file

@ -438,9 +438,6 @@ public:
virtual QVector<VirtualDesktop *> desktops() const {
return m_desktops;
}
void removeDesktop(VirtualDesktop *desktop) {
m_desktops.removeAll(desktop);
}
QVector<uint> x11DesktopIds() const;
void setMinimized(bool set);

View file

@ -227,9 +227,12 @@ void Workspace::init()
if (kwinApp()->operationMode() == Application::OperationModeWaylandOnly ||
kwinApp()->operationMode() == Application::OperationModeXwayland) {
for (auto it = m_allClients.constBegin(); it != m_allClients.constEnd(); ++it) {
const bool needsMove = (*it)->desktops().count() == 1;
(*it)->removeDesktop(desktop);
if (needsMove) {
if (!(*it)->desktops().contains(desktop)) {
continue;
}
if ((*it)->desktops().count() > 1) {
(*it)->leaveDesktop(desktop);
} else {
sendClientToDesktop(*it, qMin(desktop->x11DesktopNumber(), VirtualDesktopManager::self()->count()), true);
}
}