From 1fbd99b572d9c1c26bf074a934578bc5d86f1c0a Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Tue, 17 Aug 2021 15:56:52 +0300 Subject: [PATCH] Simplify Workspace::sendClientToDesktop() This allows changing the type of desk to QVector. Based on the dont_activate flag, Workspace::sendClientToDesktop() will try to focus the window if it's moved to the current virtual desktop. In order to implement that, it needs to know whether the window has been on the current desktop. c->isOnDesktop(desk) is a much sophisticated way to do that. --- src/workspace.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/workspace.cpp b/src/workspace.cpp index 6b2dea4593..a8dd2441d4 100644 --- a/src/workspace.cpp +++ b/src/workspace.cpp @@ -1261,7 +1261,7 @@ void Workspace::sendClientToDesktop(AbstractClient* c, int desk, bool dont_activ if ((desk < 1 && desk != NET::OnAllDesktops) || desk > static_cast(VirtualDesktopManager::self()->count())) return; int old_desktop = c->desktop(); - bool was_on_desktop = c->isOnDesktop(desk) || c->isOnAllDesktops(); + const bool wasOnCurrent = c->isOnCurrentDesktop(); c->setDesktop(desk); if (c->desktop() != desk) // No change or desktop forced return; @@ -1269,7 +1269,7 @@ void Workspace::sendClientToDesktop(AbstractClient* c, int desk, bool dont_activ if (c->isOnCurrentDesktop()) { if (c->wantsTabFocus() && options->focusPolicyIsReasonable() && - !was_on_desktop && // for stickyness changes + !wasOnCurrent && // for stickyness changes !dont_activate) requestFocus(c); else