Expand description
Turning raw evdev events into InputEvents.
This is a state machine, and it is the part of input handling that is actually difficult. It is kept platform-independent so every case below is a unit test rather than something you discover by dragging a finger across a panel in a workshop.
Three things it gets right that a naive loop does not:
- Frames. evdev delivers a position as separate
REL_XandREL_Yevents terminated bySYN_REPORT. Emitting on each axis produces two moves per physical motion, doubling every drag and breaking every gesture threshold. Nothing is emitted until the frame closes. - Ordering. A click arrives in the same frame as the motion that positioned it. Motion is resolved first, so a button event carries where the pointer actually was, not where it had been.
- Contact identity. Multitouch slots are stateful: a slot keeps reporting
for the same finger until its tracking id goes to
-1, and only the axes that changed are resent.
Structs§
- AbsAxis
- The calibration of one absolute axis.
- RawEvent
- One event as read from
/dev/input/eventN. - Translator
- Accumulates raw events and emits
InputEvents a frame at a time.
Constants§
- MAX_
SLOTS - Contacts tracked at once. Ten fingers is more than any panel this targets.