diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2018-02-22 08:05:09 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2018-02-22 10:35:14 +0100 |
commit | fe5fca9a03ee965e039b8f5c0475032c9f950185 (patch) | |
tree | 2a7a0dd883c096735821ed5f7b8e7a338007cc7e /ui/keymaps.c | |
parent | 41126214200bc6a0e4afe28f3a9d7888f5228d08 (diff) |
keymap: make struct kbd_layout_t private to ui/keymaps.c
Also use kbd_layout_t pointers instead of void pointers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20180222070513.8740-2-kraxel@redhat.com
Diffstat (limited to 'ui/keymaps.c')
-rw-r--r-- | ui/keymaps.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/ui/keymaps.c b/ui/keymaps.c index f9762d1497..134958a197 100644 --- a/ui/keymaps.c +++ b/ui/keymaps.c @@ -28,6 +28,26 @@ #include "trace.h" #include "qemu/error-report.h" +#define MAX_NORMAL_KEYCODE 512 +#define MAX_EXTRA_COUNT 256 + +struct key_range { + int start; + int end; + struct key_range *next; +}; + +struct kbd_layout_t { + uint16_t keysym2keycode[MAX_NORMAL_KEYCODE]; + struct { + int keysym; + uint16_t keycode; + } keysym2keycode_extra[MAX_EXTRA_COUNT]; + int extra_count; + struct key_range *keypad_range; + struct key_range *numlock_range; +}; + static int get_keysym(const name2keysym_t *table, const char *name) { @@ -186,15 +206,15 @@ static kbd_layout_t *parse_keyboard_layout(const name2keysym_t *table, } -void *init_keyboard_layout(const name2keysym_t *table, const char *language) +kbd_layout_t *init_keyboard_layout(const name2keysym_t *table, + const char *language) { return parse_keyboard_layout(table, language, NULL); } -int keysym2scancode(void *kbd_layout, int keysym) +int keysym2scancode(kbd_layout_t *k, int keysym) { - kbd_layout_t *k = kbd_layout; if (keysym < MAX_NORMAL_KEYCODE) { if (k->keysym2keycode[keysym] == 0) { trace_keymap_unmapped(keysym); @@ -217,9 +237,8 @@ int keysym2scancode(void *kbd_layout, int keysym) return 0; } -int keycode_is_keypad(void *kbd_layout, int keycode) +int keycode_is_keypad(kbd_layout_t *k, int keycode) { - kbd_layout_t *k = kbd_layout; struct key_range *kr; for (kr = k->keypad_range; kr; kr = kr->next) { @@ -230,9 +249,8 @@ int keycode_is_keypad(void *kbd_layout, int keycode) return 0; } -int keysym_is_numlock(void *kbd_layout, int keysym) +int keysym_is_numlock(kbd_layout_t *k, int keysym) { - kbd_layout_t *k = kbd_layout; struct key_range *kr; for (kr = k->numlock_range; kr; kr = kr->next) { |