mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-01-11 19:10:19 +01:00
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:
parent
606706f87f
commit
7226e8c368
1 changed files with 6 additions and 4 deletions
10
src/evdev.c
10
src/evdev.c
|
|
@ -473,18 +473,17 @@ evdev_configure_device(struct evdev_device *device)
|
|||
unsigned long abs_bits[NBITS(ABS_MAX)];
|
||||
unsigned long rel_bits[NBITS(REL_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;
|
||||
|
||||
has_key = 0;
|
||||
has_rel = 0;
|
||||
has_abs = 0;
|
||||
has_mt = 0;
|
||||
device->caps = 0;
|
||||
|
||||
ioctl(device->fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits);
|
||||
if (TEST_BIT(ev_bits, EV_ABS)) {
|
||||
has_abs = 1;
|
||||
|
||||
ioctl(device->fd, EVIOCGBIT(EV_ABS, sizeof(abs_bits)),
|
||||
abs_bits);
|
||||
|
||||
|
|
@ -501,12 +500,14 @@ evdev_configure_device(struct evdev_device *device)
|
|||
device->abs.min_x = absinfo.minimum;
|
||||
device->abs.max_x = absinfo.maximum;
|
||||
device->caps |= EVDEV_MOTION_ABS;
|
||||
has_abs = 1;
|
||||
}
|
||||
if (TEST_BIT(abs_bits, ABS_Y)) {
|
||||
ioctl(device->fd, EVIOCGABS(ABS_Y), &absinfo);
|
||||
device->abs.min_y = absinfo.minimum;
|
||||
device->abs.max_y = absinfo.maximum;
|
||||
device->caps |= EVDEV_MOTION_ABS;
|
||||
has_abs = 1;
|
||||
}
|
||||
/* We only handle the slotted Protocol B in weston.
|
||||
Devices with ABS_MT_POSITION_* but not ABS_MT_SLOT
|
||||
|
|
@ -523,6 +524,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||
device->abs.max_y = absinfo.maximum;
|
||||
device->is_mt = 1;
|
||||
device->caps |= EVDEV_TOUCH;
|
||||
has_mt = 1;
|
||||
|
||||
if (!TEST_BIT(abs_bits, ABS_MT_SLOT)) {
|
||||
device->mtdev = mtdev_new_open(device->fd);
|
||||
|
|
@ -551,7 +553,7 @@ evdev_configure_device(struct evdev_device *device)
|
|||
key_bits);
|
||||
if (TEST_BIT(key_bits, BTN_TOOL_FINGER) &&
|
||||
!TEST_BIT(key_bits, BTN_TOOL_PEN) &&
|
||||
has_abs) {
|
||||
(has_abs || has_mt)) {
|
||||
device->dispatch = evdev_touchpad_create(device);
|
||||
}
|
||||
for (i = KEY_ESC; i < KEY_MAX; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue