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.
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
This seems to be caused by inputRegion being null for xwayland windows, causing hitTest to fail https://invent.kde.org/plasma/kwin/-/blob/96cadebc8bfb10e5b3203fe91b59098b976e3278/src/window.cpp#L385 https://invent.kde.org/plasma/kwin/-/blob/96cadebc8bfb10e5b3203fe91b59098b976e3278/src/workspace.cpp?page=2#L1057
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1796
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/7219
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
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