summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorTibor Nagy <xnagytibor@gmail.com>2019-12-31 13:39:27 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-31 19:31:42 +0100
commitc431979aefc7b1ce8e759c50dd87777ddf7faa46 (patch)
treec7403ae6af6e5f4bb955cc5d1e1472a84e4044a2 /Userland
parent624116a8b1c69f52f61b82a441e8450bf5ec12ad (diff)
downloadserenity-c431979aefc7b1ce8e759c50dd87777ddf7faa46.zip
Keymap: Add AltGr support
Diffstat (limited to 'Userland')
-rw-r--r--Userland/keymap.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Userland/keymap.cpp b/Userland/keymap.cpp
index edbc999116..750ee310d1 100644
--- a/Userland/keymap.cpp
+++ b/Userland/keymap.cpp
@@ -13,9 +13,12 @@
char* read_map(const JsonObject& json, const String& name)
{
- char* map = new char[80];
+ if (!json.has(name))
+ return nullptr;
+ char* map = new char[80];
auto map_arr = json.get(name).as_array();
+
for (int i = 0; i < map_arr.size(); i++) {
auto key_value = map_arr.at(i).as_string();
char character = 0;
@@ -74,8 +77,15 @@ int read_map_from_file(String& filename)
char* map = read_map(json, "map");
char* shift_map = read_map(json, "shift_map");
char* alt_map = read_map(json, "alt_map");
+ char* altgr_map = read_map(json, "altgr_map");
+
+ if (!altgr_map) {
+ // AltGr map was not found, using Alt map as fallback.
+ altgr_map = alt_map;
+ }
- return syscall(SC_setkeymap, map, shift_map, alt_map);
+ Syscall::SC_setkeymap_params params { map, shift_map, alt_map, altgr_map };
+ return syscall(SC_setkeymap, &params);
}
int main(int argc, char** argv)