diff options
author | koekeishiya <aasvi93@hotmail.com> | 2019-02-23 14:49:56 +0100 |
---|---|---|
committer | koekeishiya <aasvi93@hotmail.com> | 2019-02-23 14:49:56 +0100 |
commit | 0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e (patch) | |
tree | 6d46a0835b6614548ac9292067e8b3b4590e134f /src/locale.c | |
parent | eeab7a37a2e017ea36d2385fd6b03b9572f181aa (diff) | |
download | skhd-0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e.tar.gz skhd-0e703c3f275f6d4477f452acfb9cf9c73b9d9f1e.zip |
#59 reload config when input source changes
Diffstat (limited to 'src/locale.c')
-rw-r--r-- | src/locale.c | 15 |
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; -} |