aboutsummaryrefslogtreecommitdiff
path: root/src/locale.c
diff options
context:
space:
mode:
authorkoekeishiya <aasvi93@hotmail.com>2019-02-23 14:49:56 +0100
committerkoekeishiya <aasvi93@hotmail.com>2019-02-23 14:49:56 +0100
commit0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e (patch)
tree6d46a0835b6614548ac9292067e8b3b4590e134f /src/locale.c
parenteeab7a37a2e017ea36d2385fd6b03b9572f181aa (diff)
downloadskhd-0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e.tar.gz
skhd-0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e.zip
#59 reload config when input source changes
Diffstat (limited to 'src/locale.c')
-rw-r--r--src/locale.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/locale.c b/src/locale.c
index b4c61dc..3c03f6a 100644
--- a/src/locale.c
+++ b/src/locale.c
@@ -83,6 +83,13 @@ cfstring_from_keycode(UCKeyboardLayout *keyboard_layout, CGKeyCode keycode)
return NULL;
}
+uint32_t keycode_from_char(char key)
+{
+ char lookup_key[] = { key, '\0' };
+ uint32_t keycode = (uint32_t) table_find(&keymap_table, &lookup_key);
+ return keycode;
+}
+
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast"
bool initialize_keycode_map(void)
@@ -94,6 +101,7 @@ bool initialize_keycode_map(void)
UCKeyboardLayout *keyboard_layout = (UCKeyboardLayout *) CFDataGetBytePtr(uchr);
if (!keyboard_layout) return false;
+ table_free(&keymap_table);
table_init(&keymap_table,
131,
(table_hash_func) hash_keymap,
@@ -113,10 +121,3 @@ bool initialize_keycode_map(void)
return true;
}
#pragma clang diagnostic pop
-
-uint32_t keycode_from_char(char key)
-{
- char lookup_key[] = { key, '\0' };
- uint32_t keycode = (uint32_t) table_find(&keymap_table, &lookup_key);
- return keycode;
-}