Skip to main content

Module input

Module input 

Source
Expand description

Shared input extension points: what every host runs around an app dispatch, so backends and hosts keep only platform glue.

  • InputInterceptor (X1): pre-dispatch hooks; the first that consumes an event stops it before the app sees it (web key registry and nativeview-tv-web, Skia shell key routing).
  • DefaultAction (X2): runs on an event the app did not consume, with the same shape. The close request is the statically ordered built-in #0 (nativeview_layout::CloseRequestAction); a registered chain follows it (nativeview-tv-web Back → overlay dismissal, HTML CloseWatcher order).
  • PointerGeometry (X3): the box a pointer norm is relative to (laid-out scene, Skia visual rects, Web DOM rects); annotate_pointer_norms fills TARGET_LOCAL_NORM with it.

Hooks live in an InputChain: ordered stably by (InputPriority DESC, registration order ASC), each entry carries an [InputKinds`] mask (cached as a chain-wide union), an empty chain or non-matching kind costs one branch, and dispatch never allocates.

Structs§

InputChain
Hooks ordered stably by (priority DESC, id ASC). Steady-state dispatch never allocates: an empty chain or non-matching event kind exits in O(1) via the cached Self::kinds_mask.
InputHookId
Handle of a registered hook (for InputChain::remove); ids grow with registration order.
InputPriority
Explicit execution priority band for InputChain hooks. Higher values run earlier; hooks with equal priority preserve stable FIFO registration order (ascending InputHookId).

Enums§

Disposition
What a hook did with an event.

Constants§

KEY_DOWN
InputKinds of key hooks.

Traits§

DefaultAction
Post-dispatch hook (X2) for an event the app did not consume; same shape as InputInterceptor.
InputInterceptor
Pre-dispatch hook (X1). cx is the host’s context: the facts only the host knows (Web: DOM target facts; Skia shell: the session it acts on).
PointerGeometry
Geometry pointer norms are relative to (X3).

Functions§

annotate_pointer_norms
Attaches norms in place to every positioned pointer event (PointerDown / Move / Up) that lacks one: one PointerGeometry::local_rect call per such event, none otherwise. When a PointerDown targets an owner subscribed to LayoutEvent::Layout, inserts the owner’s live visual rect immediately ahead of that PointerDown so handlers reading both layout bounds and pointer norms see exact geometry. Allocation-free when no Layout event is inserted.
capture_owner
The one capture-owner walk every host shares: the nearest capture_on_primary_down ancestor-or-self of target, or None when there is none or target lies in a disabled subtree (a disabled ancestor anywhere up to the root disables capture, as :disabled inherits). One O(depth) walk.
has_ancestor_listener
start or an ancestor listens for ev (a bubbling event reaches a listener).
has_direct_listener
id itself listens for ev on the Interaction table.
local_norm
(x, y) normalized to owner’s box in geometry; None without a usable box.
needs_pointer_norms
Whether any pointer event of events still lacks a norm (callers copy a borrowed batch only then).
pointer_norm_owner
The node whose box a pointer event’s norm is relative to: the capture_owner of the target (the control that captures, or already captured, the drag: captured events target that owner, a capturing PointerDown may target a child such as a thumb), else the target itself.

Type Aliases§

DefaultActionChain
Registered DefaultActions.
InputKinds
Per-entry kind mask: the interaction kinds a hook is called for.
InterceptorChain
Registered InputInterceptors.