[PATCH] Allow null surface arguments in wl_pointer.leave and wl_keyboard.leave

Jason Ekstrand jason at jlekstrand.net
Mon Jul 8 09:25:22 PDT 2013


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

> *bump*
>
> This is a fix for:
> https://bugs.freedesktop.org/show_bug.cgi?id=65726&list_id=320167
>
> Although it might be much better if we could emit the event
> (especially the leave) before we destroy the surface - that being said
> the destruction of the object will also result in the proxy being
> removed from the map and so when the event is received the callback
> will still have a NULL pointer.
>

That's exactly what weston *was* doing.  However, thanks to the destroyed
proxies, the clients were getting NULL anyway.  We could to go through a
bunch of trouble to keep the resource valid and call wl_pointer.leave on a
valid resource.  However, that's a lot more work than I thought it was
worth for no change client-side.

The other option here is to specify that the client does not get the leave
event if the surface is destroyed.  In either case, it needs to be
specified.
--Jason


>
> Rob
>
> On 17 June 2013 23:56, Jason Ekstrand <jason at jlekstrand.net> wrote:
> > The current specified behavior does not allow a null surface in either of
> > these events.  However, if the client calls wl_surface.destroy while the
> > surface has focus then the leave handler will get a null surface anyway
> > because the proxy corresponding to the wl_surface no longer exists.  This
> > change makes this edge-case explicit and allows the server to avoid
> sending
> > an event with an argument it knows the client has destroyed.
> >
> > Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> > ---
> >  protocol/wayland.xml | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/protocol/wayland.xml b/protocol/wayland.xml
> > index 3d4ec9b..faa284e 100644
> > --- a/protocol/wayland.xml
> > +++ b/protocol/wayland.xml
> > @@ -1313,13 +1313,14 @@
> >      <event name="leave">
> >        <description summary="leave event">
> >         Notification that this seat's pointer is no longer focused on
> > -       a certain surface.
> > +       a certain surface.  The surface parameter may be null if the
> > +       surface has been destroyed.
> >
> >         The leave notification is sent before the enter notification
> >         for the new focus.
> >        </description>
> >        <arg name="serial" type="uint"/>
> > -      <arg name="surface" type="object" interface="wl_surface"/>
> > +      <arg name="surface" type="object" interface="wl_surface"
> allow-null="true"/>
> >      </event>
> >
> >      <event name="motion">
> > @@ -1430,13 +1431,14 @@
> >      <event name="leave">
> >        <description summary="leave event">
> >         Notification that this seat's keyboard focus is no longer on
> > -       a certain surface.
> > +       a certain surface.  The surface parameter may be null if the
> > +       surface has been destroyed.
> >
> >         The leave notification is sent before the enter notification
> >         for the new focus.
> >        </description>
> >        <arg name="serial" type="uint"/>
> > -      <arg name="surface" type="object" interface="wl_surface"/>
> > +      <arg name="surface" type="object" interface="wl_surface"
> allow-null="true"/>
> >      </event>
> >
> >      <enum name="key_state">
> > --
> > 1.8.1.4
> >
> > _______________________________________________
> > 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/fe28c9d1/attachment-0001.html>


More information about the wayland-devel mailing list