[PATCH libinput 1/3] tablet: provide x/y by default in mm off the top/left corner

Peter Hutterer peter.hutterer at who-t.net
Sun Jun 22 21:16:34 PDT 2014


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 <peter.hutterer at who-t.net>
---
 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 4efb36c..09bb454 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 04f40fa..ada6829 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
-- 
1.9.3



More information about the wayland-devel mailing list