Bug 429545 - Alt-TAB between two windows sometimes focuses another window
Summary: Alt-TAB between two windows sometimes focuses another window
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 5.20.3
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-23 12:09 UTC by Sander van Grieken
Modified: 2021-12-09 08:28 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 Sander van Grieken 2020-11-23 12:09:35 UTC
SUMMARY

Alt-tabbing between two windows sometimes moves focus to a third window, making the alt-tab non-deterministic, impairing workflow.

STEPS TO REPRODUCE

Not exactly sure how to reproduce, it seems probabilistic, it sometimes takes 15-20 times to alt-tab to trigger the bug.

1. have three windows open
2. press alt-tab 15-20 times to switch between two windows, releasing alt key after  each window switch
3. observe you start switching to the third window after a number of times.

OBSERVED RESULT

alt-tabbing between two windows sometimes starts switching to a third window

EXPECTED RESULT

alt-tabbing between two windows always switches between the two latest windows that had focus

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.20.3
KDE Frameworks Version: 5.76.0
Qt Version: 5.15.1

ADDITIONAL INFORMATION

Reported against versions as specified above, but this bug is happening for at least half a year already. Using KWin on Xorg.
Comment 1 Nate Graham 2020-11-23 18:35:16 UTC
That's weird, never experienced this.
Comment 2 Sander van Grieken 2020-11-24 13:30:51 UTC
I see it more often when activating a window (one that is not the two most toplevel windows) from the taskbar
Comment 3 kde.org 2021-11-06 13:52:40 UTC
I tried for two minutes, pressing ALT-TAB, the releasing ALT. Must have been more than a hundred times. Always switches between the two last recently displayed applications. Maybe the TAB key on your keyboard doesn't work properly and sometimes generates multiple key events for one press? Can you reproduce this issue in KDE 5.23 with a different keyboard?
Comment 4 Sander van Grieken 2021-11-08 11:08:41 UTC
I will try a different keyboard once I can find my old one in the basement.

In the meantime, doing a quick test again with 5.23.3 hits this issue almost immediately..
This is my setup:
- Wayland session
- Standard US keyboard layout
- Two monitors
- Couple of Firefox windows and KDEPIM using XWayland
- Some native wayland windows like Konsole, Dolphin
- maybe relevant Task Switcher settings: sort order = recently used. filter windows = current desktop, current activity. visuallization = breeze, show selected window enabled
Comment 5 kde.org 2021-11-08 11:25:46 UTC
Thank you for your feedback. My setup is very similar to yours, except that I only have one monitor und use Breeze Dark.
I just thought of one other thing. What is you window activation policy (configured in window behavior)? Are you running any app that might want to (temporarily) steal the focus and hence change the recently used order? Is it always the same app, that gets mistakenly picked? I'm just trying to narrow it down as much as possible. Maybe you can just start three native Wayland apps and try, if you can still reproduce it. That would mean it's happening independent of Xwayland.
Does the same issue happen if you use a different visualization, e.g. Breeze Dark, which I am using? Can you reproduce it on an X11 session as well? Looking forward to hear what a test with the keyboard in the basement shows.
Comment 6 kde.org 2021-11-08 11:30:05 UTC
Uh, one more thing ;-) Can you reproduce the issue with a newly created user without changing any settings for that user?
Are you running any desktop effects?
Comment 7 Sander van Grieken 2021-11-08 11:40:26 UTC
Adding a bit more info before testing your suggestions:
- Window activation policy: Click to focus
- Focus stealing prevention: None
- Click raises active window: enabled (other checkboxes in Focus tab disabled)
- Desktop effects: Slide back, Fade, Squash, Translucency (and a few others, but unlikely related to focus)

One interesting thing I noticed, I used 'xev' to test if my Tab key was creating extra events. It didn't, but after using 'xev' it seems alt-Tab is working as it should. So maybe some undefined state on the XWayland side of things gets initialized?
Comment 8 Bug Janitor Service 2021-11-23 04:38:29 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 9 Bug Janitor Service 2021-12-08 04:35:49 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 10 Sander van Grieken 2021-12-09 07:58:16 UTC
Different keyboard tested (hotplugged next to existing keyboard): issue still present
Comment 11 Sander van Grieken 2021-12-09 08:28:10 UTC
Interesting.. It seems the problem is triggered when I have one specific firefox tab opened (containing a webapp, not static content).
If another tab is active on that firefox window (with the webapp tab still running in the non-active tab), the problem disappears.
The problem still appears, if the offending tab is active and if the window is not focussed between alt-tabs between two other windows.