xkbcommon / libxkbcommon

keymap handling library for toolkits and window systems
https://xkbcommon.org
Other
286 stars 125 forks source link

symbols: Skip interprets only for groups with explicit actions #519

Closed wismill closed 1 month ago

wismill commented 1 month ago

Previously setting explicit actions for a group in symbols files made the parser skip compatibility interpretations for the corresponding whole key, so the other groups with no explicit actions could result broken on some levels.

In the following example, <RALT> would have an action on group 2, because it is explicit, but none on group 1 because interpretation are also skipped there as a side effect:

key <RALT> {
    symbols[1]= [              ISO_Level3_Shift ],
    symbols[2]= [              ISO_Level3_Shift ],
    actions[2]= [ SetMods(modifiers=LevelThree) ]
};

Fixed by skipping interpretations only for groups with explicit actions.

We still set key->explicit |= EXPLICIT_INTERP if at least one group has explicit actions. In such case, when dumping a keymap, we will write explicit actions for all groups, in order to ensure that X11 and previous versions of libxkbcommon can parse the keymap as intended. One side effect is that no interpretation will be run on this key anymore, so we may have to set some extra fields explicitly: repeat, virtualMods. Thus the previous example would be bumped as:

key <RALT> {
    repeat= No,
    symbols[1]= [              ISO_Level3_Shift ],
    actions[1]= [ SetMods(modifiers=LevelThree,clearLocks) ],
    symbols[2]= [              ISO_Level3_Shift ],
    actions[2]= [ SetMods(modifiers=LevelThree) ]
};

Fixes #511