[PATCH libinput 2/7] tools: share the axis and tip code where appropriate
Peter Hutterer
peter.hutterer at who-t.net
Thu Jan 14 16:26:36 PST 2016
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
tools/event-gui.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/tools/event-gui.c b/tools/event-gui.c
index 636c28b..fa0e1a0 100644
--- a/tools/event-gui.c
+++ b/tools/event-gui.c
@@ -602,6 +602,9 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
struct libinput_event_tablet_tool *t = libinput_event_get_tablet_tool_event(ev);
double x, y;
+ x = libinput_event_tablet_tool_get_x_transformed(t, w->width);
+ y = libinput_event_tablet_tool_get_y_transformed(t, w->height);
+
switch (libinput_event_get_type(ev)) {
case LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY:
if (libinput_event_tablet_tool_get_proximity_state(t) ==
@@ -613,25 +616,11 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
w->tool.x_up = 0;
w->tool.y_up = 0;
} else {
- w->tool.x_in = libinput_event_tablet_tool_get_x_transformed(t,
- w->width);
- w->tool.y_in = libinput_event_tablet_tool_get_y_transformed(t,
- w->height);
+ w->tool.x_in = x;
+ w->tool.y_in = y;
}
break;
- case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
- w->tool.x = libinput_event_tablet_tool_get_x_transformed(t,
- w->width);
- w->tool.y = libinput_event_tablet_tool_get_y_transformed(t,
- w->height);
- w->tool.pressure = libinput_event_tablet_tool_get_pressure(t);
- w->tool.distance = libinput_event_tablet_tool_get_distance(t);
- w->tool.tilt_x = libinput_event_tablet_tool_get_tilt_x(t);
- w->tool.tilt_y = libinput_event_tablet_tool_get_tilt_y(t);
- break;
case LIBINPUT_EVENT_TABLET_TOOL_TIP:
- x = libinput_event_tablet_tool_get_x_transformed(t, w->width);
- y = libinput_event_tablet_tool_get_y_transformed(t, w->height);
w->tool.pressure = libinput_event_tablet_tool_get_pressure(t);
w->tool.distance = libinput_event_tablet_tool_get_distance(t);
w->tool.tilt_x = libinput_event_tablet_tool_get_tilt_x(t);
@@ -644,6 +633,14 @@ handle_event_tablet(struct libinput_event *ev, struct window *w)
w->tool.x_up = x;
w->tool.y_up = y;
}
+ /* fallthrough */
+ case LIBINPUT_EVENT_TABLET_TOOL_AXIS:
+ w->tool.x = x;
+ w->tool.y = y;
+ w->tool.pressure = libinput_event_tablet_tool_get_pressure(t);
+ w->tool.distance = libinput_event_tablet_tool_get_distance(t);
+ w->tool.tilt_x = libinput_event_tablet_tool_get_tilt_x(t);
+ w->tool.tilt_y = libinput_event_tablet_tool_get_tilt_y(t);
break;
case LIBINPUT_EVENT_TABLET_TOOL_BUTTON:
break;
--
2.5.0
More information about the wayland-devel
mailing list