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

Jason Ekstrand jason at jlekstrand.net
Mon Jun 17 15:56:40 PDT 2013


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



More information about the wayland-devel mailing list