diff options
author | Markus Ongyerth <ongy@ongy.net> | 2018-09-27 18:29:53 +0200 |
---|---|---|
committer | Markus Ongyerth <ongy@ongy.net> | 2018-09-27 18:31:50 +0200 |
commit | 3e494efc5c55dbc419aa3f05e0520a97806bc9e9 (patch) | |
tree | 2c24cebb6d2285655718d7c9951473dfff317526 | |
parent | e47b8cd629f9378c74673cb577cc268667a71d1e (diff) |
Fix tablet_tool tilt and send proximity_out
Originally I asumed tilt_x and tilt_y are very unlikely to change
independent, I was proven wrong.
And while investigating Krita not using the Erasor tool, I found a bug,
which is unrelated though.
-rw-r--r-- | include/rootston/seat.h | 1 | ||||
-rw-r--r-- | rootston/seat.c | 17 |
2 files changed, 17 insertions, 1 deletions
diff --git a/include/rootston/seat.h b/include/rootston/seat.h index c5e584b6..8b04e892 100644 --- a/include/rootston/seat.h +++ b/include/rootston/seat.h @@ -114,6 +114,7 @@ struct roots_tablet_tool { struct wlr_tablet_v2_tablet_tool *tablet_v2_tool; struct roots_seat *seat; + double tilt_x, tilt_y; struct wl_listener set_cursor; struct wl_listener tool_destroy; diff --git a/rootston/seat.c b/rootston/seat.c index 507254d4..c78eb294 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -178,9 +178,18 @@ static void handle_tool_axis(struct wl_listener *listener, void *data) { roots_tool->tablet_v2_tool, event->distance); } + if (event->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_X) { + roots_tool->tilt_x = event->tilt_x; + } + + if (event->updated_axes & WLR_TABLET_TOOL_AXIS_TILT_Y) { + roots_tool->tilt_y = event->tilt_y; + } + if (event->updated_axes & (WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y)) { wlr_tablet_v2_tablet_tool_notify_tilt( - roots_tool->tablet_v2_tool, event->tilt_x, event->tilt_y); + roots_tool->tablet_v2_tool, + roots_tool->tilt_x, roots_tool->tilt_y); } if (event->updated_axes & WLR_TABLET_TOOL_AXIS_ROTATION) { @@ -285,6 +294,12 @@ static void handle_tool_proximity(struct wl_listener *listener, void *data) { wl_list_init(&roots_tool->tool_link); } + if (event->state == WLR_TABLET_TOOL_PROXIMITY_OUT) { + struct roots_tablet_tool *roots_tool = tool->data; + wlr_tablet_v2_tablet_tool_notify_proximity_out(roots_tool->tablet_v2_tool); + return; + } + handle_tablet_tool_position(cursor, event->device->data, event->tool, true, true, event->x, event->y, 0, 0); } |