From d32ed28df4c2601dcded898cd66cfee120cffb74 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 3 Feb 2021 23:15:13 +0100 Subject: LibC+LibKeyboard: Move getkeymap()+setkeymap() syscall wrappers to LibC --- Userland/Libraries/LibKeyboard/CharacterMap.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'Userland/Libraries/LibKeyboard') diff --git a/Userland/Libraries/LibKeyboard/CharacterMap.cpp b/Userland/Libraries/LibKeyboard/CharacterMap.cpp index 059c6da20f..011a935ffc 100644 --- a/Userland/Libraries/LibKeyboard/CharacterMap.cpp +++ b/Userland/Libraries/LibKeyboard/CharacterMap.cpp @@ -29,6 +29,10 @@ #include #include +#ifndef KERNEL +# include +#endif + namespace Keyboard { #ifndef KERNEL @@ -54,8 +58,7 @@ CharacterMap::CharacterMap(const String& map_name, const CharacterMapData& map_d int CharacterMap::set_system_map() { - Syscall::SC_setkeymap_params params { m_character_map_data.map, m_character_map_data.shift_map, m_character_map_data.alt_map, m_character_map_data.altgr_map, m_character_map_data.shift_altgr_map, { m_character_map_name.characters(), m_character_map_name.length() } }; - return syscall(SC_setkeymap, ¶ms); + return setkeymap(m_character_map_name.characters(), m_character_map_data.map, m_character_map_data.shift_map, m_character_map_data.alt_map, m_character_map_data.altgr_map, m_character_map_data.shift_altgr_map); } Result CharacterMap::fetch_system_map() @@ -63,16 +66,8 @@ Result CharacterMap::fetch_system_map() CharacterMapData map_data; char keymap_name[50 + 1] = { 0 }; - Syscall::SC_getkeymap_params params { - map_data.map, map_data.shift_map, - map_data.alt_map, - map_data.altgr_map, - map_data.shift_altgr_map, - { keymap_name, sizeof(keymap_name) } - }; - int rc = syscall(SC_getkeymap, ¶ms); - if (rc < 0) { - return OSError(-rc); + if (getkeymap(keymap_name, sizeof(keymap_name), map_data.map, map_data.shift_map, map_data.alt_map, map_data.altgr_map, map_data.shift_altgr_map) < 0) { + return OSError(errno); } return CharacterMap { keymap_name, map_data }; -- cgit v1.2.3