summaryrefslogtreecommitdiff
path: root/src/bindings.c
diff options
context:
space:
mode:
authorGiulio Camuffo <giuliocamuffo@gmail.com>2014-11-11 11:23:40 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2014-11-11 15:07:12 +0200
commit5c11fc6fb7d9b1bccd50fc982c0798c9e09a2a04 (patch)
treee7516ae03af35c38bbbb792aeb451f9d3af7c6c0 /src/bindings.c
parent86b70e16ebbaa6f1c0ec1a4bd6e88a51710d60f0 (diff)
downloadweston-5c11fc6fb7d9b1bccd50fc982c0798c9e09a2a04.tar.gz
input: don't send to clients key events eaten by bindings
weston key bindings are supposed to eat the key events, and not pass it on to clients, and indeed the wl_keyboard.key event is not sent. But we must also not put the key in the keys array to pass to client with the wl_keyboard.enter event, or else we may send the 'eaten' one too. In the case of a key binding hiding a surface having the keyboard focus, the shell may decide to give the focus to another surface, but that will happen before the key is released, so the new focus surface will receive the code of the bound key in the wl_keyboard.enter array. Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'src/bindings.c')
-rw-r--r--src/bindings.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/bindings.c b/src/bindings.c
index 5e247251..369c81a3 100644
--- a/src/bindings.c
+++ b/src/bindings.c
@@ -255,16 +255,17 @@ install_binding_grab(struct weston_seat *seat, uint32_t time, uint32_t key)
weston_keyboard_start_grab(seat->keyboard, &grab->grab);
}
-WL_EXPORT void
+WL_EXPORT int
weston_compositor_run_key_binding(struct weston_compositor *compositor,
struct weston_seat *seat,
uint32_t time, uint32_t key,
enum wl_keyboard_key_state state)
{
struct weston_binding *b, *tmp;
+ int eaten = 0;
if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
- return;
+ return eaten;
/* Invalidate all active modifier bindings. */
wl_list_for_each(b, &compositor->modifier_binding_list, link)
@@ -281,8 +282,10 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
if (seat->keyboard->grab ==
&seat->keyboard->default_grab)
install_binding_grab(seat, time, key);
+ ++eaten;
}
}
+ return eaten;
}
WL_EXPORT void