}
}
+int
+evdev_device_get_size(struct evdev_device *device,
+ double *width,
+ double *height)
+{
+ const struct input_absinfo *x, *y;
+
+ x = libevdev_get_abs_info(device->evdev, ABS_X);
+ y = libevdev_get_abs_info(device->evdev, ABS_Y);
+
+ if (!x || !y || !x->resolution || !y->resolution)
+ return -1;
+
+ *width = evdev_convert_to_mm(x, x->maximum);
+ *height = evdev_convert_to_mm(y, y->maximum);
+
+ return 0;
+}
+
void
evdev_device_remove(struct evdev_device *device)
{
evdev_device_has_capability(struct evdev_device *device,
enum libinput_device_capability capability);
+int
+evdev_device_get_size(struct evdev_device *device,
+ double *w,
+ double *h);
+
double
evdev_device_transform_x(struct evdev_device *device,
double x,
capability);
}
+LIBINPUT_EXPORT int
+libinput_device_get_size(struct libinput_device *device,
+ double *width,
+ double *height)
+{
+ return evdev_device_get_size((struct evdev_device *)device,
+ width,
+ height);
+}
+
LIBINPUT_EXPORT struct libinput_event *
libinput_event_device_notify_get_base_event(struct libinput_event_device_notify *event)
{
libinput_device_has_capability(struct libinput_device *device,
enum libinput_device_capability capability);
+/**
+ * @ingroup device
+ *
+ * Get the physical size of a device in mm, where meaningful. This function
+ * only succeeds on devices with the required data, i.e. tablets, touchpads
+ * and touchscreens.
+ *
+ * If this function returns nonzero, width and height are unmodified.
+ *
+ * @param device The device
+ * @param width Set to the width of the device
+ * @param height Set to the height of the device
+ * @return 0 on success, or nonzero otherwise
+ */
+int
+libinput_device_get_size(struct libinput_device *device,
+ double *width,
+ double *height);
+
#ifdef __cplusplus
}
#endif
{
struct libinput_device *dev = libinput_event_get_device(ev);
struct libinput_seat *seat = libinput_device_get_seat(dev);
+ double w, h;
- printf("%s %s\n",
+ printf("%s %s",
libinput_seat_get_physical_name(seat),
libinput_seat_get_logical_name(seat));
+
+ if (libinput_device_get_size(dev, &w, &h) == 0)
+ printf("\tsize %.2f/%.2fmm", w, h);
+
+ printf("\n");
}
static void