[PATCH weston v2] input: make sure the devices get the resource destruction signal

Jason Ekstrand jason at jlekstrand.net
Fri Dec 6 07:21:00 PST 2013


Yeah, this is a good idea.
--Jason Ekstrand

Reviewed-By: Jason Ekstrand <jason at jlekstrand.net>
 On Dec 6, 2013 5:48 AM, "Giulio Camuffo" <giuliocamuffo at gmail.com> wrote:

> The device may not have a resource for the client yet, but install
> the listeners nevertheless.
> Fixes https://bugs.freedesktop.org/show_bug.cgi?id=65726
> ---
>
> v2: add a check on the surface's resource
>
>  src/input.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/src/input.c b/src/input.c
> index e2910ea..f4944b6 100644
> --- a/src/input.c
> +++ b/src/input.c
> @@ -620,8 +620,6 @@ weston_pointer_set_focus(struct weston_pointer
> *pointer,
>
> pointer->focus->surface->resource);
>                 }
>
> -               wl_list_remove(&pointer->focus_resource_listener.link);
> -               wl_list_init(&pointer->focus_resource_listener.link);
>                 move_resources(&pointer->resource_list,
> focus_resource_list);
>         }
>
> @@ -650,18 +648,20 @@ weston_pointer_set_focus(struct weston_pointer
> *pointer,
>                 }
>
>                 pointer->focus_serial = serial;
> +       }
> +
> +       wl_list_remove(&pointer->focus_view_listener.link);
> +       wl_list_init(&pointer->focus_view_listener.link);
> +       wl_list_remove(&pointer->focus_resource_listener.link);
> +       wl_list_init(&pointer->focus_resource_listener.link);
> +       if (view)
> +               wl_signal_add(&view->destroy_signal,
> &pointer->focus_view_listener);
> +       if (view && view->surface->resource)
>                 wl_resource_add_destroy_listener(view->surface->resource,
>
>  &pointer->focus_resource_listener);
> -       }
>
> -       if (!wl_list_empty(&pointer->focus_view_listener.link)) {
> -               wl_list_remove(&pointer->focus_view_listener.link);
> -               wl_list_init(&pointer->focus_view_listener.link);
> -       }
>         pointer->focus = view;
>         pointer->focus_view_listener.notify = pointer_focus_view_destroyed;
> -       if (view)
> -               wl_signal_add(&view->destroy_signal,
> &pointer->focus_view_listener);
>         wl_signal_emit(&pointer->focus_signal, pointer);
>  }
>
> @@ -698,8 +698,6 @@ weston_keyboard_set_focus(struct weston_keyboard
> *keyboard,
>                         wl_keyboard_send_leave(resource, serial,
>                                         keyboard->focus->resource);
>                 }
> -               wl_list_remove(&keyboard->focus_resource_listener.link);
> -               wl_list_init(&keyboard->focus_resource_listener.link);
>                 move_resources(&keyboard->resource_list,
> focus_resource_list);
>         }
>
> @@ -718,9 +716,13 @@ weston_keyboard_set_focus(struct weston_keyboard
> *keyboard,
>                                             surface,
>                                             serial);
>                 keyboard->focus_serial = serial;
> +       }
> +
> +       wl_list_remove(&keyboard->focus_resource_listener.link);
> +       wl_list_init(&keyboard->focus_resource_listener.link);
> +       if (surface && surface->resource)
>                 wl_resource_add_destroy_listener(surface->resource,
>
>  &keyboard->focus_resource_listener);
> -       }
>
>         keyboard->focus = surface;
>         wl_signal_emit(&keyboard->focus_signal, keyboard);
> --
> 1.8.4.2
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20131206/6c3e151a/attachment-0001.html>


More information about the wayland-devel mailing list