[PATCH weston] input: send the pressed keys to the focused client when running a key binding
Bill Spitzak
spitzak at gmail.com
Fri Nov 21 13:17:21 PST 2014
On 11/21/2014 12:01 PM, Giulio Camuffo wrote:
> ---
> src/bindings.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/src/bindings.c b/src/bindings.c
> index 5e24725..0beca6d 100644
> --- a/src/bindings.c
> +++ b/src/bindings.c
> @@ -262,6 +262,7 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
> enum wl_keyboard_key_state state)
> {
> struct weston_binding *b, *tmp;
> + struct weston_surface *focus;
>
> if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
> return;
> @@ -273,8 +274,17 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
> wl_list_for_each_safe(b, tmp, &compositor->key_binding_list, link) {
> if (b->key == key && b->modifier == seat->modifier_state) {
> weston_key_binding_handler_t handler = b->handler;
> + focus = seat->keyboard->focus;
> handler(seat, time, key, b->data);
>
> + /* If the focus didn't change, and hence it didn't receive
> + * a wl_keyboard.enter event with the pressed keys,
> + * send a wl_keyboard.leave/enter pair */
> + if (focus && seat->keyboard->focus == focus) {
> + weston_keyboard_set_focus(seat->keyboard, NULL);
> + weston_keyboard_set_focus(seat->keyboard, focus);
> + }
> +
> /* If this was a key binding and it didn't
> * install a keyboard grab, install one now to
> * swallow the key release. */
I would suspect the code after the comment containing "swallow the key
release" has to be changed or removed. You don't want to swallow the key
release any more because otherwise the client won't turn it off in the
key map.
Otherwise this looks like a lot more like the correct fix. Far smaller
and simpler than all the email sent about it.
More information about the wayland-devel
mailing list