Bug 426684

Summary: Swapping Alt with Win not working when invoking plasma keyboard shortcuts (5.20 beta)
Product: [Frameworks and Libraries] frameworks-kglobalaccel Reporter: Schlaefer <openmail+kde>
Component: generalAssignee: Fabian Vogt <fabian>
Status: RESOLVED FIXED    
Severity: major CC: fabian, kde, kde, nate, richarddong08, rrt
Priority: NOR    
Version: 5.74.0   
Target Milestone: ---   
Platform: Archlinux   
OS: Linux   
Latest Commit: Version Fixed In: 5.91
Attachments: Alt win swap not working example with keyboard

Description Schlaefer 2020-09-18 13:01:17 UTC
STEPS TO REPRODUCE
1. Activate System Settings -> Keyboard -> Advanced -> Alt and Win behavior -> Alt is swapped with Win
2. Logout and login again
3. Invoke a keyboard shortcut e.g. Meta+E to start Dolphin using physical Alt+E

OBSERVED RESULT

Nothing happens. Dolphin isn't started. The shortcut still requires the physical Meta+E button to be pressed while the system has mapped that button to Alt+E.

EXPECTED RESULT

Dolphin should start.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS
KDE Plasma Version: 5.19.90 (i.e. Arch kde-unstable Plasma 5.20 beta)
KDE Frameworks Version: 5.74.0
Qt Version: 5.15.1
Kernel Version: 5.8.9-zen2-1-zen


ADDITIONAL INFORMATION

From what I can tell the remapping of Alt and Win is done and recognized throughout the system, except for *invoking* plasma keyboard shortcuts. I'll attach a video, where you can observe the physical buttons. In that xen says the buttons are remapped, the "System Settings"-app recognizes the correct, remapped button for registering a shortcut, but to activate you have to use the "wrong" button.

This was working in plasma 5.19 but seems to be a regression in the 5.20 beta.
Comment 1 Schlaefer 2020-09-18 13:09:02 UTC
Created attachment 131745 [details]
Alt win swap not working example with keyboard
Comment 2 David Redondo 2020-09-21 14:12:03 UTC
KGlobalaccel is somehow not getting a change notification. It works after restarting it
Comment 3 David Redondo 2020-09-21 14:25:33 UTC
I do not know why but for me somehow after a while it got Notify events but the swapped behavior was still not correct.
Comment 4 Richard 2022-01-02 08:38:47 UTC
Did you ever find a fix for this?
Comment 5 Reuben Thomas 2022-01-02 10:42:39 UTC
I never found a solution, no.
Comment 6 Bug Janitor Service 2022-01-02 23:27:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/45
Comment 7 Fabian Vogt 2022-01-02 23:28:27 UTC
(In reply to Bug Janitor Service from comment #6)
> A possibly relevant merge request was started @
> https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/45

^ should fix this (it works here), feel free to test.
Comment 8 Fabian Vogt 2022-01-05 21:20:35 UTC
Git commit 6e3d645d444073097e93520f047bb2321673119a by Fabian Vogt.
Committed on 05/01/2022 at 17:06.
Pushed by fvogt into branch 'master'.

Avoid XKeycodeToKeysym in KKeyServer::initializeMods

Xlib functions which work with keyboard mappings have a (Display) internal
cache, which needs to be refreshed on mapping changes by calling
X(kb)RefreshKeyboardMapping on change notify events.

After Qt switched to XCB, that is no longer happening, and it's also not
possible to get to the XEvent needed for triggering the refresh. Switch
over to using the XCB equivalent and just load the symbols on every invocation.

M  +3    -1    src/platforms/xcb/kkeyserver.cpp

https://invent.kde.org/frameworks/kwindowsystem/commit/6e3d645d444073097e93520f047bb2321673119a