diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-11-27 14:20:31 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-11-27 14:20:31 -0500 |
commit | 6aae61483be0cb86170b4bbe44909a0f17dca7c4 (patch) | |
tree | 79641f2b4d1a4cdb516aac3a6c507443c8a9d930 /clients | |
parent | 3a3704db204e9046b94f2f1e6e9fa871cd65b930 (diff) | |
download | weston-6aae61483be0cb86170b4bbe44909a0f17dca7c4.tar.gz |
weston-simple-im: Fold keyboard_input_handle_key() into event handler
Diffstat (limited to 'clients')
-rw-r--r-- | clients/weston-simple-im.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/clients/weston-simple-im.c b/clients/weston-simple-im.c index 8fc4b901..ebe3fee5 100644 --- a/clients/weston-simple-im.c +++ b/clients/weston-simple-im.c @@ -151,32 +151,6 @@ keyboard_input_handle_keymap(struct keyboard_input *keyboard_input, } static void -keyboard_input_handle_key(struct keyboard_input *keyboard_input, - uint32_t serial, uint32_t time, - uint32_t key, uint32_t state_w) -{ - uint32_t code; - uint32_t num_syms; - const xkb_keysym_t *syms; - xkb_keysym_t sym; - enum wl_keyboard_key_state state = state_w; - - if (!keyboard_input->state) - return; - - code = key + 8; - num_syms = xkb_key_get_syms(keyboard_input->state, code, &syms); - - sym = XKB_KEY_NoSymbol; - if (num_syms == 1) - sym = syms[0]; - - if (keyboard_input->key_handler) - (*keyboard_input->key_handler)(keyboard_input, serial, time, key, sym, - state, keyboard_input->user_data); -} - -static void keyboard_input_set_user_data(struct keyboard_input *keyboard_input, void *data) { keyboard_input->user_data = data; @@ -236,9 +210,26 @@ input_method_keyboard_key(void *data, uint32_t state_w) { struct simple_im *keyboard = data; + struct keyboard_input *keyboard_input = keyboard->keyboard_input; + uint32_t code; + uint32_t num_syms; + const xkb_keysym_t *syms; + xkb_keysym_t sym; + enum wl_keyboard_key_state state = state_w; + + if (!keyboard_input->state) + return; - keyboard_input_handle_key(keyboard->keyboard_input, serial, - time, key, state_w); + code = key + 8; + num_syms = xkb_key_get_syms(keyboard_input->state, code, &syms); + + sym = XKB_KEY_NoSymbol; + if (num_syms == 1) + sym = syms[0]; + + if (keyboard_input->key_handler) + (*keyboard_input->key_handler)(keyboard_input, serial, time, key, sym, + state, keyboard_input->user_data); } static void |