File Properly-restore-current-desktop-from-session.patch of Package kwin5

From a9e469bf13f6d99c24eb2ae24c3a0f4ec0a79d61 Mon Sep 17 00:00:00 2001
From: Vlad Zagorodniy <vladzzag@gmail.com>
Date: Mon, 4 Mar 2019 16:09:55 +0200
Subject: Properly restore current desktop from session

Summary:
VirtualDesktopManager is initialized in two places: Workspace::init and
Workspace::initWithX11. The former method loads virtual desktops from
the config file and the latter method synchronizes VirtualDesktopManager
with RootInfo.

Both methods do

    if (!VirtualDesktopManager::self()->setCurrent(m_initialDesktop))
        VirtualDesktopManager::self()->setCurrent(1);

which makes sense in Workspace::init, but not in Workspace::initWithX11.

When Workspace::initWithX11 is called, the current virtual desktop is
the same as m_initialDesktop. So that piece of code basically makes
the first virtual desktop current no matter what.

BUG: 390295
FIXED-IN: 5.15.3

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D19520
---
 workspace.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/workspace.cpp b/workspace.cpp
index a3967e5..0615eee 100644
--- a/workspace.cpp
+++ b/workspace.cpp
@@ -428,10 +428,10 @@ void Workspace::initWithX11()
     // TODO: only in X11 mode
     // Extra NETRootInfo instance in Client mode is needed to get the values of the properties
     NETRootInfo client_info(connection(), NET::ActiveWindow | NET::CurrentDesktop);
-    if (!qApp->isSessionRestored())
+    if (!qApp->isSessionRestored()) {
         m_initialDesktop = client_info.currentDesktop();
-    if (!VirtualDesktopManager::self()->setCurrent(m_initialDesktop))
-        VirtualDesktopManager::self()->setCurrent(1);
+        vds->setCurrent(m_initialDesktop);
+    }
 
     // TODO: better value
     rootInfo->setActiveWindow(None);
-- 
cgit v1.1
openSUSE Build Service is sponsored by