From e276d310e81c6bebf883ff3eeff5210d306b1c57 Mon Sep 17 00:00:00 2001 From: Alex Maese Date: Mon, 17 Dec 2018 14:24:07 -0600 Subject: [PATCH] Add unaccelerated pointer values to wlr_event_pointer_motion events --- backend/libinput/pointer.c | 2 ++ include/wlr/types/wlr_pointer.h | 1 + rootston/cursor.c | 7 ++++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c index fb85cddd..b9cf1dfe 100644 --- a/backend/libinput/pointer.c +++ b/backend/libinput/pointer.c @@ -36,6 +36,8 @@ void handle_pointer_motion(struct libinput_event *event, usec_to_msec(libinput_event_pointer_get_time_usec(pevent)); wlr_event.delta_x = libinput_event_pointer_get_dx(pevent); wlr_event.delta_y = libinput_event_pointer_get_dy(pevent); + wlr_event.unaccel_dx = libinput_event_pointer_get_dx_unaccelerated(pevent); + wlr_event.unaccel_dy = libinput_event_pointer_get_dy_unaccelerated(pevent); wlr_signal_emit_safe(&wlr_dev->pointer->events.motion, &wlr_event); } diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 7dc643ae..6da4c02a 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -32,6 +32,7 @@ struct wlr_event_pointer_motion { struct wlr_input_device *device; uint32_t time_msec; double delta_x, delta_y; + double unaccel_dx, unaccel_dy; }; struct wlr_event_pointer_motion_absolute { diff --git a/rootston/cursor.c b/rootston/cursor.c index 16fb9c70..ffb38816 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -331,9 +331,11 @@ void roots_cursor_handle_motion(struct roots_cursor *cursor, double dx = event->delta_x; double dy = event->delta_y; - /* TODO send unaccelerated values */ + double unaccel_dx = event->unaccel_dx; + double unaccel_dy = event->unaccel_dy; + notify_relative_motion(cursor->seat, - (uint64_t)event->time_msec * 1000, dx, dy, dx, dy); + (uint64_t)event->time_msec * 1000, dx, dy, unaccel_dx, unaccel_dy); if (cursor->active_constraint) { struct roots_view *view = cursor->pointer_view->view; @@ -377,7 +379,6 @@ void roots_cursor_handle_motion_absolute(struct roots_cursor *cursor, double dx = lx - cursor->cursor->x; double dy = ly - cursor->cursor->y; - /* TODO send unaccelerated values */ notify_relative_motion(cursor->seat, (uint64_t)event->time_msec * 1000, dx, dy, dx, dy);