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 63 64 65 66 67 68 69 70 71 72 73 74
xkb_keymap {
xkb_keycodes {
minimum = 0;
maximum = 255;
<0> = 0;
<1> = 1;
<2> = 2;
<3> = 3;
<4> = 4;
<5> = 5;
<6> = 6;
<7> = 7;
<any> = 10;
<none> = 11;
<a> = 61;
<b> = 62;
<c> = 63;
<CAPS> = 66;
<100> = 100;
alias <LOCK> = <CAPS>;
};
xkb_types "basic" {
virtual_modifiers NumLock;
type "ONE_LEVEL" {
modifiers= none;
level_name[1]= "Any";
};
type "TWO_LEVEL" {
modifiers= Shift;
map[Shift]= 2;
level_name[1]= "Base";
level_name[2]= "Shift";
};
type "ALPHABETIC" {
modifiers= Shift+Lock;
map[Shift]= 2;
map[Lock]= 2;
level_name[1]= "Base";
level_name[2]= "Caps";
};
};
xkb_compatibility {
virtual_modifiers NumLock;
interpret.useModMapMods= AnyLevel;
interpret.repeat= False;
interpret VoidSymbol+AnyOfOrNone(none) {
repeat= True;
};
};
xkb_symbols {
key <0> { [ 0 ] };
key <1> { [ 1 ] };
key <2> { [ 2 ] };
key <3> { [ NoSymbol, 3 ] };
key <4> { [ U1F54A ] };
key <5> { [ UFFFD, UFFFD ] };
key <6> { [ UFDD0, UFDEF ] };
key <7> { [ UFFFE, UFFFF ] };
key <any> { [ NoSymbol, A ] };
key <none> { [ VoidSymbol, N ] };
key <a> { [ a ] };
key <b> { [ b ] };
key <c> { [ U1F3BA ] };
key <CAPS> { [ Caps_Lock ] };
key <100> { [ C ] };
modifier_map Lock { <0>, <1>, <4>, <5>, <6>, <7>, <none>, <a>, <b>, <c>, <CAPS>, <100> };
};
};