Branch
Hash :
181bc9ec
Author :
Date :
2025-09-24T20:10:00
xkbcomp: Fix numeric keysym parsing Keysyms written as single decimal digits are interpreted in the range `XKB_KEY_0`..`XKB_KEY_9`, consistent with the general interpretation `<name>` -> `XKB_KEY_<name>`, e.g.: - `1` → `XKB_KEY_1` - `a` → `XKB_KEY_a` However, before this commit integers in the range 0..9 in *any format* were treated as digit keysyms, which is wrong if the number is written with 2+ characters. E.g. the following were wrongly treated as the keysym digit `XKB_KEY_1`: `01`, `0x1`. Fixed by introducing a new token type to handle this corner case. This is a preparatory work to enable serializing keysyms as numbers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
xkb_keymap {
xkb_keycodes {
minimum = 8;
maximum = 255;
<0> = 10;
<1> = 11;
<2> = 12;
<a> = 20;
<b> = 21;
<c> = 22;
};
xkb_types {
type "FOUR_LEVEL" {
modifiers= Shift+Control;
map[Shift]= 2;
map[Control]= 3;
};
};
xkb_compatibility {
interpret.useModMapMods= AnyLevel;
interpret.repeat= False;
interpret 0+AnyOfOrNone(all) {
action= LockGroup(group=2);
};
interpret 1+AnyOfOrNone(all) {
action= LockGroup(group=-1);
};
interpret 0x00000001+AnyOfOrNone(all) {
action= LockGroup(group=1);
};
interpret 2+AnyOfOrNone(all) {
action= LockGroup(group=-2);
};
interpret 0x00000002+AnyOfOrNone(all) {
action= LockGroup(group=2);
};
interpret 3+AnyOfOrNone(all) {
action= LockGroup(group=-3);
};
interpret 0x00000003+AnyOfOrNone(all) {
action= LockGroup(group=3);
};
interpret Any+AnyOfOrNone(all) {
action= LockGroup(group=4);
};
};
xkb_symbols {
key <0> { [ 0, NoSymbol, NoSymbol ] };
key <1> { [ 1, 0x00000001, 0x00000001 ] };
key <2> { [ 2, 0x00000002, 0x00000002 ] };
key <a> { [ 3, NoSymbol, NoSymbol ] };
key <b> { [ 0x00000004, NoSymbol, NoSymbol ] };
key <c> { [ 0x00000005, NoSymbol, NoSymbol ] };
modifier_map Shift { <0>, <a> };
modifier_map Lock { <b> };
modifier_map Control { <c> };
};
};