Skip to content

Fixes issue 405: keymapping issue

Mike Auty requested to merge ikelos/mutter:issue405 into main

Issue 405 relates to mismapped keys injected by gnome-remote-desktop. It seems to be because a keyval (keysym) may be in the keymap more than once. We currently run through each keycode, trying from lowest level to highest level and stop as soon as we find a hit, which means that if the key symbol is in a lower level of a later keycode, we mis-pick the earlier one with the higher level (hence the far less common greek_OMEGA rather than common AT symbol).

This patch swaps the order of the loops (so we loop through the levels from lowest to highest, and at each level run through the keycodes. We make sure we only go as high as the highest level for all keys (by figuring out the maximum on the first level's run through). This resolves the issues being experienced and ensures it is possible to type characters like @. It is slightly less efficient in the worst case, in that we keep figuring out the maximum for each key multiplied by the maximum number of levels (rather than 1), but in the common case is probably more efficient (because there's a whole bunch of higher levels we never have to try if we hit the right keycode first).

Merge request reports

Loading