keymap-dump: fix invalid names used for levels above 8

xkbcomp only accepts the "Level" prefix for a level name for levels 1 to
8, but the keymap dumping code added it always, e.g. "Level15".

The plain integer, e.g. "8", "15" is always accepted, so just use that.

Fixes https://github.com/xkbcommon/libxkbcommon/issues/113

Signed-off-by: Ran Benita <ran@unusedvar.com>
Reported-by: progandy
master
Ran Benita 2019-10-16 10:27:12 +03:00
parent 3a91788d92
commit a6ed0304f7
2 changed files with 206 additions and 206 deletions

View File

@ -219,7 +219,7 @@ write_types(struct xkb_keymap *keymap, struct buf *buf)
continue;
str = ModMaskText(keymap->ctx, &keymap->mods, entry->mods.mods);
write_buf(buf, "\t\tmap[%s]= Level%u;\n",
write_buf(buf, "\t\tmap[%s]= %u;\n",
str, entry->level + 1);
if (entry->preserve.mods)
@ -230,7 +230,7 @@ write_types(struct xkb_keymap *keymap, struct buf *buf)
for (xkb_level_index_t n = 0; n < type->num_level_names; n++)
if (type->level_names[n])
write_buf(buf, "\t\tlevel_name[Level%u]= \"%s\";\n", n + 1,
write_buf(buf, "\t\tlevel_name[%u]= \"%s\";\n", n + 1,
xkb_atom_text(keymap->ctx, type->level_names[n]));
write_buf(buf, "\t};\n");

View File

@ -300,292 +300,292 @@ xkb_types "complete" {
type "ONE_LEVEL" {
modifiers= none;
level_name[Level1]= "Any";
level_name[1]= "Any";
};
type "TWO_LEVEL" {
modifiers= Shift;
map[Shift]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
map[Shift]= 2;
level_name[1]= "Base";
level_name[2]= "Shift";
};
type "ALPHABETIC" {
modifiers= Shift+Lock;
map[Shift]= Level2;
map[Lock]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Caps";
map[Shift]= 2;
map[Lock]= 2;
level_name[1]= "Base";
level_name[2]= "Caps";
};
type "SHIFT+ALT" {
modifiers= Shift+Alt;
map[Shift+Alt]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Shift+Alt";
map[Shift+Alt]= 2;
level_name[1]= "Base";
level_name[2]= "Shift+Alt";
};
type "PC_CONTROL_LEVEL2" {
modifiers= Control;
map[Control]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Control";
map[Control]= 2;
level_name[1]= "Base";
level_name[2]= "Control";
};
type "PC_LCONTROL_LEVEL2" {
modifiers= LControl;
map[LControl]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "LControl";
map[LControl]= 2;
level_name[1]= "Base";
level_name[2]= "LControl";
};
type "PC_RCONTROL_LEVEL2" {
modifiers= RControl;
map[RControl]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "RControl";
map[RControl]= 2;
level_name[1]= "Base";
level_name[2]= "RControl";
};
type "PC_ALT_LEVEL2" {
modifiers= Alt;
map[Alt]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Alt";
map[Alt]= 2;
level_name[1]= "Base";
level_name[2]= "Alt";
};
type "PC_LALT_LEVEL2" {
modifiers= LAlt;
map[LAlt]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "LAlt";
map[LAlt]= 2;
level_name[1]= "Base";
level_name[2]= "LAlt";
};
type "PC_RALT_LEVEL2" {
modifiers= RAlt;
map[RAlt]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "RAlt";
map[RAlt]= 2;
level_name[1]= "Base";
level_name[2]= "RAlt";
};
type "CTRL+ALT" {
modifiers= Shift+Control+Alt+LevelThree;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Control+Alt]= Level5;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[Level5]= "Ctrl+Alt";
map[Shift]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Control+Alt]= 5;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
level_name[5]= "Ctrl+Alt";
};
type "LOCAL_EIGHT_LEVEL" {
modifiers= Shift+Lock+Control+LevelThree;
map[Shift]= Level2;
map[Lock]= Level2;
map[LevelThree]= Level3;
map[Shift+Lock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level4;
map[Control]= Level5;
map[Shift+Lock+Control]= Level5;
map[Shift+Control]= Level6;
map[Lock+Control]= Level6;
map[Control+LevelThree]= Level7;
map[Shift+Lock+Control+LevelThree]= Level7;
map[Shift+Control+LevelThree]= Level8;
map[Lock+Control+LevelThree]= Level8;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Level3";
level_name[Level4]= "Shift Level3";
level_name[Level5]= "Ctrl";
level_name[Level6]= "Shift Ctrl";
level_name[Level7]= "Level3 Ctrl";
level_name[Level8]= "Shift Level3 Ctrl";
map[Shift]= 2;
map[Lock]= 2;
map[LevelThree]= 3;
map[Shift+Lock+LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 4;
map[Control]= 5;
map[Shift+Lock+Control]= 5;
map[Shift+Control]= 6;
map[Lock+Control]= 6;
map[Control+LevelThree]= 7;
map[Shift+Lock+Control+LevelThree]= 7;
map[Shift+Control+LevelThree]= 8;
map[Lock+Control+LevelThree]= 8;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Level3";
level_name[4]= "Shift Level3";
level_name[5]= "Ctrl";
level_name[6]= "Shift Ctrl";
level_name[7]= "Level3 Ctrl";
level_name[8]= "Shift Level3 Ctrl";
};
type "THREE_LEVEL" {
modifiers= Shift+LevelThree;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Level3";
map[Shift]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 3;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Level3";
};
type "EIGHT_LEVEL" {
modifiers= Shift+LevelThree+LevelFive;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[LevelFive]= Level5;
map[Shift+LevelFive]= Level6;
map[LevelThree+LevelFive]= Level7;
map[Shift+LevelThree+LevelFive]= Level8;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[Level5]= "X";
level_name[Level6]= "X Shift";
level_name[Level7]= "X Alt Base";
level_name[Level8]= "X Shift Alt";
map[Shift]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[LevelFive]= 5;
map[Shift+LevelFive]= 6;
map[LevelThree+LevelFive]= 7;
map[Shift+LevelThree+LevelFive]= 8;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
level_name[5]= "X";
level_name[6]= "X Shift";
level_name[7]= "X Alt Base";
level_name[8]= "X Shift Alt";
};
type "EIGHT_LEVEL_ALPHABETIC" {
modifiers= Shift+Lock+LevelThree+LevelFive;
map[Shift]= Level2;
map[Lock]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level4;
map[Shift+Lock+LevelThree]= Level3;
map[LevelFive]= Level5;
map[Shift+LevelFive]= Level6;
map[Lock+LevelFive]= Level6;
map[LevelThree+LevelFive]= Level7;
map[Shift+LevelThree+LevelFive]= Level8;
map[Lock+LevelThree+LevelFive]= Level8;
map[Shift+Lock+LevelThree+LevelFive]= Level7;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[Level5]= "X";
level_name[Level6]= "X Shift";
level_name[Level7]= "X Alt Base";
level_name[Level8]= "X Shift Alt";
map[Shift]= 2;
map[Lock]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 4;
map[Shift+Lock+LevelThree]= 3;
map[LevelFive]= 5;
map[Shift+LevelFive]= 6;
map[Lock+LevelFive]= 6;
map[LevelThree+LevelFive]= 7;
map[Shift+LevelThree+LevelFive]= 8;
map[Lock+LevelThree+LevelFive]= 8;
map[Shift+Lock+LevelThree+LevelFive]= 7;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
level_name[5]= "X";
level_name[6]= "X Shift";
level_name[7]= "X Alt Base";
level_name[8]= "X Shift Alt";
};
type "EIGHT_LEVEL_SEMIALPHABETIC" {
modifiers= Shift+Lock+LevelThree+LevelFive;
map[Shift]= Level2;
map[Lock]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level3;
map[Shift]= 2;
map[Lock]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 3;
preserve[Lock+LevelThree]= Lock;
map[Shift+Lock+LevelThree]= Level4;
map[Shift+Lock+LevelThree]= 4;
preserve[Shift+Lock+LevelThree]= Lock;
map[LevelFive]= Level5;
map[Shift+LevelFive]= Level6;
map[Lock+LevelFive]= Level6;
map[LevelFive]= 5;
map[Shift+LevelFive]= 6;
map[Lock+LevelFive]= 6;
preserve[Lock+LevelFive]= Lock;
map[LevelThree+LevelFive]= Level7;
map[Shift+LevelThree+LevelFive]= Level8;
map[Lock+LevelThree+LevelFive]= Level7;
map[LevelThree+LevelFive]= 7;
map[Shift+LevelThree+LevelFive]= 8;
map[Lock+LevelThree+LevelFive]= 7;
preserve[Lock+LevelThree+LevelFive]= Lock;
map[Shift+Lock+LevelThree+LevelFive]= Level8;
map[Shift+Lock+LevelThree+LevelFive]= 8;
preserve[Shift+Lock+LevelThree+LevelFive]= Lock;
map[Shift+Lock+LevelFive]= Level1;
map[Shift+Lock+LevelFive]= 1;
preserve[Shift+Lock+LevelFive]= Lock;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[Level5]= "X";
level_name[Level6]= "X Shift";
level_name[Level7]= "X Alt Base";
level_name[Level8]= "X Shift Alt";
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
level_name[5]= "X";
level_name[6]= "X Shift";
level_name[7]= "X Alt Base";
level_name[8]= "X Shift Alt";
};
type "FOUR_LEVEL" {
modifiers= Shift+LevelThree;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
map[Shift]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
};
type "FOUR_LEVEL_ALPHABETIC" {
modifiers= Shift+Lock+LevelThree;
map[Shift]= Level2;
map[Lock]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level4;
map[Shift+Lock+LevelThree]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
map[Shift]= 2;
map[Lock]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 4;
map[Shift+Lock+LevelThree]= 3;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
};
type "FOUR_LEVEL_SEMIALPHABETIC" {
modifiers= Shift+Lock+LevelThree;
map[Shift]= Level2;
map[Lock]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level3;
map[Shift]= 2;
map[Lock]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 3;
preserve[Lock+LevelThree]= Lock;
map[Shift+Lock+LevelThree]= Level4;
map[Shift+Lock+LevelThree]= 4;
preserve[Shift+Lock+LevelThree]= Lock;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
};
type "FOUR_LEVEL_MIXED_KEYPAD" {
modifiers= Shift+NumLock+LevelThree;
map[NumLock]= Level2;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[NumLock+LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
map[NumLock]= 2;
map[Shift]= 2;
map[LevelThree]= 3;
map[NumLock+LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Shift+NumLock+LevelThree]= 4;
level_name[1]= "Base";
level_name[2]= "Number";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
};
type "FOUR_LEVEL_X" {
modifiers= Shift+Control+Alt+LevelThree;
map[LevelThree]= Level2;
map[Shift+LevelThree]= Level3;
map[Control+Alt]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Alt Base";
level_name[Level3]= "Shift Alt";
level_name[Level4]= "Ctrl+Alt";
map[LevelThree]= 2;
map[Shift+LevelThree]= 3;
map[Control+Alt]= 4;
level_name[1]= "Base";
level_name[2]= "Alt Base";
level_name[3]= "Shift Alt";
level_name[4]= "Ctrl+Alt";
};
type "SEPARATE_CAPS_AND_SHIFT_ALPHABETIC" {
modifiers= Shift+Lock+LevelThree;
map[Shift]= Level2;
map[Lock]= Level4;
map[Shift]= 2;
map[Lock]= 4;
preserve[Lock]= Lock;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock+LevelThree]= Level3;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock+LevelThree]= 3;
preserve[Lock+LevelThree]= Lock;
map[Shift+Lock+LevelThree]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "AltGr Base";
level_name[Level4]= "Shift AltGr";
map[Shift+Lock+LevelThree]= 3;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "AltGr Base";
level_name[4]= "Shift AltGr";
};
type "FOUR_LEVEL_PLUS_LOCK" {
modifiers= Shift+Lock+LevelThree;
map[Shift]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[Lock]= Level5;
map[Shift+Lock]= Level2;
map[Lock+LevelThree]= Level3;
map[Shift+Lock+LevelThree]= Level4;
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Shift Alt";
level_name[Level5]= "Lock";
map[Shift]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[Lock]= 5;
map[Shift+Lock]= 2;
map[Lock+LevelThree]= 3;
map[Shift+Lock+LevelThree]= 4;
level_name[1]= "Base";
level_name[2]= "Shift";
level_name[3]= "Alt Base";
level_name[4]= "Shift Alt";
level_name[5]= "Lock";
};
type "KEYPAD" {
modifiers= Shift+NumLock;
map[Shift]= Level2;
map[NumLock]= Level2;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
map[Shift]= 2;
map[NumLock]= 2;
level_name[1]= "Base";
level_name[2]= "Number";
};
type "FOUR_LEVEL_KEYPAD" {
modifiers= Shift+NumLock+LevelThree;
map[Shift]= Level2;
map[NumLock]= Level2;
map[LevelThree]= Level3;
map[Shift+LevelThree]= Level4;
map[NumLock+LevelThree]= Level4;
map[Shift+NumLock+LevelThree]= Level3;
level_name[Level1]= "Base";
level_name[Level2]= "Number";
level_name[Level3]= "Alt Base";
level_name[Level4]= "Alt Number";
map[Shift]= 2;
map[NumLock]= 2;
map[LevelThree]= 3;
map[Shift+LevelThree]= 4;
map[NumLock+LevelThree]= 4;
map[Shift+NumLock+LevelThree]= 3;
level_name[1]= "Base";
level_name[2]= "Number";
level_name[3]= "Alt Base";
level_name[4]= "Alt Number";
};
};