Bug 500529 - On switching virtual desktop and back, xwayland windows lose focu
Summary: On switching virtual desktop and back, xwayland windows lose focu
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: xwayland (other bugs)
Version First Reported In: git master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-21 16:54 UTC by fanzhuyifan
Modified: 2025-02-24 13:12 UTC (History)
0 users

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


Attachments
kwin Focus settings (155.71 KB, image/png)
2025-02-21 16:54 UTC, fanzhuyifan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description fanzhuyifan 2025-02-21 16:54:53 UTC
Created attachment 178692 [details]
kwin Focus settings

SUMMARY
On switching virtual desktop and back, xwayland windows lose focus/lose stacking order

STEPS TO REPRODUCE
1. set up multiple virtual desktops on wayland
2. launch a wayland window (e.g., konsole)
3. launch a xwayland window (e.g., QT_QPA_PLATFORM=xcb okular)
4. make sure xwayland window is in front and has focus
5. use shortcut or swipe, switch to another virtual desktop
6. use shortcut or swipe, switch back

OBSERVED RESULT
The xwayland window loses its focus/stacking order. This could be verified in two ways
1. typing, and check that what is typed shows up in konsole (wayland window)
2. or pressing alt+tab and checking order of windows there

EXPECTED RESULT
The xwayland window does not lose focus/stacking order.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 6.3.80
KDE Frameworks Version: 6.12.0
Qt Version: 6.9.0
Kernel Version: 6.12.15-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 20 × 13th Gen Intel® Core™ i9-13900H
Memory: 15.2 GiB of RAM
Graphics Processor 1: Mesa Intel® Graphics
Graphics Processor 2: llvmpipe
Manufacturer: ASUSTeK COMPUTER INC.
Product Name: ROG Zephyrus G16 GU603VV_GU603VV
System Version: 1.0

ADDITIONAL INFORMATION
Focus settings attached.
I only notice this with xwayland windows, and not with wayland windows.
This causes minor annoyances when constantly switching between different virtual desktops for different tasks.
Comment 1 fanzhuyifan 2025-02-23 05:20:01 UTC
By stacking order, I meant focus chain/focus order.

I noticed that doesn't happen with some xwayland windows, like vscode. But always with okular
Comment 4 Bug Janitor Service 2025-02-23 18:30:06 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7219
Comment 5 Vlad Zahorodnii 2025-02-24 11:24:00 UTC
Git commit a20f01ef9553a93c2df6f0e23d11e46621308b06 by Vlad Zahorodnii, on behalf of Yifan Zhu.
Committed on 24/02/2025 at 11:08.
Pushed by vladz into branch 'master'.

workspace: use frameGeometry for findWindowToActivate

Previously hitTest was used. It relied on inputRegion, and was
unreliable because inputRegion only updates after a virtual desktop
switch is complete.

M  +1    -1    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/a20f01ef9553a93c2df6f0e23d11e46621308b06
Comment 6 Vlad Zahorodnii 2025-02-24 13:12:28 UTC
Git commit dd6983c1382126e96839000f48c381eca1f2af17 by Vlad Zahorodnii.
Committed on 24/02/2025 at 12:43.
Pushed by vladz into branch 'Plasma/6.3'.

workspace: use frameGeometry for findWindowToActivate

Previously hitTest was used. It relied on inputRegion, and was
unreliable because inputRegion only updates after a virtual desktop
switch is complete.


(cherry picked from commit a20f01ef9553a93c2df6f0e23d11e46621308b06)

Co-authored-by: Yifan Zhu <fanzhuyifan@gmail.com>

M  +1    -1    src/workspace.cpp

https://invent.kde.org/plasma/kwin/-/commit/dd6983c1382126e96839000f48c381eca1f2af17