From 79bfde20bd782588a4747ebf15a0d17e5b1b3a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 27 Nov 2012 13:57:27 -0500 Subject: [PATCH] weston-simple-im: Use serial number from incoming events The key events we pass through to the input_method_context has to have a serial number that corresponds to the key event we got. The struct display serial is updated on pointer enter/leave and keyboard events, but not the input method keyboard events. So the display serial will never correspond to the key event we're dealing with and we have to pass through the serial we get from the key event. --- clients/weston-simple-im.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clients/weston-simple-im.c b/clients/weston-simple-im.c index 693e2bf0..0e805746 100644 --- a/clients/weston-simple-im.c +++ b/clients/weston-simple-im.c @@ -74,6 +74,7 @@ static const uint32_t ignore_keys_on_compose[] = { }; typedef void (*keyboard_input_key_handler_t)(struct keyboard_input *keyboard_input, + uint32_t serial, uint32_t time, uint32_t key, uint32_t unicode, enum wl_keyboard_key_state state, void *data); @@ -170,7 +171,7 @@ keyboard_input_handle_key(struct keyboard_input *keyboard_input, sym = syms[0]; if (keyboard_input->key_handler) - (*keyboard_input->key_handler)(keyboard_input, time, key, sym, + (*keyboard_input->key_handler)(keyboard_input, serial, time, key, sym, state, keyboard_input->user_data); } @@ -367,7 +368,7 @@ compare_compose_keys(const void *c1, const void *c2) static void simple_im_key_handler(struct keyboard_input *keyboard_input, - uint32_t time, uint32_t key, uint32_t sym, + uint32_t serial, uint32_t time, uint32_t key, uint32_t sym, enum wl_keyboard_key_state state, void *data) { struct simple_im *keyboard = data; @@ -391,7 +392,7 @@ simple_im_key_handler(struct keyboard_input *keyboard_input, for (i = 0; i < sizeof(ignore_keys_on_compose) / sizeof(ignore_keys_on_compose[0]); i++) { if (sym == ignore_keys_on_compose[i]) { - input_method_context_key(context, display_get_serial(keyboard->display), time, key, state); + input_method_context_key(context, serial, time, key, state); return; } } @@ -440,7 +441,7 @@ simple_im_key_handler(struct keyboard_input *keyboard_input, } if (xkb_keysym_to_utf8(sym, text, sizeof(text)) <= 0) { - input_method_context_key(context, display_get_serial(keyboard->display), time, key, state); + input_method_context_key(context, serial, time, key, state); return; }