[PATCH wayland 4/6] Rename key/button 'state' to is_down

Daniel Stone daniel at fooishbar.org
Wed May 2 08:53:33 PDT 2012


As it's actually a boolean to indicate whether or not the key or button
is down, rather than a 32-bit wide state mask.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 protocol/wayland.xml |    4 ++--
 src/data-device.c    |    6 +++---
 src/wayland-server.c |   10 +++++-----
 src/wayland-server.h |    4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

v2: No changes.

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 3aa4062..c618c64 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -738,7 +738,7 @@
       <arg name="serial" type="uint"/>
       <arg name="time" type="uint"/>
       <arg name="button" type="uint"/>
-      <arg name="state" type="uint"/>
+      <arg name="is_down" type="uint"/>
     </event>
 
     <enum name="axis">
@@ -765,7 +765,7 @@
       <arg name="serial" type="uint"/>
       <arg name="time" type="uint"/>
       <arg name="key" type="uint"/>
-      <arg name="state" type="uint"/>
+      <arg name="is_down" type="uint"/>
     </event>
 
     <event name="pointer_enter">
diff --git a/src/data-device.c b/src/data-device.c
index 7c26809..9006b93 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -253,16 +253,16 @@ data_device_end_drag_grab(struct wl_input_device *device)
 
 static void
 drag_grab_button(struct wl_pointer_grab *grab,
-		 uint32_t time, uint32_t button, uint32_t state)
+		 uint32_t time, uint32_t button, uint32_t is_down)
 {
 	struct wl_input_device *device =
 		container_of(grab, struct wl_input_device, drag_grab);
 
 	if (device->drag_focus_resource &&
-	    device->grab_button == button && state == 0)
+	    device->grab_button == button && is_down == 0)
 		wl_data_device_send_drop(device->drag_focus_resource);
 
-	if (device->button_count == 0 && state == 0) {
+	if (device->button_count == 0 && is_down == 0) {
 		data_device_end_drag_grab(device);
 		wl_list_remove(&device->drag_data_source_listener.link);
 	}
diff --git a/src/wayland-server.c b/src/wayland-server.c
index 678ab39..9d519fb 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -495,7 +495,7 @@ default_grab_motion(struct wl_pointer_grab *grab,
 
 static void
 default_grab_button(struct wl_pointer_grab *grab,
-		    uint32_t time, uint32_t button, uint32_t state)
+		    uint32_t time, uint32_t button, uint32_t is_down)
 {
 	struct wl_input_device *device = grab->input_device;
 	struct wl_resource *resource;
@@ -505,10 +505,10 @@ default_grab_button(struct wl_pointer_grab *grab,
 	if (resource) {
 		serial = wl_display_next_serial(resource->client->display);
 		wl_input_device_send_button(resource, serial, time,
-					    button, state);
+					    button, is_down);
 	}
 
-	if (device->button_count == 0 && state == 0)
+	if (device->button_count == 0 && is_down == 0)
 		wl_input_device_set_pointer_focus(device,
 						  device->current,
 						  device->current_x,
@@ -524,7 +524,7 @@ static const struct wl_pointer_grab_interface
 
 static void
 default_grab_key(struct wl_keyboard_grab *grab,
-		 uint32_t time, uint32_t key, uint32_t state)
+		 uint32_t time, uint32_t key, uint32_t is_down)
 {
 	struct wl_input_device *device = grab->input_device;
 	struct wl_resource *resource;
@@ -533,7 +533,7 @@ default_grab_key(struct wl_keyboard_grab *grab,
 	resource = device->keyboard_focus_resource;
 	if (resource) {
 		serial = wl_display_next_serial(resource->client->display);
-		wl_input_device_send_key(resource, serial, time, key, state);
+		wl_input_device_send_key(resource, serial, time, key, is_down);
 	}
 }
 
diff --git a/src/wayland-server.h b/src/wayland-server.h
index ec4bd38..9d4f58e 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -189,7 +189,7 @@ struct wl_pointer_grab_interface {
 	void (*motion)(struct wl_pointer_grab *grab,
 		       uint32_t time, int32_t x, int32_t y);
 	void (*button)(struct wl_pointer_grab *grab,
-		       uint32_t time, uint32_t button, uint32_t state);
+		       uint32_t time, uint32_t button, uint32_t is_down);
 };
 
 struct wl_pointer_grab {
@@ -202,7 +202,7 @@ struct wl_pointer_grab {
 struct wl_keyboard_grab;
 struct wl_keyboard_grab_interface {
 	void (*key)(struct wl_keyboard_grab *grab, uint32_t time,
-		    uint32_t key, uint32_t state);
+		    uint32_t key, uint32_t is_down);
 };
 
 struct wl_keyboard_grab {
-- 
1.7.10



More information about the wayland-devel mailing list