[PATCH weston 19/31] Convert notify_axis to wl_fixed_t

Daniel Stone daniel at fooishbar.org
Wed May 30 08:31:57 PDT 2012


In preparation for the rest of the axis code changing.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 src/compositor-wayland.c |    2 +-
 src/compositor-x11.c     |   12 ++++++++----
 src/compositor.c         |   10 ++++++----
 src/compositor.h         |    2 +-
 src/evdev.c              |    6 ++++--
 5 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 83bd683..0615f95 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -564,7 +564,7 @@ input_handle_axis(void *data, struct wl_pointer *pointer,
 	struct wayland_input *input = data;
 	struct wayland_compositor *c = input->compositor;
 
-	notify_axis(&c->base.seat->seat, time, axis, value);
+	notify_axis(&c->base.seat->seat, time, axis, wl_fixed_from_int(value));
 }
 
 static const struct wl_pointer_listener pointer_listener = {
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index b64b26c..c69f292 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -502,25 +502,29 @@ x11_compositor_deliver_button_event(struct x11_compositor *c,
 		if (state)
 			notify_axis(&c->base.seat->seat,
 				      weston_compositor_get_time(),
-				      WL_POINTER_AXIS_VERTICAL_SCROLL, 1);
+				      WL_POINTER_AXIS_VERTICAL_SCROLL,
+				      wl_fixed_from_int(1));
 		return;
 	case 5:
 		if (state)
 			notify_axis(&c->base.seat->seat,
 				      weston_compositor_get_time(),
-				      WL_POINTER_AXIS_VERTICAL_SCROLL, -1);
+				      WL_POINTER_AXIS_VERTICAL_SCROLL,
+				      wl_fixed_from_int(-1));
 		return;
 	case 6:
 		if (state)
 			notify_axis(&c->base.seat->seat,
 				      weston_compositor_get_time(),
-				      WL_POINTER_AXIS_HORIZONTAL_SCROLL, 1);
+				      WL_POINTER_AXIS_HORIZONTAL_SCROLL,
+				      wl_fixed_from_int(1));
 		return;
 	case 7:
 		if (state)
 			notify_axis(&c->base.seat->seat,
 				      weston_compositor_get_time(),
-				      WL_POINTER_AXIS_HORIZONTAL_SCROLL, -1);
+				      WL_POINTER_AXIS_HORIZONTAL_SCROLL,
+				      wl_fixed_from_int(-1));
 		return;
 	}
 
diff --git a/src/compositor.c b/src/compositor.c
index ffbdf96..835f342 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1708,7 +1708,8 @@ notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
 }
 
 WL_EXPORT void
-notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis, int32_t value)
+notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
+	    wl_fixed_t value)
 {
 	struct weston_seat *ws = (struct weston_seat *) seat;
 	struct weston_compositor *compositor = ws->compositor;
@@ -1723,13 +1724,14 @@ notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis, int32_t value)
 
 	if (value)
 		weston_compositor_run_binding(compositor, ws,
-					      time, 0, 0, axis, value);
+					      time, 0, 0, axis,
+					      wl_fixed_to_int(value));
 	else
 		return;
 
 	if (seat->pointer->focus_resource)
-		wl_resource_post_event(seat->pointer->focus_resource,
-				       WL_POINTER_AXIS, time, axis, value);
+		wl_pointer_send_axis(seat->pointer->focus_resource, time, axis,
+				     wl_fixed_to_int(value));
 }
 
 static int
diff --git a/src/compositor.h b/src/compositor.h
index 16240ee..1484bcf 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -476,7 +476,7 @@ notify_button(struct wl_seat *seat, uint32_t time, int32_t button,
 	      enum wl_pointer_button_state state);
 void
 notify_axis(struct wl_seat *seat, uint32_t time, uint32_t axis,
-	    int32_t value);
+	    wl_fixed_t value);
 void
 notify_key(struct wl_seat *seat, uint32_t time, uint32_t key,
 	   enum wl_keyboard_key_state state);
diff --git a/src/evdev.c b/src/evdev.c
index 0a5ec91..a9c132c 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -168,12 +168,14 @@ evdev_process_relative(struct evdev_input_device *device,
 	case REL_WHEEL:
 		notify_axis(&device->master->base.seat,
 			      time,
-			      WL_POINTER_AXIS_VERTICAL_SCROLL, e->value);
+			      WL_POINTER_AXIS_VERTICAL_SCROLL,
+			      wl_fixed_from_int(e->value));
 		break;
 	case REL_HWHEEL:
 		notify_axis(&device->master->base.seat,
 			      time,
-			      WL_POINTER_AXIS_HORIZONTAL_SCROLL, e->value);
+			      WL_POINTER_AXIS_HORIZONTAL_SCROLL,
+			      wl_fixed_from_int(e->value));
 		break;
 	}
 }
-- 
1.7.10



More information about the wayland-devel mailing list