mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-03-24 01:34:04 +00:00
Skip event posting for empty slots.
ABS_MT_SLOT comes before any other events. The following order of events is common for protocol B devices (and mtdev): ... EV_SYN ABS_MT_SLOT → posting here means we miss on the position information ABS_MT_POSITION_X ABS_MT_POSITION_Y ABS_MT_SLOT ABS_MT_POSITION_X ABS_MT_POSITION_Y EV_SYN Store the stot state as SLOT_EMPTY after posting an event (i.e. EV_SYN and ABS_MT_SLOT) and then don't post until the next slot/syn event. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
17
src/evdev.c
17
src/evdev.c
@@ -709,6 +709,10 @@ EvdevProcessTouch(InputInfoPtr pInfo)
|
||||
if (pEvdev->cur_slot < 0 || !pEvdev->mt_mask)
|
||||
return;
|
||||
|
||||
/* If the ABS_MT_SLOT is the first event we get after EV_SYN, skip this */
|
||||
if (pEvdev->slot_state == SLOTSTATE_EMPTY)
|
||||
return;
|
||||
|
||||
if (pEvdev->slot_state == SLOTSTATE_CLOSE)
|
||||
type = XI_TouchEnd;
|
||||
else if (pEvdev->slot_state == SLOTSTATE_OPEN)
|
||||
@@ -733,14 +737,19 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
if (ev->code == ABS_MT_SLOT) {
|
||||
EvdevProcessTouch(pInfo);
|
||||
pEvdev->cur_slot = ev->value;
|
||||
} else if (ev->code == ABS_MT_TRACKING_ID) {
|
||||
} else
|
||||
{
|
||||
if (pEvdev->slot_state == SLOTSTATE_EMPTY)
|
||||
pEvdev->slot_state = SLOTSTATE_UPDATE;
|
||||
if (ev->code == ABS_MT_TRACKING_ID) {
|
||||
if (ev->value >= 0)
|
||||
pEvdev->slot_state = SLOTSTATE_OPEN;
|
||||
else
|
||||
pEvdev->slot_state = SLOTSTATE_CLOSE;
|
||||
} else {
|
||||
map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
|
||||
valuator_mask_set(pEvdev->mt_mask, map, ev->value);
|
||||
} else {
|
||||
map = pEvdev->axis_map[ev->code] - pEvdev->num_vals;
|
||||
valuator_mask_set(pEvdev->mt_mask, map, ev->value);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -103,6 +103,7 @@ enum fkeymode {
|
||||
enum SlotState {
|
||||
SLOTSTATE_OPEN = 8,
|
||||
SLOTSTATE_CLOSE,
|
||||
SLOTSTATE_UPDATE,
|
||||
SLOTSTATE_EMPTY,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user