Skip to main content

Module pointer

Module pointer 

Source
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§

BackendDeviceKey
An opaque per-device key, derived by the platform layer from the backend’s own device handle (winit’s DeviceId, a Win32 HANDLE, an evdev node).
EventTime
A moment on the input timeline, measured from the tree’s epoch.
PointerAxes
The continuous per-sample axes a device may report beyond position.
PointerId
A process-unique, monotonically increasing pointer identity.
PointerIdAllocator
Mints PointerIds and maps a backend’s reused contact ids onto them.
PointerInfo
Everything that identifies and describes the pointer producing a sample.
PointerSample
One pointer sample as it enters the tree.
ScrollSample
One scroll sample as it enters the tree.

Enums§

CancelReason
Why a pointer interaction was revoked.
PointerPhase
Which end of a pointer’s life a sample sits at.
ScrollPhase
Where a scroll sits in a continuous gesture.
ScrollSource
What produced a scroll.