aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authornyorain <nyorain@gmail.com>2017-06-22 17:12:09 +0200
committernyorain <nyorain@gmail.com>2017-06-22 17:12:09 +0200
commitd26a9ba968472cb5c78d9ea0aea3d8f5ff02fbf5 (patch)
treedf3fec0b59f46211205ff8688e9513ab83bb4cf7 /backend
parentc1520077b6dab32dee359bdfe03dddc5e391f9a5 (diff)
Fix pointer motion coords
Diffstat (limited to 'backend')
-rw-r--r--backend/wayland/wl_seat.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/backend/wayland/wl_seat.c b/backend/wayland/wl_seat.c
index 2538d4b2..f4d3cd52 100644
--- a/backend/wayland/wl_seat.c
+++ b/backend/wayland/wl_seat.c
@@ -33,15 +33,21 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
assert(dev && dev->pointer && dev->pointer->state);
struct wlr_pointer_state *state = dev->pointer->state;
+ double x = wl_fixed_to_double(surface_x);
+ double y = wl_fixed_to_double(surface_y);
+
+ if (x == state->surface_x && y == state->surface_y)
+ return;
+
struct wlr_event_pointer_motion wlr_event;
wlr_event.time_sec = time / 1000;
wlr_event.time_usec = time * 1000;
- wlr_event.delta_x = wl_fixed_to_double(surface_x) - state->surface_x;
- wlr_event.delta_y = wl_fixed_to_double(surface_y) - state->surface_y;
+ wlr_event.delta_x = x - state->surface_x;
+ wlr_event.delta_y = y - state->surface_y;
wl_signal_emit(&dev->pointer->events.motion, &wlr_event);
- state->surface_x = surface_x;
- state->surface_y = surface_y;
+ state->surface_x = x;
+ state->surface_y = y;
}
static void pointer_handle_button(void *data, struct wl_pointer *wl_pointer,