mirror of
https://gitlab.freedesktop.org/libevdev/libevdev.git
synced 2026-05-07 13:08:05 +02:00
Fix MT slot index handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
a3255d3ec7
commit
8034fdd0d7
1 changed files with 9 additions and 5 deletions
|
|
@ -346,11 +346,13 @@ sync_mt_state(struct libevdev *dev)
|
||||||
struct input_event ev;
|
struct input_event ev;
|
||||||
|
|
||||||
for (i = ABS_MT_MIN; i < ABS_MT_MAX; i++) {
|
for (i = ABS_MT_MIN; i < ABS_MT_MAX; i++) {
|
||||||
|
int idx;
|
||||||
if (i == ABS_MT_SLOT)
|
if (i == ABS_MT_SLOT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mt_state[i].code = i;
|
idx = i - ABS_MT_MIN;
|
||||||
rc = ioctl(dev->fd, EVIOCGMTSLOTS(sizeof(struct mt_state)), &mt_state[i]);
|
mt_state[idx].code = i;
|
||||||
|
rc = ioctl(dev->fd, EVIOCGMTSLOTS(sizeof(struct mt_state)), &mt_state[idx]);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -360,10 +362,12 @@ sync_mt_state(struct libevdev *dev)
|
||||||
init_event(&ev, EV_ABS, ABS_MT_SLOT, i);
|
init_event(&ev, EV_ABS, ABS_MT_SLOT, i);
|
||||||
dev->sync_callback(dev, &ev, dev->userdata);
|
dev->sync_callback(dev, &ev, dev->userdata);
|
||||||
for (j = ABS_MT_MIN; j < ABS_MT_MAX; j++) {
|
for (j = ABS_MT_MIN; j < ABS_MT_MAX; j++) {
|
||||||
if (dev->mt_slot_vals[i][j] != mt_state[j].val[i]) {
|
int jdx = j - ABS_MT_MIN;
|
||||||
init_event(&ev, EV_ABS, j, mt_state[j].val[i]);
|
|
||||||
|
if (dev->mt_slot_vals[i][jdx] != mt_state[jdx].val[i]) {
|
||||||
|
init_event(&ev, EV_ABS, j, mt_state[jdx].val[i]);
|
||||||
dev->sync_callback(dev, &ev, dev->userdata);
|
dev->sync_callback(dev, &ev, dev->userdata);
|
||||||
dev->mt_slot_vals[i][j] = mt_state[j].val[i];
|
dev->mt_slot_vals[i][jdx] = mt_state[jdx].val[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue