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

--- Comment #8 from Bernd Steinhauser <li...@bernd-steinhauser.de> ---
Created attachment 156124
  --> https://bugs.kde.org/attachment.cgi?id=156124&action=edit
Patch to only search the first two levels in a layout.

In src/plugins/buttonrebinds/buttonrebindsfilter.cpp the symbol is converted to
a keycode in line 291:
    // KKeyServer returns upper case syms, lower it to not confuse modifiers
handling
    auto keyCode = KWin::input()->keyboard()->xkb()->keycodeFromKeysym(sym);

This uses the function keycodeFromKeysym that is now in src/xkb.cpp.
This function iterates over all keysyms and levels, in that order, returning
the first match for the requested symbol.
Restricting this lookup process to level 0 and 1 fixes the issue for me, since
the doubled keys are on higher levels. I've attached that patch for reference.
btw, I had to use both level 0 and 1, because I think the comment is actually
false and there is no conversion to lower case.
i.e. if 'A' is requested (and that is what is output by KKeyServer, even if 'a'
was originally set), it will only find it if level 1 is searched as well.

Unfortunately, this might not really be a desirable solution, since this makes
symbols on upper levels unusable for shortcuts.
The problem is that with the current design of the function, this won't work
anyway, you will always only get symbols on level 0 as an output.
Thus, even if an upper level symbol is set in kcm_mouse, it'll misbehave.
For example, if you set # ('numbersign') in the standard US layout, you need to
press Shift+3. kcm_mouse will correctly assign the character # to the mouse
button and keycodeFromKeysym will correctly determine the key AE03 in this
layout.
However, the output will be '3', because the Shift to level 1 is omitted.

Therefore, my proposal would be that keycodeFromKeysym returns both keycode and
level, or, alternatively, a second search levelFromKeysymAndKeycode is
performed to determine the correct level of the requested symbol on a specific
Keycode.
Unfortunately, my c++ skills are too limited to properly implement this. :(

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

Reply via email to