[PATCH libinput 10/15] tools: only print the tablet axes we have on the tool
Peter Hutterer
peter.hutterer at who-t.net
Tue Feb 17 21:45:11 PST 2015
This doesn't really have an effect, since we don't set the per-tool axes
correctly yet.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
tools/event-debug.c | 49 +++++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 16 deletions(-)
diff --git a/tools/event-debug.c b/tools/event-debug.c
index 0d25d6a..dcf1dae 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -291,6 +291,7 @@ static void
print_tablet_axis_event(struct libinput_event *ev)
{
struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev);
+ struct libinput_tool *tool = libinput_event_tablet_get_tool(t);
double x, y;
double dist, pressure;
double rotation, slider;
@@ -309,26 +310,42 @@ print_tablet_axis_event(struct libinput_event *ev)
x, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_X),
y, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_TILT_Y));
- dist = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_DISTANCE);
- pressure = libinput_event_tablet_get_axis_value(t, LIBINPUT_TABLET_AXIS_PRESSURE);
- if (dist)
- printf("distance: %.2f%s",
- dist, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_DISTANCE));
- else
- printf("pressure: %.2f%s",
- pressure, tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_PRESSURE));
+ if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_DISTANCE) ||
+ libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_PRESSURE)) {
+ dist = libinput_event_tablet_get_axis_value(t,
+ LIBINPUT_TABLET_AXIS_DISTANCE);
+ pressure = libinput_event_tablet_get_axis_value(t,
+ LIBINPUT_TABLET_AXIS_PRESSURE);
+ if (dist) {
+ printf("\tdistance: %.2f%s",
+ dist,
+ tablet_axis_changed_sym(t,
+ LIBINPUT_TABLET_AXIS_DISTANCE));
+ } else {
+ printf("\tpressure: %.2f%s",
+ pressure,
+ tablet_axis_changed_sym(t,
+ LIBINPUT_TABLET_AXIS_PRESSURE));
+ }
+ }
- rotation = libinput_event_tablet_get_axis_value(t,
+ if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_ROTATION_Z)) {
+ rotation = libinput_event_tablet_get_axis_value(t,
LIBINPUT_TABLET_AXIS_ROTATION_Z);
- printf(" rotation: %.2f%s",
- rotation,
- tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_ROTATION_Z));
+ printf("\trotation: %.2f%s",
+ rotation,
+ tablet_axis_changed_sym(t,
+ LIBINPUT_TABLET_AXIS_ROTATION_Z));
+ }
- slider = libinput_event_tablet_get_axis_value(t,
+ if (libinput_tool_has_axis(tool, LIBINPUT_TABLET_AXIS_SLIDER)) {
+ slider = libinput_event_tablet_get_axis_value(t,
LIBINPUT_TABLET_AXIS_SLIDER);
- printf(" slider: %.2f%s",
- slider,
- tablet_axis_changed_sym(t, LIBINPUT_TABLET_AXIS_SLIDER));
+ printf("\tslider: %.2f%s",
+ slider,
+ tablet_axis_changed_sym(t,
+ LIBINPUT_TABLET_AXIS_SLIDER));
+ }
printf("\n");
}
--
2.1.0
More information about the wayland-devel
mailing list