Skip to content

Port FocusChain to VirtualDesktop

Vlad Zahorodnii requested to merge work/focus-chain-virtual-desktop into master

int-based desktop ids are unreliable. They change as virtual desktops are added or removed in the middle. This means that windows do not stick to their virtual desktop if virtual desktops change.

On the other hand, VirtualDesktop objects do not suffer from this problem. They are very reliable. If a virtual desktop is added or removed, VirtualDesktop pointers will remain the same, i.e. windows won't unexpectedly jump to another desktop.


from commit no 1

This patch has one behavioral change - raiseOrLowerClient() will not work if the client is not on the current virtual desktop.

However, raiseOrLowerClient() can be called only in two cases:

  • user triggers the raise or lower shortcut for the active client. Since the active client is on the current virtual desktop, it's not an issue

  • an x11 window restacks itself. It makes no sense if an x11 window restacks itself while it's inactive or not on current virtual desktop. Also, the Opposite restack mode is rarely used, some window managers don't even bother implementing it. So, having such a constraint should not be a problem.

The main reason for not allowing raiseOrLowerClient() for windows that are not on the current virtual desktop is that a window can be on multiple virtual desktops. If a window is on A and B virtual desktops, the only logical option is to toggle stacking position if the window is on the current desktop. It's the only viable option as kwin does not maintain per virtual desktop stacking order.

Merge request reports