1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 23:15:08 +00:00

CharacterMap: Added a new Shift+AltGr map.

If this map isn't found in a keymap the Alt+Gr map gets used.
This commit is contained in:
Davide Carella 2021-01-05 09:45:17 +01:00 committed by Andreas Kling
parent ca9e0a70f5
commit f146ff87f1
3 changed files with 24 additions and 4 deletions

View file

@ -59,6 +59,7 @@ Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_n
Vector<u32> shift_map = read_map(json, "shift_map");
Vector<u32> alt_map = read_map(json, "alt_map");
Vector<u32> altgr_map = read_map(json, "altgr_map");
Vector<u32> shift_altgr_map = read_map(json, "shift_altgr_map");
CharacterMapData character_map;
for (int i = 0; i < CHAR_MAP_SIZE; i++) {
@ -71,6 +72,12 @@ Optional<CharacterMapData> CharacterMapFile::load_from_file(const String& file_n
} else {
character_map.altgr_map[i] = altgr_map.at(i);
}
if (shift_altgr_map.is_empty()) {
// Shift+AltGr map was not found, using Alt map as fallback.
character_map.shift_altgr_map[i] = alt_map.at(i);
} else {
character_map.shift_altgr_map[i] = shift_altgr_map.at(i);
}
}
return character_map;