[PATCH weston v3 5/8] Rename 'state' in axis (or ambiguous) bindings to 'value'

Daniel Stone daniel at fooishbar.org
Fri May 4 03:21:57 PDT 2012


Since it's usually an axis value rather than a boolean, be slightly more
explicit about it.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/compositor.h |    8 +++++---
 src/shell.c      |   20 +++++++++++++-------
 src/util.c       |    6 +++---
 3 files changed, 21 insertions(+), 13 deletions(-)

v3: New.

diff --git a/src/compositor.h b/src/compositor.h
index 0561e22..bc0b862 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -468,10 +468,11 @@ typedef void (*weston_binding_handler_t)(struct wl_input_device *device,
 					 uint32_t time, uint32_t key,
 					 uint32_t button,
 					 uint32_t axis,
-					 int32_t state, void *data);
+					 int32_t value, void *data);
 struct weston_binding *
 weston_compositor_add_binding(struct weston_compositor *compositor,
-			      uint32_t key, uint32_t button, uint32_t axis, uint32_t modifier,
+			      uint32_t key, uint32_t button, uint32_t axis,
+			      uint32_t modifier,
 			      weston_binding_handler_t binding, void *data);
 void
 weston_binding_destroy(struct weston_binding *binding);
@@ -483,7 +484,8 @@ void
 weston_compositor_run_binding(struct weston_compositor *compositor,
 			      struct weston_input_device *device,
 			      uint32_t time,
-			      uint32_t key, uint32_t button, uint32_t axis, int32_t state);
+			      uint32_t key, uint32_t button, uint32_t axis,
+			      int32_t value);
 int
 weston_environment_get_fd(const char *env);
 
diff --git a/src/shell.c b/src/shell.c
index 757b589..437a72e 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -1499,7 +1499,8 @@ get_shell_surface_type(struct weston_surface *surface)
 
 static void
 move_binding(struct wl_input_device *device, uint32_t time,
-	     uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data)
+	     uint32_t key, uint32_t button, uint32_t axis, int32_t value,
+	     void *data)
 {
 	struct weston_surface *surface =
 		(struct weston_surface *) device->pointer_focus;
@@ -1522,7 +1523,8 @@ move_binding(struct wl_input_device *device, uint32_t time,
 
 static void
 resize_binding(struct wl_input_device *device, uint32_t time,
-	       uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data)
+	       uint32_t key, uint32_t button, uint32_t axis, int32_t value,
+	       void *data)
 {
 	struct weston_surface *surface =
 		(struct weston_surface *) device->pointer_focus;
@@ -1570,7 +1572,8 @@ resize_binding(struct wl_input_device *device, uint32_t time,
 
 static void
 surface_opacity_binding(struct wl_input_device *device, uint32_t time,
-	       uint32_t key, uint32_t button, uint32_t axis, int32_t value, void *data)
+			uint32_t key, uint32_t button, uint32_t axis,
+			int32_t value, void *data)
 {
 	uint32_t step = 15;
 	struct shell_surface *shsurf;
@@ -1605,7 +1608,8 @@ surface_opacity_binding(struct wl_input_device *device, uint32_t time,
 
 static void
 zoom_binding(struct wl_input_device *device, uint32_t time,
-	       uint32_t key, uint32_t button, uint32_t axis, int32_t value, void *data)
+	     uint32_t key, uint32_t button, uint32_t axis, int32_t value,
+	     void *data)
 {
 	struct weston_input_device *wd = (struct weston_input_device *) device;
 	struct weston_compositor *compositor = wd->compositor;
@@ -1737,7 +1741,8 @@ static const struct wl_pointer_grab_interface rotate_grab_interface = {
 
 static void
 rotate_binding(struct wl_input_device *device, uint32_t time,
-	       uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data)
+	       uint32_t key, uint32_t button, uint32_t axis, int32_t value,
+	       void *data)
 {
 	struct weston_surface *base_surface =
 		(struct weston_surface *) device->pointer_focus;
@@ -2425,7 +2430,7 @@ static const struct wl_keyboard_grab_interface switcher_grab = {
 static void
 switcher_binding(struct wl_input_device *device, uint32_t time,
 		 uint32_t key, uint32_t button, uint32_t axis,
-		 int32_t state, void *data)
+		 int32_t value, void *data)
 {
 	struct desktop_shell *shell = data;
 	struct switcher *switcher;
@@ -2478,7 +2483,8 @@ backlight_binding(struct wl_input_device *device, uint32_t time,
 
 static void
 debug_repaint_binding(struct wl_input_device *device, uint32_t time,
-		      uint32_t key, uint32_t button, uint32_t axis, int32_t state, void *data)
+		      uint32_t key, uint32_t button, uint32_t axis,
+		      int32_t value, void *data)
 {
 	struct desktop_shell *shell = data;
 	struct weston_compositor *compositor = shell->compositor;
diff --git a/src/util.c b/src/util.c
index 1f313d4..e15f5ea 100644
--- a/src/util.c
+++ b/src/util.c
@@ -290,15 +290,15 @@ WL_EXPORT void
 weston_compositor_run_binding(struct weston_compositor *compositor,
 			      struct weston_input_device *device,
 			      uint32_t time, uint32_t key,
-			      uint32_t button, uint32_t axis, int32_t state)
+			      uint32_t button, uint32_t axis, int32_t value)
 {
 	struct weston_binding *b;
 
 	wl_list_for_each(b, &compositor->binding_list, link) {
 		if (b->key == key && b->button == button && b->axis == axis &&
-		    b->modifier == device->modifier_state && state) {
+		    b->modifier == device->modifier_state && value) {
 			b->handler(&device->input_device,
-				   time, key, button, axis, state, b->data);
+				   time, key, button, axis, value, b->data);
 
 			/* If this was a key binding and it didn't
 			 * install a keyboard grab, install one now to
-- 
1.7.10



More information about the wayland-devel mailing list