From 797b4b4e5accec9d27104864b24f461afc32b270 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 17 Jun 2014 15:23:13 +1000 Subject: [PATCH] tablet: provide x/y by default in mm off the top/left corner Given that tablets may not have the same x/y resolution, raw or normalized values are mostly meaningless and likely to be handled the wrong way. Providing x/y in mm is the only constant, meaningful value. Signed-off-by: Peter Hutterer Reviewed-by: Hans de Goede --- src/evdev-tablet.c | 3 +++ src/libinput.h | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c index 4efb36c7..09bb454f 100644 --- a/src/evdev-tablet.c +++ b/src/evdev-tablet.c @@ -141,6 +141,9 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet, switch (a) { case LIBINPUT_TABLET_AXIS_X: case LIBINPUT_TABLET_AXIS_Y: + tablet->axes[a] = evdev_convert_to_mm(absinfo, + absinfo->value); + break; case LIBINPUT_TABLET_AXIS_DISTANCE: tablet->axes[a] = absinfo->value; break; diff --git a/src/libinput.h b/src/libinput.h index 04f40fa8..ada68296 100644 --- a/src/libinput.h +++ b/src/libinput.h @@ -861,11 +861,11 @@ libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event, * * Return the axis value of a given axis for a tablet. The interpretation of the * value is dependent on the axis: - * - @ref LIBINPUT_TABLET_AXIS_X and @ref LIBINPUT_TABLET_AXIS_Y - the raw X and - * Y coordinates of the tablet tool. By default these are not transformed, - * however libinput provides libinput_event_tablet_get_x_transformed() and - * libinput_event_tablet_get_y_transformed() for transforming each respective - * axis value. + * - @ref LIBINPUT_TABLET_AXIS_X and @ref LIBINPUT_TABLET_AXIS_Y - the X and + * Y coordinates of the tablet tool, in mm from the top left corner of the + * tablet. Use libinput_event_tablet_get_x_transformed() and + * libinput_event_tablet_get_y_transformed() for transforming each + * respective axis value. * - @ref LIBINPUT_TABLET_AXIS_DISTANCE - Approximately how many millimeters * away from the tablet's sensor the tool is * - @ref LIBINPUT_TABLET_AXIS_PRESSURE - The current pressure being applied on