summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibKeyboard
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-03 23:15:13 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-03 23:15:13 +0100
commitd32ed28df4c2601dcded898cd66cfee120cffb74 (patch)
tree61e66c0c5c014ff75f8da2ca1c047dfb855b8da3 /Userland/Libraries/LibKeyboard
parenta59b1825ce3ba5d6e6adf51ab2745c7212789c31 (diff)
downloadserenity-d32ed28df4c2601dcded898cd66cfee120cffb74.zip
LibC+LibKeyboard: Move getkeymap()+setkeymap() syscall wrappers to LibC
Diffstat (limited to 'Userland/Libraries/LibKeyboard')
-rw-r--r--Userland/Libraries/LibKeyboard/CharacterMap.cpp19
1 files changed, 7 insertions, 12 deletions
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 <Kernel/API/Syscall.h>
#include <LibKeyboard/CharacterMapFile.h>
+#ifndef KERNEL
+# include <serenity.h>
+#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, &params);
+ 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, OSError> CharacterMap::fetch_system_map()
@@ -63,16 +66,8 @@ Result<CharacterMap, OSError> 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, &params);
- 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 };