[PATCH weston 17/19] bindings: make install_binding_grab take a keyboard instead of a seat
Jonas Ådahl
jadahl at gmail.com
Wed Jul 1 01:56:01 PDT 2015
On Wed, Jun 03, 2015 at 03:53:36PM -0500, Derek Foreman wrote:
> It doesn't need the seat pointer, and the caller should already have
> tested that the keyboard pointer is valid.
>
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
Reviewed-by: Jonas Ådahl <jadahl at gmail.com>
> ---
> src/bindings.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/src/bindings.c b/src/bindings.c
> index 31dcd63..4f2f203 100644
> --- a/src/bindings.c
> +++ b/src/bindings.c
> @@ -250,15 +250,15 @@ static const struct weston_keyboard_grab_interface binding_grab = {
> };
>
> static void
> -install_binding_grab(struct weston_seat *seat, uint32_t time, uint32_t key,
> - struct weston_surface *focus)
> +install_binding_grab(struct weston_keyboard *keyboard, uint32_t time,
> + uint32_t key, struct weston_surface *focus)
> {
> struct binding_keyboard_grab *grab;
>
> grab = malloc(sizeof *grab);
> grab->key = key;
> grab->grab.interface = &binding_grab;
> - weston_keyboard_start_grab(seat->keyboard, &grab->grab);
> + weston_keyboard_start_grab(keyboard, &grab->grab);
>
> /* Notify the surface which had the focus before this binding
> * triggered that we stole a keypress from under it, by forcing
> @@ -268,9 +268,9 @@ install_binding_grab(struct weston_seat *seat, uint32_t time, uint32_t key,
> * If the old focus surface is different than the new one it
> * means it was changed in the binding handler, so it received
> * the enter event already. */
> - if (focus && seat->keyboard->focus == focus) {
> - weston_keyboard_set_focus(seat->keyboard, NULL);
> - weston_keyboard_set_focus(seat->keyboard, focus);
> + if (focus && keyboard->focus == focus) {
> + weston_keyboard_set_focus(keyboard, NULL);
> + weston_keyboard_set_focus(keyboard, focus);
> }
> }
>
> @@ -301,7 +301,10 @@ weston_compositor_run_key_binding(struct weston_compositor *compositor,
> * swallow the key press. */
> if (seat->keyboard->grab ==
> &seat->keyboard->default_grab)
> - install_binding_grab(seat, time, key, focus);
> + install_binding_grab(seat->keyboard,
> + time,
> + key,
> + focus);
> }
> }
> }
> --
> 2.1.4
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list