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 andnativeview-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-webBack → 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_normsfillsTARGET_LOCAL_NORMwith 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§
- Input
Chain - 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 cachedSelf::kinds_mask. - Input
Hook Id - Handle of a registered hook (for
InputChain::remove); ids grow with registration order. - Input
Priority - Explicit execution priority band for
InputChainhooks. Higher values run earlier; hooks with equal priority preserve stable FIFO registration order (ascendingInputHookId).
Enums§
- Disposition
- What a hook did with an event.
Constants§
- KEY_
DOWN InputKindsof key hooks.
Traits§
- Default
Action - Post-dispatch hook (X2) for an event the app did not consume; same shape as
InputInterceptor. - Input
Interceptor - Pre-dispatch hook (X1).
cxis the host’s context: the facts only the host knows (Web: DOM target facts; Skia shell: the session it acts on). - Pointer
Geometry - 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: onePointerGeometry::local_rectcall per such event, none otherwise. When aPointerDowntargets an owner subscribed toLayoutEvent::Layout, inserts the owner’s live visual rect immediately ahead of thatPointerDownso handlers reading both layout bounds and pointer norms see exact geometry. Allocation-free when noLayoutevent is inserted. - capture_
owner - The one capture-owner walk every host shares: the nearest
capture_on_primary_downancestor-or-self oftarget, orNonewhen there is none ortargetlies in a disabled subtree (a disabled ancestor anywhere up to the root disables capture, as:disabledinherits). OneO(depth)walk. - has_
ancestor_ listener startor an ancestor listens forev(a bubbling event reaches a listener).- has_
direct_ listener iditself listens forevon theInteractiontable.- local_
norm (x, y)normalized toowner’s box ingeometry;Nonewithout a usable box.- needs_
pointer_ norms - Whether any pointer event of
eventsstill 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_ownerof the target (the control that captures, or already captured, the drag: captured events target that owner, a capturingPointerDownmay target a child such as a thumb), else the target itself.
Type Aliases§
- Default
Action Chain - Registered
DefaultActions. - Input
Kinds - Per-entry kind mask: the interaction kinds a hook is called for.
- Interceptor
Chain - Registered
InputInterceptors.