The output is renamed "output" from "x11_output" and the input coordinates
are changed to wl_fixed_t from int.  This way it is useable in
compositor-wayland as well as compositor-x11 and evdev.

Signed-off-by: Jason Ekstrand <ja...@jlekstrand.net>
---
 src/compositor-x11.c |  9 +++++----
 src/compositor.c     | 34 +++++++++++++++++-----------------
 src/compositor.h     |  4 ++--
 src/evdev.c          | 16 ++++++++++------
 4 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index ee3df31..961ee0a 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -1095,8 +1095,9 @@ x11_compositor_deliver_motion_event(struct x11_compositor 
*c,
                update_xkb_state_from_core(c, motion_notify->state);
        output = x11_compositor_find_output(c, motion_notify->event);
        weston_output_transform_coordinate(&output->base,
-                                          motion_notify->event_x,
-                                          motion_notify->event_y, &x, &y);
+                                          
wl_fixed_from_int(motion_notify->event_x),
+                                          
wl_fixed_from_int(motion_notify->event_y),
+                                          &x, &y);
 
        notify_motion(&c->core_seat, weston_compositor_get_time(),
                      x - c->prev_x, y - c->prev_y);
@@ -1120,8 +1121,8 @@ x11_compositor_deliver_enter_event(struct x11_compositor 
*c,
                update_xkb_state_from_core(c, enter_notify->state);
        output = x11_compositor_find_output(c, enter_notify->event);
        weston_output_transform_coordinate(&output->base,
-                                          enter_notify->event_x,
-                                          enter_notify->event_y, &x, &y);
+                                          
wl_fixed_from_int(enter_notify->event_x),
+                                          
wl_fixed_from_int(enter_notify->event_y), &x, &y);
 
        notify_pointer_focus(&c->core_seat, &output->base, x, y);
 
diff --git a/src/compositor.c b/src/compositor.c
index 418ebb0..cc33ba5 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3107,7 +3107,7 @@ weston_output_init(struct weston_output *output, struct 
weston_compositor *c,
 
 WL_EXPORT void
 weston_output_transform_coordinate(struct weston_output *output,
-                                  int device_x, int device_y,
+                                  wl_fixed_t device_x, wl_fixed_t device_y,
                                   wl_fixed_t *x, wl_fixed_t *y)
 {
        wl_fixed_t tx, ty;
@@ -3119,36 +3119,36 @@ weston_output_transform_coordinate(struct weston_output 
*output,
        switch(output->transform) {
        case WL_OUTPUT_TRANSFORM_NORMAL:
        default:
-               tx = wl_fixed_from_int(device_x);
-               ty = wl_fixed_from_int(device_y);
+               tx = device_x;
+               ty = device_y;
                break;
        case WL_OUTPUT_TRANSFORM_90:
-               tx = wl_fixed_from_int(device_y);
-               ty = height - wl_fixed_from_int(device_x);
+               tx = device_y;
+               ty = height - device_x;
                break;
        case WL_OUTPUT_TRANSFORM_180:
-               tx = width - wl_fixed_from_int(device_x);
-               ty = height - wl_fixed_from_int(device_y);
+               tx = width - device_x;
+               ty = height - device_y;
                break;
        case WL_OUTPUT_TRANSFORM_270:
-               tx = width - wl_fixed_from_int(device_y);
-               ty = wl_fixed_from_int(device_x);
+               tx = width - device_y;
+               ty = device_x;
                break;
        case WL_OUTPUT_TRANSFORM_FLIPPED:
-               tx = width - wl_fixed_from_int(device_x);
-               ty = wl_fixed_from_int(device_y);
+               tx = width - device_x;
+               ty = device_y;
                break;
        case WL_OUTPUT_TRANSFORM_FLIPPED_90:
-               tx = width - wl_fixed_from_int(device_y);
-               ty = height - wl_fixed_from_int(device_x);
+               tx = width - device_y;
+               ty = height - device_x;
                break;
        case WL_OUTPUT_TRANSFORM_FLIPPED_180:
-               tx = wl_fixed_from_int(device_x);
-               ty = height - wl_fixed_from_int(device_y);
+               tx = device_x;
+               ty = height - device_y;
                break;
        case WL_OUTPUT_TRANSFORM_FLIPPED_270:
-               tx = wl_fixed_from_int(device_y);
-               ty = wl_fixed_from_int(device_x);
+               tx = device_y;
+               ty = device_x;
                break;
        }
 
diff --git a/src/compositor.h b/src/compositor.h
index c36b209..b4dd942 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -1155,8 +1155,8 @@ weston_output_init(struct weston_output *output, struct 
weston_compositor *c,
 void
 weston_output_destroy(struct weston_output *output);
 void
-weston_output_transform_coordinate(struct weston_output *x11_output,
-                                  int device_x, int device_y,
+weston_output_transform_coordinate(struct weston_output *output,
+                                  wl_fixed_t device_x, wl_fixed_t device_y,
                                   wl_fixed_t *x, wl_fixed_t *y);
 
 void
diff --git a/src/evdev.c b/src/evdev.c
index ad7a3f6..b3609d5 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -104,16 +104,16 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
                goto handled;
        case EVDEV_ABSOLUTE_MT_DOWN:
                weston_output_transform_coordinate(device->output,
-                                                  device->mt.slots[slot].x,
-                                                  device->mt.slots[slot].y,
+                                                  
wl_fixed_from_int(device->mt.slots[slot].x),
+                                                  
wl_fixed_from_int(device->mt.slots[slot].y),
                                                   &x, &y);
                notify_touch(master, time,
                             slot, x, y, WL_TOUCH_DOWN);
                goto handled;
        case EVDEV_ABSOLUTE_MT_MOTION:
                weston_output_transform_coordinate(device->output,
-                                                  device->mt.slots[slot].x,
-                                                  device->mt.slots[slot].y,
+                                                  
wl_fixed_from_int(device->mt.slots[slot].x),
+                                                  
wl_fixed_from_int(device->mt.slots[slot].y),
                                                   &x, &y);
                notify_touch(master, time,
                             slot, x, y, WL_TOUCH_MOTION);
@@ -125,13 +125,17 @@ evdev_flush_pending_event(struct evdev_device *device, 
uint32_t time)
        case EVDEV_ABSOLUTE_TOUCH_DOWN:
                transform_absolute(device, &cx, &cy);
                weston_output_transform_coordinate(device->output,
-                                                  cx, cy, &x, &y);
+                                                  wl_fixed_from_int(cx),
+                                                  wl_fixed_from_int(cy),
+                                                  &x, &y);
                notify_touch(master, time, 0, x, y, WL_TOUCH_DOWN);
                goto handled;
        case EVDEV_ABSOLUTE_MOTION:
                transform_absolute(device, &cx, &cy);
                weston_output_transform_coordinate(device->output,
-                                                  cx, cy, &x, &y);
+                                                  wl_fixed_from_int(cx),
+                                                  wl_fixed_from_int(cy),
+                                                  &x, &y);
 
                if (device->caps & EVDEV_TOUCH)
                        notify_touch(master, time, 0, x, y, WL_TOUCH_MOTION);
-- 
1.8.3.1

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to