[PATCH weston] input: check if the resource is valid in seat_get_pointer

Jason Ekstrand jason at jlekstrand.net
Mon Jul 8 09:21:38 PDT 2013


On Mon, Jul 8, 2013 at 9:52 AM, Rob Bradford <robert.bradford at intel.com>wrote:

> On 8 July 2013 15:15, Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
>
> Hi Giulio,
>
> > There is not much else to say. surfaces created with
> weston_surface_create
> > have
> > a NULL resource, and if that gets picked by default_grab_focus (in
> input.c)
> > the next
> > seat_get_pointer will break.
>
> I guess my point is that I wanted you to highlight that it is the
> non-client surfaces (like the lock surface) that don't have a
> resource. Most of surfaces created by weston_surface_create are
> through the compositor_create_surface which does set the resource.
>
> > I guess another solution could be to make weston_compositor_pick_surface
> not
> > pick surfaces without a valid resource, but i'm not sure that wouldn't
> break
> > something
> > else.
>
> That might be worth exploring - these surfaces don't accept input
> right? So the pick shouldn't do anything anyway..and how did one of
> these surfaces get assigned as the pointer focus? That might be the
> thing to look at.
>

It's worth noting that anything coming form xwayland will also be created
without a resource.  I'm not sure how those play into input handling though.

--Jason Ekstrand


>
> Rob
>
> >
> > 2013/7/8 Rob Bradford <robert.bradford at intel.com>
> >>
> >> Can you provide some more explanation in your commit message about why
> >> the pointer might have a surface focussed but that surface does not
> >> have a valid resource. (I'm wondering if this is fixing the symptom of
> >> a problem elsewhere.)
> >>
> >> Rob
> >>
> >> On 7 July 2013 16:38, Giulio Camuffo <giuliocamuffo at gmail.com> wrote:
> >> > seat->pointer->focus->resource can be NULL, if the surface was
> >> > created with weston_surface_create.
> >> > ---
> >> >  src/input.c | 2 +-
> >> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> >
> >> > diff --git a/src/input.c b/src/input.c
> >> > index 644487a..a7a37e5 100644
> >> > --- a/src/input.c
> >> > +++ b/src/input.c
> >> > @@ -1181,7 +1181,7 @@ seat_get_pointer(struct wl_client *client,
> struct
> >> > wl_resource *resource,
> >> >         wl_resource_set_implementation(cr, &pointer_interface,
> >> > seat->pointer,
> >> >                                        unbind_resource);
> >> >
> >> > -       if (seat->pointer->focus &&
> >> > +       if (seat->pointer->focus && seat->pointer->focus->resource &&
> >> >             wl_resource_get_client(seat->pointer->focus->resource) ==
> >> > client) {
> >> >                 struct weston_surface *surface;
> >> >                 wl_fixed_t sx, sy;
> >> > --
> >> > 1.8.3.2
> >> >
> >> > _______________________________________________
> >> > wayland-devel mailing list
> >> > wayland-devel at lists.freedesktop.org
> >> > http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> >
> >
> _______________________________________________
> 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/20130708/7abb8a3d/attachment.html>


More information about the wayland-devel mailing list