---
 src/compositor-wayland.c |  6 ++++--
 src/compositor-x11.c     | 12 +++++++++---
 src/compositor.c         |  9 ++++++---
 src/evdev.c              |  4 +---
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c
index 66e9695..ceb912a 100644
--- a/src/compositor-wayland.c
+++ b/src/compositor-wayland.c
@@ -361,8 +361,10 @@ input_handle_motion(void *data, struct wl_pointer *pointer,
        check_focus(input, x, y);
        if (input->focus)
                notify_motion(&input->base, time,
-                             x - wl_fixed_from_int(c->border.left),
-                             y - wl_fixed_from_int(c->border.top));
+                             x - wl_fixed_from_int(c->border.left) -
+                             input->base.seat.pointer->x,
+                             y - wl_fixed_from_int(c->border.top) -
+                             input->base.seat.pointer->y);
 }
 
 static void
diff --git a/src/compositor-x11.c b/src/compositor-x11.c
index 1119934..8e052dd 100644
--- a/src/compositor-x11.c
+++ b/src/compositor-x11.c
@@ -89,7 +89,9 @@ struct x11_compositor {
 
        /* We could map multi-pointer X to multiple wayland seats, but
         * for now we only support core X input. */
-       struct weston_seat       core_seat;
+       struct weston_seat               core_seat;
+       int                              prev_x;
+       int                              prev_y;
 
        struct {
                xcb_atom_t               wm_protocols;
@@ -1008,8 +1010,10 @@ x11_compositor_deliver_motion_event(struct 
x11_compositor *c,
        if (!c->has_xkb)
                update_xkb_state_from_core(c, motion_notify->state);
        output = x11_compositor_find_output(c, motion_notify->event);
-       x = wl_fixed_from_int(motion_notify->event_x);
-       y = wl_fixed_from_int(motion_notify->event_y);
+       x = wl_fixed_from_int(motion_notify->event_x - c->prev_x);
+       y = wl_fixed_from_int(motion_notify->event_y - c->prev_y);
+       c->prev_x = motion_notify->event_x;
+       c->prev_y = motion_notify->event_y;
        x11_output_transform_coordinate(output, &x, &y);
 
        notify_motion(&c->core_seat, weston_compositor_get_time(), x, y);
@@ -1029,6 +1033,8 @@ x11_compositor_deliver_enter_event(struct x11_compositor 
*c,
        if (!c->has_xkb)
                update_xkb_state_from_core(c, enter_notify->state);
        output = x11_compositor_find_output(c, enter_notify->event);
+       c->prev_x = enter_notify->event_x;
+       c->prev_y = enter_notify->event_y;
        x = wl_fixed_from_int(enter_notify->event_x);
        y = wl_fixed_from_int(enter_notify->event_y);
        x11_output_transform_coordinate(output, &x, &y);
diff --git a/src/compositor.c b/src/compositor.c
index d8bc00c..ccfc67b 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1694,13 +1694,16 @@ clip_pointer_motion(struct weston_seat *seat, 
wl_fixed_t *fx, wl_fixed_t *fy)
 }
 
 static void
-move_pointer(struct weston_seat *seat, wl_fixed_t x, wl_fixed_t y)
+move_pointer(struct weston_seat *seat, wl_fixed_t dx, wl_fixed_t dy)
 {
        struct weston_compositor *ec = seat->compositor;
        struct wl_pointer *pointer = seat->seat.pointer;
        struct weston_output *output;
+       wl_fixed_t x, y;
        int32_t ix, iy;
 
+       x = pointer->x + dx;
+       y = pointer->y + dy;
        clip_pointer_motion(seat, &x, &y);
 
        weston_seat_update_drag_surface(seat, x - pointer->x, y - pointer->y);
@@ -1729,7 +1732,7 @@ move_pointer(struct weston_seat *seat, wl_fixed_t x, 
wl_fixed_t y)
 
 WL_EXPORT void
 notify_motion(struct weston_seat *seat,
-             uint32_t time, wl_fixed_t x, wl_fixed_t y)
+             uint32_t time, wl_fixed_t dx, wl_fixed_t dy)
 {
        const struct wl_pointer_grab_interface *interface;
        struct weston_compositor *ec = seat->compositor;
@@ -1737,7 +1740,7 @@ notify_motion(struct weston_seat *seat,
 
        weston_compositor_wake(ec);
 
-       move_pointer(seat, x, y);
+       move_pointer(seat, dx, dy);
 
        interface = pointer->grab->interface;
        interface->motion(pointer->grab, time,
diff --git a/src/evdev.c b/src/evdev.c
index 286543a..ec3a260 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -253,9 +253,7 @@ evdev_flush_motion(struct evdev_device *device, uint32_t 
time)
                return;
 
        if (device->pending_events & EVDEV_RELATIVE_MOTION) {
-               notify_motion(master, time,
-                             master->seat.pointer->x + device->rel.dx,
-                             master->seat.pointer->y + device->rel.dy);
+               notify_motion(master, time, device->rel.dx, device->rel.dy);
                device->pending_events &= ~EVDEV_RELATIVE_MOTION;
                device->rel.dx = 0;
                device->rel.dy = 0;
-- 
1.8.1.2

_______________________________________________
wayland-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to