[PATCH wayland] Add a relative_grab request to the wl_shell_surface interface

Philipp Brüschweiler blei42 at gmail.com
Mon Aug 27 11:55:44 PDT 2012


This request can be used to grab the pointer of a specified seat. A
pointer grabbed in this way will be made invisible and won't send any
more motion events. Instead it reports relative motion using the motion
event on the returned object.

A grab can be broken by the application by destroying the wl_relative_grab
object, or by the compositor, in which case the compositor sends a
destroy_me event to the application.

Recommended behaviour for compositors is to break grabs when the keyboard
focus changes to a different window, e.g. by alt-tabbing out of the
grabbing application.
---
 protocol/wayland.xml | 23 +++++++++++++++++++++++
 src/wayland-server.h |  1 +
 2 Dateien geändert, 24 Zeilen hinzugefügt(+)

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 5e56cb8..f903fef 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -412,6 +412,23 @@
     </request>
   </interface>
 
+  <interface name="wl_relative_grab" version="1">
+    <request name="destroy" type="destructor"/>
+
+    <event name="motion">
+      <description summary="pointer motion event">
+        Notification of pointer location change. The arguments dx/dy
+	are relative movements since the last motion event.
+      </description>
+
+      <arg name="time" type="uint"/>
+      <arg name="dx" type="fixed"/>
+      <arg name="dy" type="fixed"/>
+    </event>
+
+    <event name="destroy_me"/>
+  </interface>
+
   <interface name="wl_shell_surface" version="1">
 
     <description summary="desktop style meta data interface">
@@ -434,6 +451,12 @@
       <arg name="serial" type="uint"/>
     </request>
 
+    <request name="relative_grab">
+      <arg name="relative_grab" type="new_id" interface="wl_relative_grab"/>
+      <arg name="seat" type="object" interface="wl_seat"/>
+      <arg name="serial" type="uint"/>
+    </request>
+
     <enum name="resize">
       <entry name="none" value="0"/>
       <entry name="top" value="1"/>
diff --git a/src/wayland-server.h b/src/wayland-server.h
index f092145..efc69fc 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -204,6 +204,7 @@ struct wl_pointer_grab {
 	struct wl_pointer *pointer;
 	struct wl_surface *focus;
 	wl_fixed_t x, y;
+	int is_relative;
 };
 
 struct wl_keyboard_grab;
-- 
1.7.12



More information about the wayland-devel mailing list