input: use doubles in the interfaces to notify of input events

This patch is a further step in the wl_fixed_t internal sanitization.
It changes the notify_* functions to take doubles instead of wl_fixed_t
but does not change how these are stored in the various input structs
yet, except for weston_pointer_axis_event.
However this already allows to remove all wl_fixed_t usage in places
like the libinput or the x11 backend.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 8a1878c..9d1a251 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -1275,11 +1275,15 @@
 static void
 input_handle_pointer_enter(void *data, struct wl_pointer *pointer,
 			   uint32_t serial, struct wl_surface *surface,
-			   wl_fixed_t x, wl_fixed_t y)
+			   wl_fixed_t fixed_x, wl_fixed_t fixed_y)
 {
 	struct wayland_input *input = data;
 	int32_t fx, fy;
 	enum theme_location location;
+	double x, y;
+
+	x = wl_fixed_to_double(fixed_x);
+	y = wl_fixed_to_double(fixed_y);
 
 	/* XXX: If we get a modifier event immediately before the focus,
 	 *      we should try to keep the same serial. */
@@ -1288,11 +1292,10 @@
 
 	if (input->output->frame) {
 		location = frame_pointer_enter(input->output->frame, input,
-					       wl_fixed_to_int(x),
-					       wl_fixed_to_int(y));
+					       x, y);
 		frame_interior(input->output->frame, &fx, &fy, NULL, NULL);
-		x -= wl_fixed_from_int(fx);
-		y -= wl_fixed_from_int(fy);
+		x -= fx;
+		y -= fy;
 
 		if (frame_status(input->output->frame) & FRAME_STATUS_REPAINT)
 			weston_output_schedule_repaint(&input->output->base);
@@ -1337,23 +1340,26 @@
 
 static void
 input_handle_motion(void *data, struct wl_pointer *pointer,
-		    uint32_t time, wl_fixed_t x, wl_fixed_t y)
+		    uint32_t time, wl_fixed_t fixed_x, wl_fixed_t fixed_y)
 {
 	struct wayland_input *input = data;
 	int32_t fx, fy;
 	enum theme_location location;
 	bool want_frame = false;
+	double x, y;
 
 	if (!input->output)
 		return;
 
+	x = wl_fixed_to_double(fixed_x);
+	y = wl_fixed_to_double(fixed_y);
+
 	if (input->output->frame) {
 		location = frame_pointer_motion(input->output->frame, input,
-						wl_fixed_to_int(x),
-						wl_fixed_to_int(y));
+						x, y);
 		frame_interior(input->output->frame, &fx, &fy, NULL, NULL);
-		x -= wl_fixed_from_int(fx);
-		y -= wl_fixed_from_int(fy);
+		x -= fx;
+		y -= fy;
 
 		if (frame_status(input->output->frame) & FRAME_STATUS_REPAINT)
 			weston_output_schedule_repaint(&input->output->base);
@@ -1447,7 +1453,7 @@
 	struct weston_pointer_axis_event weston_event;
 
 	weston_event.axis = axis;
-	weston_event.value = value;
+	weston_event.value = wl_fixed_to_double(value);
 
 	if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL &&
 	    input->vert.has_discrete) {
@@ -1705,14 +1711,18 @@
 static void
 input_handle_touch_down(void *data, struct wl_touch *wl_touch,
 			uint32_t serial, uint32_t time,
-			struct wl_surface *surface, int32_t id, wl_fixed_t x,
-			wl_fixed_t y)
+			struct wl_surface *surface, int32_t id,
+			wl_fixed_t fixed_x, wl_fixed_t fixed_y)
 {
 	struct wayland_input *input = data;
 	struct wayland_output *output;
 	enum theme_location location;
 	bool first_touch;
 	int32_t fx, fy;
+	double x, y;
+
+	x = wl_fixed_to_double(fixed_x);
+	y = wl_fixed_to_double(fixed_y);
 
 	first_touch = (input->touch_points == 0);
 	input->touch_points++;
@@ -1723,13 +1733,11 @@
 		return;
 
 	if (output->frame) {
-		location = frame_touch_down(output->frame, input, id,
-					    wl_fixed_to_int(x),
-					    wl_fixed_to_int(y));
+		location = frame_touch_down(output->frame, input, id, x, y);
 
 		frame_interior(output->frame, &fx, &fy, NULL, NULL);
-		x -= wl_fixed_from_int(fx);
-		y -= wl_fixed_from_int(fy);
+		x -= fx;
+		y -= fy;
 
 		if (frame_status(output->frame) & FRAME_STATUS_REPAINT)
 			weston_output_schedule_repaint(&output->base);
@@ -1792,20 +1800,24 @@
 
 static void
 input_handle_touch_motion(void *data, struct wl_touch *wl_touch,
-                        uint32_t time, int32_t id, wl_fixed_t x,
-                        wl_fixed_t y)
+                        uint32_t time, int32_t id,
+                        wl_fixed_t fixed_x, wl_fixed_t fixed_y)
 {
 	struct wayland_input *input = data;
 	struct wayland_output *output = input->touch_focus;
 	int32_t fx, fy;
+	double x, y;
+
+	x = wl_fixed_to_double(fixed_x);
+	y = wl_fixed_to_double(fixed_y);
 
 	if (!output || !input->touch_active)
 		return;
 
 	if (output->frame) {
 		frame_interior(output->frame, &fx, &fy, NULL, NULL);
-		x -= wl_fixed_from_int(fx);
-		y -= wl_fixed_from_int(fy);
+		x -= fx;
+		y -= fy;
 	}
 
 	weston_output_transform_coordinate(&output->base, x, y, &x, &y);