LIBINPUT_EXPORT double
libinput_event_pointer_get_absolute_x(struct libinput_event_pointer *event)
{
- return event->x;
+ struct evdev_device *device =
+ (struct evdev_device *) event->base.device;
+
+ return evdev_convert_to_mm(device->abs.absinfo_x, event->x);
}
LIBINPUT_EXPORT double
libinput_event_pointer_get_absolute_y(struct libinput_event_pointer *event)
{
- return event->y;
+ struct evdev_device *device =
+ (struct evdev_device *) event->base.device;
+
+ return evdev_convert_to_mm(device->abs.absinfo_y, event->y);
}
LIBINPUT_EXPORT double
LIBINPUT_EXPORT double
libinput_event_touch_get_x(struct libinput_event_touch *event)
{
- return event->x;
+ struct evdev_device *device =
+ (struct evdev_device *) event->base.device;
+
+ return evdev_convert_to_mm(device->abs.absinfo_x, event->x);
}
LIBINPUT_EXPORT double
LIBINPUT_EXPORT double
libinput_event_touch_get_y(struct libinput_event_touch *event)
{
- return event->y;
+ struct evdev_device *device =
+ (struct evdev_device *) event->base.device;
+
+ return evdev_convert_to_mm(device->abs.absinfo_y, event->y);
}
struct libinput_source *
/**
* @ingroup event_pointer
*
- * Return the current absolute x coordinate of the pointer event.
- *
- * The coordinate is in a device specific coordinate space; to get the
- * corresponding output screen coordinate, use
- * libinput_event_pointer_get_x_transformed().
+ * Return the current absolute x coordinate of the pointer event, in mm from
+ * the top left corner of the device. To get the corresponding output screen
+ * coordinate, use libinput_event_pointer_get_x_transformed().
*
* For pointer events that are not of type
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
/**
* @ingroup event_pointer
*
- * Return the current absolute y coordinate of the pointer event.
- *
- * The coordinate is in a device specific coordinate space; to get the
- * corresponding output screen coordinate, use
- * libinput_event_pointer_get_y_transformed().
+ * Return the current absolute y coordinate of the pointer event, in mm from
+ * the top left corner of the device. To get the corresponding output screen
+ * coordinate, use libinput_event_pointer_get_x_transformed().
*
* For pointer events that are not of type
* LIBINPUT_EVENT_POINTER_MOTION_ABSOLUTE, this function returns 0.
/**
* @ingroup event_touch
*
- * Return the current absolute x coordinate of the touch event.
- *
- * The coordinate is in a device specific coordinate space; to get the
- * corresponding output screen coordinate, use
- * libinput_event_touch_get_x_transformed().
+ * Return the current absolute x coordinate of the touch event, in mm from
+ * the top left corner of the device. To get the corresponding output screen
+ * coordinate, use libinput_event_touch_get_x_transformed().
*
* @note this function should only be called for LIBINPUT_EVENT_TOUCH_DOWN and
* LIBINPUT_EVENT_TOUCH_MOTION.
/**
* @ingroup event_touch
*
- * Return the current absolute y coordinate of the touch event.
- *
- * The coordinate is in a device specific coordinate space; to get the
- * corresponding output screen coordinate, use
- * libinput_event_touch_get_y_transformed().
+ * Return the current absolute y coordinate of the touch event, in mm from
+ * the top left corner of the device. To get the corresponding output screen
+ * coordinate, use libinput_event_touch_get_y_transformed().
*
* For LIBINPUT_EVENT_TOUCH_UP 0 is returned.
*
struct libinput_event_touch *t = libinput_event_get_touch_event(ev);
double x = libinput_event_touch_get_x_transformed(t, screen_width);
double y = libinput_event_touch_get_y_transformed(t, screen_height);
+ double xmm = libinput_event_touch_get_x(t);
+ double ymm = libinput_event_touch_get_y(t);
print_event_time(libinput_event_touch_get_time(t));
- printf("%d (%d) %5.2f/%5.2f\n",
+ printf("%d (%d) %5.2f/%5.2f (%5.2f/%5.2fmm)\n",
libinput_event_touch_get_slot(t),
libinput_event_touch_get_seat_slot(t),
- x, y);
+ x, y,
+ xmm, ymm);
}
static int