Skip to main content

Module table

Module table 

Source
Expand description

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.

§Three notions that used to be one

Before this table the tree had a single hovered, a single last_pointer_position and a single pointer_captured_by, and “the pointer” meant all three at once. Multi-touch splits that into three genuinely different questions:

  1. PointerInfo::primary is the W3C Pointer Events Level 3 per-kind flag. Every mouse event is primary, and so is the first touch of a sequence. On a hybrid machine a mouse and a first touch are both primary. It is a property of the sample, decided by whoever produced it, and this table never rewrites it.
  2. PointerTable::primary is Teksilo’s single pointer — the one that backs the legacy singular position accessor (WidgetTree::last_pointer_position). Exactly one live pointer holds the role, a mouse always wins it, and it is a table-level election rather than anything carried on a sample.
  3. PointerTable::hover_owner is the most recent hovering-capable pointer — a mouse, or a pen in proximity (PointerKind::hovers) — and the one WidgetTree::hovered reads.
  4. PointerTable::hover_owner is the most recent hovering-capable pointer — a mouse, or a pen in proximity (PointerKind::hovers).

Hover follows the hover owner, never the primary. Enter/leave, the cursor, tooltip dwell and every on_hover handler are hover-owner-only, and a touch contact is never a hover owner: a finger has no hover state to report, so a contact that wrote hover would make every hover affordance fire on tap and stick there after the lift. Affordances that today rely on hover get their own touch routes; they do not get them by pretending a finger hovers.

§Why a Vec

The live set is at most PointerTable::DEFAULT_CAP entries, so every operation is a linear scan of a handful of elements — cheaper than hashing a PointerId, and it keeps iteration in a stable, oldest-first order.

Reference: docs/touch-and-pen.md.

Structs§

PointerEntry
Everything the tree tracks about one live pointer.
PointerTable
The live pointers, plus the primary and hover-owner elections.