Expand description
The pointer vocabulary: who is pointing, when, and with what.
Every input sample that reaches the widget tree is described by this
module’s types. A mouse, a finger and a stylus differ in tuning
(PointerKind, which lives in teksilo-tokens so a token struct can name
it) but not in shape: they all arrive as a PointerSample carrying a
PointerInfo, and they are all timed by one EventTime measured from
one tree epoch.
§Identity
PointerId is minted per press, not per device, by the process-global
PointerIdAllocator. That is deliberate: winit reuses Touch::id
values once a contact lifts, so a table keyed on the raw OS id can attribute
a new contact’s samples to the sequence the previous one left behind. A
fresh id per Down defeats that without needing a generation counter — the
allocator is monotonic, so an id is never handed out twice in one process.
The one exception is PointerId::MOUSE, the stable id every synthesized
mouse event uses. A mouse is singular by construction, so it needs no
per-press identity and legacy call sites can name it without an allocation.
§Time
EventTime is a Duration since the tree’s epoch, never an Instant.
See clock for why that matters and for the one-clock rule.
Reference: docs/touch-and-pen.md.
Modules§
- clock
- The one clock.
- hit_
slop - Hit slop — the miss-only re-attribution of a press to a small target it nearly landed on, and the context every hit test carries.
- table
- The live pointer table: one entry per pointer the tree currently knows about, and the two elected roles that replace the tree’s old singular pointer state.
- touch_
action - Touch-action and pan-claim vocabulary: what a subtree permits a direct pointer to do to it, and who along the ancestor chain wants to pan.
- trace
- Opt-in input tracing.
Structs§
- Backend
Device Key - An opaque per-device key, derived by the platform layer from the backend’s
own device handle (winit’s
DeviceId, a Win32HANDLE, an evdev node). - Event
Time - A moment on the input timeline, measured from the tree’s epoch.
- Pointer
Axes - The continuous per-sample axes a device may report beyond position.
- Pointer
Id - A process-unique, monotonically increasing pointer identity.
- Pointer
IdAllocator - Mints
PointerIds and maps a backend’s reused contact ids onto them. - Pointer
Info - Everything that identifies and describes the pointer producing a sample.
- Pointer
Sample - One pointer sample as it enters the tree.
- Scroll
Sample - One scroll sample as it enters the tree.
Enums§
- Cancel
Reason - Why a pointer interaction was revoked.
- Pointer
Phase - Which end of a pointer’s life a sample sits at.
- Scroll
Phase - Where a scroll sits in a continuous gesture.
- Scroll
Source - What produced a scroll.