Drop hardcoded MAX_SLOTS in favour of pre-allocated memory
authorPeter Hutterer <peter.hutterer@who-t.net>
Tue, 1 Apr 2014 05:32:46 +0000 (15:32 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 3 Apr 2014 03:30:49 +0000 (13:30 +1000)
commitf8fba5b5884bfb62225b9bde991dfdbec92ad751
tree06edf1ee8870c5335c81feb00002543c04dbdfe3
parentca082d5fcbe26edf13632a16a7a4d09f680296f6
Drop hardcoded MAX_SLOTS in favour of pre-allocated memory

We can't allocate in sync_mt_state since it may be called in the signal
handler. So pre-allocate based on the device's number of slots, store that in
the libevdev struct and use it for the sync process.

This fixes a remaining bug with the handling of ABS_MT_TRACKING_ID. If a
device had > MAX_SLOTS and a slot above that limit would start or stop during
a SYN_DROPPED event, the slot would not be synced, and a subsequent touch in
that slot may double-terminate or double-open a touchpoint in the client.
For the effects of that see

commit 41334b5b40cd5456f5f584b55d8888aaafa1f26e
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Thu Mar 6 11:54:00 2014 +1000

    If the tracking ID changes during SYN_DROPPED, terminate the touch first

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
libevdev/libevdev-int.h
libevdev/libevdev.c
libevdev/libevdev.h
test/test-libevdev-events.c