diff options
-rw-r--r-- | backend/libinput/tablet_tool.c | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_tablet_tool.h | 2 | ||||
-rw-r--r-- | rootston/seat.c | 19 |
3 files changed, 17 insertions, 6 deletions
diff --git a/backend/libinput/tablet_tool.c b/backend/libinput/tablet_tool.c index d780330a..0dab6795 100644 --- a/backend/libinput/tablet_tool.c +++ b/backend/libinput/tablet_tool.c @@ -204,10 +204,12 @@ void handle_tablet_tool_axis(struct libinput_event *event, if (libinput_event_tablet_tool_x_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_X; wlr_event.x = libinput_event_tablet_tool_get_x_transformed(tevent, 1); + wlr_event.dx = libinput_event_tablet_tool_get_dx(tevent); } if (libinput_event_tablet_tool_y_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_Y; wlr_event.y = libinput_event_tablet_tool_get_y_transformed(tevent, 1); + wlr_event.dy = libinput_event_tablet_tool_get_dy(tevent); } if (libinput_event_tablet_tool_pressure_has_changed(tevent)) { wlr_event.updated_axes |= WLR_TABLET_TOOL_AXIS_PRESSURE; diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index 71fa0f82..0a92ffe2 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -79,6 +79,8 @@ struct wlr_event_tablet_tool_axis { uint32_t updated_axes; // From 0..1 double x, y; + // Relative to last event + double dx, dy; double pressure; double distance; double tilt_x, tilt_y; diff --git a/rootston/seat.c b/rootston/seat.c index 56b9c50e..e9bfbdf7 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -104,14 +104,21 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) { static void handle_tablet_tool_position(struct roots_cursor *cursor, struct roots_tablet_tool *tool, struct wlr_tablet_tool_tool *tool_tool, - bool change_x, bool change_y, double x, double y, - uint32_t time) { + bool change_x, bool change_y, + double x, double y, double dx, double dy) { if (!change_x && !change_y) { return; } - wlr_cursor_warp_absolute(cursor->cursor, tool->device, - change_x ? x : NAN, change_y ? y : NAN); + switch (tool_tool->type) { + case WLR_TABLET_TOOL_TYPE_MOUSE: + // They are 0 either way when they weren't modified + wlr_cursor_move(cursor->cursor, tool->device, dx, dy); + break; + default: + wlr_cursor_warp_absolute(cursor->cursor, tool->device, + change_x ? x : NAN, change_y ? y : NAN); + } double sx, sy; struct roots_view *view = NULL; @@ -159,7 +166,7 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) { handle_tablet_tool_position(cursor, event->device->data, event->tool, event->updated_axes & WLR_TABLET_TOOL_AXIS_X, event->updated_axes & WLR_TABLET_TOOL_AXIS_Y, - event->x, event->y, event->time_msec); + event->x, event->y, event->dx, event->dy); if (event->updated_axes & WLR_TABLET_TOOL_AXIS_PRESSURE) { wlr_send_tablet_v2_tablet_tool_pressure(roots_tool->tablet_v2_tool, event->pressure); @@ -271,7 +278,7 @@ static void handle_tool_proximity(struct wl_listener *listener, void *data) { } handle_tablet_tool_position(cursor, event->device->data, event->tool, - true, true, event->x, event->y, event->time_msec); + true, true, event->x, event->y, 0, 0); } static void handle_request_set_cursor(struct wl_listener *listener, |