From c4766dc3c6233d3353b79fbd226202e7b8e3fc46 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 1 Jul 2013 23:54:59 +0200 Subject: input: require VOs to send key up events, redo input key lookup Making key up events implicit was sort-of a nice idea, but it's too tricky and unreliable and makes the key lookup code (interpret_keys()) hard to reason about. See e.g. previous commit for subtle bugs and issues this caused. Make key-up events explicit instead. Add key up events to all VOs. Any time MP_KEY_STATE_DOWN is used, the matching key up event must use MP_KEY_STATE_UP. Rewrite the key lookup code. It should be simpler and more robust now. (Even though the LOC increases, because the new code is less "compact".) --- video/out/wayland_common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'video/out/wayland_common.c') diff --git a/video/out/wayland_common.c b/video/out/wayland_common.c index a627100477..f3d18efc1d 100644 --- a/video/out/wayland_common.c +++ b/video/out/wayland_common.c @@ -278,7 +278,7 @@ static void keyboard_handle_key(void *data, if (state == WL_KEYBOARD_KEY_STATE_PRESSED) mplayer_put_key(wl->vo->key_fifo, mpkey | MP_KEY_STATE_DOWN); else - mplayer_put_key(wl->vo->key_fifo, mpkey); + mplayer_put_key(wl->vo->key_fifo, mpkey | MP_KEY_STATE_UP); } } @@ -320,7 +320,7 @@ static void pointer_handle_enter(void *data, /* Release the left button on pointer enter again * because after moving the shell surface no release event is sent */ - mplayer_put_key(wl->vo->key_fifo, MP_MOUSE_BTN0); + mplayer_put_key(wl->vo->key_fifo, MP_MOUSE_BTN0 | MP_KEY_STATE_UP); show_cursor(wl); } @@ -355,7 +355,8 @@ static void pointer_handle_button(void *data, struct vo_wayland_state *wl = data; mplayer_put_key(wl->vo->key_fifo, MP_MOUSE_BTN0 + (button - BTN_LEFT) | - ((state == WL_POINTER_BUTTON_STATE_PRESSED) ? MP_KEY_STATE_DOWN : 0)); + ((state == WL_POINTER_BUTTON_STATE_PRESSED) + ? MP_KEY_STATE_DOWN : MP_KEY_STATE_UP)); if ((button == BTN_LEFT) && (state == WL_POINTER_BUTTON_STATE_PRESSED)) wl_shell_surface_move(wl->window->shell_surface, wl->input->seat, serial); -- cgit v1.2.3