input: Make pointer grab motion callbacks take an event struct

Instead of only passing absolute pointer coordinates, effectively
loosing motion event data, pass a struct that can potentially contain
different types of motion events, currently being absolute and relative.

A helper function to get resulting absolute coordinates was added for
when previous callbacks simply used the (x, y) coordinates.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index ccb7867..26e387e 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -1126,6 +1126,7 @@
 {
 	struct x11_output *output;
 	wl_fixed_t x, y;
+	struct weston_pointer_motion_event motion_event = { 0 };
 	xcb_motion_notify_event_t *motion_notify =
 			(xcb_motion_notify_event_t *) event;
 
@@ -1140,8 +1141,14 @@
 					   wl_fixed_from_int(motion_notify->event_y),
 					   &x, &y);
 
+	motion_event = (struct weston_pointer_motion_event) {
+		.mask = WESTON_POINTER_MOTION_REL,
+		.dx = wl_fixed_to_double(x - b->prev_x),
+		.dy = wl_fixed_to_double(y - b->prev_y)
+	};
+
 	notify_motion(&b->core_seat, weston_compositor_get_time(),
-		      x - b->prev_x, y - b->prev_y);
+		      &motion_event);
 
 	b->prev_x = x;
 	b->prev_y = y;