Properly restore current desktop from session
ClosedPublic

Authored by zzag on Mar 4 2019, 5:29 PM.

Details

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

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
zzag created this revision.Mar 4 2019, 5:29 PM
Restricted Application added a project: KWin. · View Herald TranscriptMar 4 2019, 5:29 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
zzag requested review of this revision.Mar 4 2019, 5:29 PM
zzag added inline comments.Mar 4 2019, 5:35 PM
workspace.cpp
426

BTW, is this correct?

davidedmundson accepted this revision.Mar 7 2019, 8:07 PM
This revision is now accepted and ready to land.Mar 7 2019, 8:07 PM
davidedmundson added inline comments.Mar 7 2019, 8:13 PM
workspace.cpp
426

It certainly seems weird, we're writing out a value only to immediately read it back..all before correctly setting the initial state.

This revision was automatically updated to reflect the committed changes.
wbauer added a subscriber: wbauer.Mar 13 2019, 9:13 AM

Wouldn't it make sense to backport this to 5.12 as well?
The mentioned bug was originally reported against 5.12.0, apparently it was a regression compared to 5.11.

I quickly tested it on 5.12, and it seems to work fine.

zzag added a comment.Mar 13 2019, 9:49 AM

backported to 5.12