evdev: Use has_abs only for ABS_X and ABS_Y, introduce has_mt for MT events
We split up has_abs into plain ABS_X/Y and MT events, but this shouldn't introduce any logic changes.
This commit is contained in:
+6
-4
@@ -444,18 +444,17 @@ evdev_configure_device(struct evdev_device *device)
|
|||||||
unsigned long abs_bits[NBITS(ABS_MAX)];
|
unsigned long abs_bits[NBITS(ABS_MAX)];
|
||||||
unsigned long rel_bits[NBITS(REL_MAX)];
|
unsigned long rel_bits[NBITS(REL_MAX)];
|
||||||
unsigned long key_bits[NBITS(KEY_MAX)];
|
unsigned long key_bits[NBITS(KEY_MAX)];
|
||||||
int has_key, has_abs, has_rel;
|
int has_key, has_abs, has_rel, has_mt;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
has_key = 0;
|
has_key = 0;
|
||||||
has_rel = 0;
|
has_rel = 0;
|
||||||
has_abs = 0;
|
has_abs = 0;
|
||||||
|
has_mt = 0;
|
||||||
device->caps = 0;
|
device->caps = 0;
|
||||||
|
|
||||||
ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
|
ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
|
||||||
if (TEST_BIT(ev_bits, EV_ABS)) {
|
if (TEST_BIT(ev_bits, EV_ABS)) {
|
||||||
has_abs = 1;
|
|
||||||
|
|
||||||
ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
|
ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
|
||||||
abs_bits);
|
abs_bits);
|
||||||
|
|
||||||
@@ -473,12 +472,14 @@ evdev_configure_device(struct evdev_device *device)
|
|||||||
device->abs.min_x = absinfo.minimum;
|
device->abs.min_x = absinfo.minimum;
|
||||||
device->abs.max_x = absinfo.maximum;
|
device->abs.max_x = absinfo.maximum;
|
||||||
device->caps |= EVDEV_MOTION_ABS;
|
device->caps |= EVDEV_MOTION_ABS;
|
||||||
|
has_abs = 1;
|
||||||
}
|
}
|
||||||
if (TEST_BIT(abs_bits, ABS_Y)) {
|
if (TEST_BIT(abs_bits, ABS_Y)) {
|
||||||
ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
|
ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
|
||||||
device->abs.min_y = absinfo.minimum;
|
device->abs.min_y = absinfo.minimum;
|
||||||
device->abs.max_y = absinfo.maximum;
|
device->abs.max_y = absinfo.maximum;
|
||||||
device->caps |= EVDEV_MOTION_ABS;
|
device->caps |= EVDEV_MOTION_ABS;
|
||||||
|
has_abs = 1;
|
||||||
}
|
}
|
||||||
/* We only handle the slotted Protocol B in weston.
|
/* We only handle the slotted Protocol B in weston.
|
||||||
Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT
|
Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT
|
||||||
@@ -495,6 +496,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||||||
device->abs.max_y = absinfo.maximum;
|
device->abs.max_y = absinfo.maximum;
|
||||||
device->is_mt = 1;
|
device->is_mt = 1;
|
||||||
device->caps |= EVDEV_TOUCH;
|
device->caps |= EVDEV_TOUCH;
|
||||||
|
has_mt = 1;
|
||||||
|
|
||||||
if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
|
if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
|
||||||
device->mtdev = mtdev_new_open(device->fd);
|
device->mtdev = mtdev_new_open(device->fd);
|
||||||
@@ -524,7 +526,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||||||
key_bits);
|
key_bits);
|
||||||
if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
|
if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
|
||||||
!TEST_BIT(key_bits, BTN_TOOL_PEN) &&
|
!TEST_BIT(key_bits, BTN_TOOL_PEN) &&
|
||||||
has_abs) {
|
(has_abs || has_mt)) {
|
||||||
device->dispatch = evdev_touchpad_create(device);
|
device->dispatch = evdev_touchpad_create(device);
|
||||||
weston_log("input device %s, %s is a touchpad\n",
|
weston_log("input device %s, %s is a touchpad\n",
|
||||||
device->devname, device->devnode);
|
device->devname, device->devnode);
|
||||||
|
|||||||
Reference in New Issue
Block a user