Bug 493571 - [wayland] kwin does not remember the active window per-virtual desktop with multiple screens
Summary: [wayland] kwin does not remember the active window per-virtual desktop with m...
Status: RESOLVED INTENTIONAL
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-09-24 08:55 UTC by Oded Arbel
Modified: 2024-11-24 21:35 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Oded Arbel 2024-09-24 08:55:10 UTC
Running Neon noble unstable (Plasma 6.2 beta) on Wayland, kwin package 4:6.1.5+p24.04+vunstable+git20240918.2233-0, though `kwin --version` shows 6.1.90

SUMMARY
When switching between virtual desktops, when each desktop has windows on multiple screens, in the destination VD - kwin activates the window in the same screen as the last active window in the origin VD, even if that window was not active when the user last left the destination VD. This is a regression from 6.1

STEPS TO REPRODUCE
1. Have a setup with two screens and at least two virtual desktops (my setup has one horizontal and one vertical screen, and I have no verified that this issue reproduces with two horizontal screens). 
2. Open two different applications on the first VD, one on each screen - we'll call then A and B, open an additional two different applications on the first VD, one on each screen - we'll call them C and D.
3. Switch to VD 1 and activate application A.
4. Switch to VD 2 and activate application D.
5. Switch back to VD 1

OBSERVED RESULT
Application B is active.

EXPECTED RESULT
Application A should be active.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.1.90
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Kernel Version: 6.8.0-45-generic (64-bit)
Graphics Platform: Wayland
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 31.0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics

ADDITIONAL INFORMATION
When just switching back and forth between desktops without changing the active window in either desktop, the last remembered active window stays correct, even if it is on different screens on different VDs. It is just that when switching windows in the new VD, kwin "forgets" the that the other VDs had active windows in the screens that aren't active.
Comment 1 Vlad Zahorodnii 2024-09-24 09:30:01 UTC
If you uncheck "separate screen focus" in Window Behavior settings, is there any difference?
Comment 2 Oded Arbel 2024-09-24 10:33:59 UTC
(In reply to Vlad Zahorodnii from comment #1)
> If you uncheck "separate screen focus" in Window Behavior settings, is there
> any difference?

That seems to be the issue. I remember playing with that a while ago, but I'm pretty sure I left it disabled.

I've noticed that "separate screen focus" is now the default behavior (i.e. it turns on when I press the "Defaults" button) - which I'm pretty sure it wasn't before.
Comment 3 David Edmundson 2024-09-24 11:22:45 UTC
There was a deliberate defaults change: d0c4aeeb08f3530c71bfe207e9c82699ca74d4e0
That MR does say:

    When the user closes the active window, with separate screen focus disabled, a
    window on the other screen might get activated, which also switches the active
    screen to the other one. As this is quite unintuitive, and in my testing having
    separate screen focus enabled didn't have any other unintuitive side effects,
    this commit enables separate screen focus by default

Which is clearly not entirely true.

Caching active output per VD is do-able, then if we restore that before we restore the appropriate window, we fix the issue listed here without changing the setting.

But potentially that breaks the workflow of users who truly want separate focus per screen. Needs a bit of discussion.
Comment 4 David Edmundson 2024-09-24 12:08:32 UTC
Lets consider this intentional, you have the setting to change behaviour back. 

We'll keep an eye on future reports, if lots of others complain we'll cache active output per VD.
Comment 5 goo 2024-11-24 21:35:11 UTC
(In reply to David Edmundson from comment #4)
> Lets consider this intentional, you have the setting to change behaviour
> back. 
> 
> We'll keep an eye on future reports, if lots of others complain we'll cache
> active output per VD.

Personally I do use separate screen focus and would love to see per VD cached active output. In my mind I'd expect that each virtual desktop/activity has its own per screen active output. I didn't find any reason to not have it, yet.