https://bugs.kde.org/show_bug.cgi?id=318904

--- Comment #27 from h.goe...@crazy-compilers.com ---
I dug into the code and made the following observations: 

When the keymap is changed, xev reports an "MappingNotify event
MappingKeyboard". kglobelaccell has a method
KGlobalAccelImpl::x11MappingNotify() [1], which I assume is handling this
event. x11MappingNotify seams to recalculate g_keyModMaskXOnOrOff by calling
(in calculateGrabMasks) [2].

calculateGrabMasks() calls (among other) KKeyServer::modXNumLock(), which calls
initializeMods() [4] and this does a bit of magic: 
initializeMods() searches the whole kxb keymapping for XK_Num_Lock, which is
the "NumLock" symbol. Only if this symbol is found in the current keymap,
NumLock is taken as a "valid" modifier for this keymap.

My theory was that mapping any key to "NumLock" could solve the issue. When I
tried to proof this, I failed (see below).

Then I found that initializeMods() seems to be only called *once* at all.
initializeMods() sets a global flag (g_bInitializedMods) which is never reset.

So another solution could be to reset g_bInitializedMods in
KGlobalAccelImpl::x11MappingNotify(). But on the other hand: If my analyzis
above is correct, then at start up (while de(nodeadkeys) was active)
initializeMods() would have accepted NumLock as a modifier to be filtered. And
this would not have been changed then switching to de(neo). 

Could please some developer point me to a how-to quickly compile an run a
developement-version of kglobalaccel? Then I could try digging deeper into the
issue and try Thomas' fix from Comment 23.

Failed proof:

setxkbmap -layout de -variant neo
# search an unused keycode (for me 254 worked)
xmodmap -pke | grep -E '=$'
# start ev to see the notify events
xev &
# assign NumLock to this keycode, this should send an MappingNotify event
xmodmap -e "keycode 120 = Num_Lock"
# verify
xmodmap -pke | grep 254

[1]
https://github.com/KDE/kglobalaccel/blob/v5.22.0/src/runtime/plugins/xcb/kglobalaccel_x11.cpp#L216
[2] calculateGrabMasks:
https://github.com/KDE/kglobalaccel/blob/v5.22.0/src/runtime/plugins/xcb/kglobalaccel_x11.cpp#L49
[3] initializeMods:
https://github.com/KDE/kdelibs/blob/v4.14.3/kdeui/util/kkeyserver_x11.cpp#L647
[3] initializeMods:
https://github.com/KDE/kdelibs/blob/v4.14.3/kdeui/util/kkeyserver_x11.cpp#L498

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to