&device->base,
time,
e->code,
- e->value ? LIBINPUT_KEYBOARD_KEY_STATE_PRESSED :
- LIBINPUT_KEYBOARD_KEY_STATE_RELEASED);
+ e->value ? LIBINPUT_KEY_STATE_PRESSED :
+ LIBINPUT_KEY_STATE_RELEASED);
break;
}
}
pointer_notify_axis(
base,
time,
- LIBINPUT_POINTER_AXIS_VERTICAL_SCROLL,
+ LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL,
-1 * e->value * DEFAULT_AXIS_STEP_DISTANCE);
break;
case REL_HWHEEL:
pointer_notify_axis(
base,
time,
- LIBINPUT_POINTER_AXIS_HORIZONTAL_SCROLL,
+ LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL,
e->value * DEFAULT_AXIS_STEP_DISTANCE);
break;
default:
{
struct libevdev *evdev = device->evdev;
const struct input_absinfo *absinfo;
+ struct input_absinfo fixed;
int has_abs, has_rel, has_mt;
int has_button, has_keyboard, has_touch;
struct mt_slot *slots;
if (libevdev_has_event_type(evdev, EV_ABS)) {
if ((absinfo = libevdev_get_abs_info(evdev, ABS_X))) {
+ if (absinfo->resolution == 0) {
+ fixed = *absinfo;
+ fixed.resolution = 1;
+ libevdev_set_abs_info(evdev, ABS_X, &fixed);
+ }
device->abs.absinfo_x = absinfo;
has_abs = 1;
}
if ((absinfo = libevdev_get_abs_info(evdev, ABS_Y))) {
+ if (absinfo->resolution == 0) {
+ fixed = *absinfo;
+ fixed.resolution = 1;
+ libevdev_set_abs_info(evdev, ABS_Y, &fixed);
+ }
device->abs.absinfo_y = absinfo;
has_abs = 1;
}
if (libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_X) &&
libevdev_has_event_code(evdev, EV_ABS, ABS_MT_POSITION_Y)) {
absinfo = libevdev_get_abs_info(evdev, ABS_MT_POSITION_X);
+ if (absinfo->resolution == 0) {
+ fixed = *absinfo;
+ fixed.resolution = 1;
+ libevdev_set_abs_info(evdev,
+ ABS_MT_POSITION_X,
+ &fixed);
+ }
device->abs.absinfo_x = absinfo;
absinfo = libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y);
+ if (absinfo->resolution == 0) {
+ fixed = *absinfo;
+ fixed.resolution = 1;
+ libevdev_set_abs_info(evdev,
+ ABS_MT_POSITION_Y,
+ &fixed);
+ }
device->abs.absinfo_y = absinfo;
device->is_mt = 1;
has_touch = 1;
}
}
+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)
{