| <link rel="stylesheet" href="../style.css" /> |
| |
| [TOC] |
| # fuchsia.ui.pointerinjector |
| |
| <div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 7</span></div> |
| |
| ## **PROTOCOLS** |
| |
| ## Device {#Device} |
| *Defined in [fuchsia.ui.pointerinjector/device.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/device.fidl;l=79)* |
| <p>The channel for injecting pointer events into a target. |
| The associated |Config| applies to injected pointer events.</p> |
| <p>A |Device| may <em>inject</em> pointer events into a target in the scene, but the |
| <em>dispatch</em> of pointer events to UI clients within that target's view tree |
| will depend on the dispatch policy and the scene topology.</p> |
| |
| ### Inject {#Device.Inject} |
| |
| <p>Injects events into a target.</p> |
| <p>Batching: The caller is expected to batch-inject all events that share the |
| same timestamp (e.g., multiple finger samples). There may be multiple such |
| batches per injection call.</p> |
| <p>Flow control: The caller is allowed at most one in-flight |Inject| call |
| at at time: subsequent |Inject| calls must wait until the acknowledgment |
| returns. Non-compliance results in channel closure.</p> |
| |
| #### Request {#Device.Inject_Request} |
| |
| <table> |
| <tr><th>Name</th><th>Type</th></tr> |
| <tr> |
| <td><code>events</code></td> |
| <td> |
| <code>vector<<a class='link' href='#Event'>Event</a>>[128]</code> |
| </td> |
| </tr> |
| </table> |
| |
| |
| #### Response {#Device.Inject_Response} |
| |
| <EMPTY> |
| |
| ## Registry {#Registry} |
| *Defined in [fuchsia.ui.pointerinjector/device.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/device.fidl;l=57)* |
| <p>A coordination mechanism to clearly define the <em>injecting</em> of pointer events |
| into the scene (injection policy, injection context, etc), for <em>dispatching</em> |
| pointer events to UI clients (referenced by |fuchsia.ui.views.ViewRef|).</p> |
| <p>NOTE WELL! ONLY COMPONENTS IN THE TRUSTED COMPUTING BASE SHOULD BE GRANTED |
| ACCESS TO THIS PROTOCOL. |
| (1) The injector device acts with the user's authority. UI clients cannot |
| tell the difference between a real user and an injector device. |
| (2) The context is self-specified when registering the injector device. An |
| injector device that gains access to a sensitive context will operate in |
| that scope. |
| (3) The injected events may be arbitrary. An injector device can inject |
| whatever it wants to the clients it can reach.</p> |
| <p>This protocol defines the context and target for an injector |Device|, |
| places a viewport in spatial relation to the target, and connects the |
| |Device| to the viewport. These parameters are set up in the |Config|. A |
| |Device| may <em>inject</em> pointer events on the viewport, but the <em>dispatch</em> of |
| pointer events to UI clients in the target will depend on the dispatch |
| policy and the scene topology.</p> |
| <p>A |Device| operates within a context, and it serves two purposes: |
| (1) Scoping. It confirms the |Device|'s authority to inject pointer events |
| on the specified target. |
| (2) Coordinate system. It provides the reference coordinate system to define |
| the viewport's position and size, relative to the target.</p> |
| <p>Guarantees. A |Device| is directed at a specified target in the scene, and |
| such a target is afforded some guarantees against snooping and interference |
| from UI clients outside the target's view tree ("non-target clients"). |
| Non-target clients never have injected events dispatched to them: a |Device| |
| preserves <em>confidentiality</em> for target clients. Non-target clients never |
| block injected events from reaching the target on injection, or from |
| reaching target clients on dispatch: a |Device| preserves <em>integrity</em> and |
| <em>availability</em> for target clients. However, the |Device| itself is subject |
| to disruption by ancestor views of the target (see connectivity invariant).</p> |
| <p>Note. This protocol, and its policies, are <em>not</em> a sufficient guard against |
| UI redress attacks! The confidentiality, integrity, and availability |
| guarantees apply only with respect to non-target clients. Within a |
| target, UI redress attacks can still happen, between target clients.</p> |
| <p>Connectivity invariant. A |Device| operates in a stable view tree that is |
| connected to the root view. When either the target, or both context and |
| target, are disconnected from the view tree by a UI client, the |Device| |
| channel is closed. If an event stream was in flight, the server dispatches a |
| final CANCEL event following channel closure; this CANCEL event is then |
| propagated according to dispatch policy.</p> |
| |
| ### Register {#Registry.Register} |
| |
| <p>Sets up a context for a |Device|, the target for the |Device|, and |
| directs the |Device| at the target via a viewport, positioned in the |
| context. These parameters are specified in a |Config|.</p> |
| <p>If |config| is invalid (e.g., missing important data), the |Device| |
| request will be denied: the channel will be closed.</p> |
| <p>The return event tells the caller that (1) the server has processed the |
| call, and (2) the |Device| is connected.</p> |
| |
| #### Request {#Registry.Register_Request} |
| |
| <table> |
| <tr><th>Name</th><th>Type</th></tr> |
| <tr> |
| <td><code>config</code></td> |
| <td> |
| <code><a class='link' href='#Config'>Config</a></code> |
| </td> |
| </tr> |
| <tr> |
| <td><code>injector</code></td> |
| <td> |
| <code>server_end<<a class='link' href='#Device'>Device</a>></code> |
| </td> |
| </tr> |
| </table> |
| |
| |
| #### Response {#Registry.Register_Response} |
| |
| <EMPTY> |
| |
| |
| |
| ## **ENUMS** |
| |
| ### DeviceType [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#DeviceType data-text="DeviceType"} |
| Type: <code>uint32</code> |
| |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=85)* |
| <p>A characterization of a device that issues pointer event streams.</p> |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Description</th></tr> |
| <tr id="DeviceType.TOUCH"> |
| <td><h3 id="DeviceType.TOUCH" class="add-link hide-from-toc">TOUCH</h3></td> |
| <td><code>1</code></td> |
| <td><p>A device intended for manipulation by direct contact over its surface.</p> |
| </td> |
| </tr> |
| <tr id="DeviceType.MOUSE"> |
| <td><h3 id="DeviceType.MOUSE" class="add-link hide-from-toc">MOUSE</h3></td> |
| <td><code>2</code></td> |
| <td><p>A device intended for manipulation by precise movement over a surface.</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### DispatchPolicy [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#DispatchPolicy data-text="DispatchPolicy"} |
| Type: <code>uint32</code> |
| |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=182)* |
| <p>A specification of the UI clients that may have injected events dispatched |
| to them in an |Target|. One is specified in |Config|.</p> |
| <p>A useful concept is "latching", where one or more clients may start |
| receiving the pointer event stream, prior to assignment of stream ownership. |
| After ownership is assigned (e.g., through a gesture disambiguation |
| protocol), non-owning clients have their latch terminated -- they stop |
| receiving the pointer event stream.</p> |
| <ul> |
| <li>A client's latch does not itself confer stream ownership (receiving the |
| entire pointer event stream); gesture disambiguation or device termination |
| may prematurely end the stream dispatched to that client.</li> |
| <li>It's possible for a client to latch while hidden from the user (i.e., |
| manipulate a surface that is invisible to the user), where the occluding |
| surface is owned by a client outside of |Target|. Conversely, these |
| occluding clients cannot latch, because latched clients must be in |
| |Target|'s view tree.</li> |
| </ul> |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Description</th></tr> |
| <tr id="DispatchPolicy.EXCLUSIVE_TARGET"> |
| <td><h3 id="DispatchPolicy.EXCLUSIVE_TARGET" class="add-link hide-from-toc">EXCLUSIVE_TARGET</h3></td> |
| <td><code>1</code></td> |
| <td><p>A single client latches onto a pointer event stream, where:</p> |
| <ul> |
| <li>the pointer event stream starts within the viewport rectangle,</li> |
| <li>the latch happens on the ADD phase of the pointer event stream,</li> |
| <li>the client is the |Target| itself. |
| Ownership is assigned immediately to the client.</li> |
| </ul> |
| <p>Note: This policy guarantees confidentiality, integrity, and |
| availability of dispatch to the client, but by itself, does <em>not</em> |
| confer immunity against UI redress attacks.</p> |
| </td> |
| </tr> |
| <tr id="DispatchPolicy.TOP_HIT_AND_ANCESTORS_IN_TARGET"> |
| <td><h3 id="DispatchPolicy.TOP_HIT_AND_ANCESTORS_IN_TARGET" class="add-link hide-from-toc">TOP_HIT_AND_ANCESTORS_IN_TARGET</h3></td> |
| <td><code>2</code></td> |
| <td><p>Multiple clients may latch onto a pointer stream, where:</p> |
| <ul> |
| <li>the pointer stream starts within the viewport rectangle,</li> |
| <li>a hit test is performed on the ADD phase of the pointer event stream, |
| which returns the top-most surface (in paint order) in the |Target|'s |
| view tree,</li> |
| <li>the top-most surface's client latches onto the pointer stream,</li> |
| <li>the client's ancestors in the |Target|'s view tree also latch onto the |
| pointer stream.</li> |
| </ul> |
| <p>With multiple latches, a pointer stream is dispatched in parallel to |
| each latched client, until ownership is assigned via gesture |
| disambiguation. The owner client will continue to receive the pointer |
| stream, and non-owners will receive a final CANCEL event for the stream.</p> |
| <p>Note: It's possible for no clients to latch, if the hit test fails to |
| hit any surface in any sub-view of |Target|. |
| Note: Each client will have its own copy of the viewport, placed |
| accordingly in its own coordinate system.</p> |
| </td> |
| </tr> |
| <tr id="DispatchPolicy.MOUSE_HOVER_AND_LATCH_IN_TARGET"> |
| <td><h3 id="DispatchPolicy.MOUSE_HOVER_AND_LATCH_IN_TARGET" class="add-link hide-from-toc">MOUSE_HOVER_AND_LATCH_IN_TARGET</h3></td> |
| <td><code>3</code></td> |
| <td><p>The top hit client in the |Target|'s view tree receives hover events when |
| a cursor is positioned over it, unless the mouse is latched to a specific |
| client.</p> |
| <p>A mouse initiates a latch via button down, and until the release of that |
| latch, mouse events are delivered to that latched client; other clients |
| do not receive hover events in the latch duration.</p> |
| <p>Note: It's possible for no client to latch, if the hit test fails to |
| hit any surface in any sub-view of |Target|. |
| Note: Each client will have its own copy of the viewport, placed |
| accordingly in its own coordinate system.</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### EventPhase [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#EventPhase data-text="EventPhase"} |
| Type: <code>uint32</code> |
| |
| *Defined in [fuchsia.ui.pointerinjector/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/event.fidl;l=13)* |
| <p>The possible states of a pointer event stream's state machine.</p> |
| <p>A typical pointer will move through this state machine: |
| ADD - CHANGE* - REMOVE</p> |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Description</th></tr> |
| <tr id="EventPhase.ADD"> |
| <td><h3 id="EventPhase.ADD" class="add-link hide-from-toc">ADD</h3></td> |
| <td><code>1</code></td> |
| <td><p>The device has started tracking the pointer.</p> |
| </td> |
| </tr> |
| <tr id="EventPhase.CHANGE"> |
| <td><h3 id="EventPhase.CHANGE" class="add-link hide-from-toc">CHANGE</h3></td> |
| <td><code>2</code></td> |
| <td><p>The device has reported an update to the pointer state.</p> |
| </td> |
| </tr> |
| <tr id="EventPhase.REMOVE"> |
| <td><h3 id="EventPhase.REMOVE" class="add-link hide-from-toc">REMOVE</h3></td> |
| <td><code>3</code></td> |
| <td><p>The device has stopped tracking the pointer.</p> |
| </td> |
| </tr> |
| <tr id="EventPhase.CANCEL"> |
| <td><h3 id="EventPhase.CANCEL" class="add-link hide-from-toc">CANCEL</h3></td> |
| <td><code>4</code></td> |
| <td><p>The event stream is no longer available.</p> |
| </td> |
| </tr> |
| </table> |
| |
| |
| ## **TABLES** |
| |
| ### Config [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#Config data-text="Config"} |
| |
| |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=28)* |
| <p>A specification for an injector |Device|.</p> |
| <p>All fields required.</p> |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="Config.device_id"> |
| <td><h3 id="Config.device_id" class="add-link hide-from-toc">1</h3></td> |
| <td><code>device_id</code></td> |
| <td> |
| <code>uint32</code> |
| </td> |
| <td><p>An identifier for the pointer device that issues pointer event streams.</p> |
| </td> |
| </tr> |
| <tr id="Config.device_type"> |
| <td><h3 id="Config.device_type" class="add-link hide-from-toc">2</h3></td> |
| <td><code>device_type</code></td> |
| <td> |
| <code><a class='link' href='#DeviceType'>DeviceType</a></code> |
| </td> |
| <td><p>A characterization of the pointer device.</p> |
| </td> |
| </tr> |
| <tr id="Config.context"> |
| <td><h3 id="Config.context" class="add-link hide-from-toc">3</h3></td> |
| <td><code>context</code></td> |
| <td> |
| <code><a class='link' href='#Context'>Context</a></code> |
| </td> |
| <td><p>The scope and coordinate system of the injector |Device|.</p> |
| <p>Note: To avoid circular injection scenarios, |context| must be a |
| strict ancestor of |target|.</p> |
| </td> |
| </tr> |
| <tr id="Config.target"> |
| <td><h3 id="Config.target" class="add-link hide-from-toc">4</h3></td> |
| <td><code>target</code></td> |
| <td> |
| <code><a class='link' href='#Target'>Target</a></code> |
| </td> |
| <td><p>The region where dispatch is attempted for injected events.</p> |
| <p>Note: To avoid circular injection scenarios, |target| must be a strict |
| descendant of |context|.</p> |
| </td> |
| </tr> |
| <tr id="Config.viewport"> |
| <td><h3 id="Config.viewport" class="add-link hide-from-toc">5</h3></td> |
| <td><code>viewport</code></td> |
| <td> |
| <code><a class='link' href='#Viewport'>Viewport</a></code> |
| </td> |
| <td><p>The initial viewport for injected events. Subsequent modifications to |
| the viewport can also be sent synchronously with injected events.</p> |
| </td> |
| </tr> |
| <tr id="Config.dispatch_policy"> |
| <td><h3 id="Config.dispatch_policy" class="add-link hide-from-toc">6</h3></td> |
| <td><code>dispatch_policy</code></td> |
| <td> |
| <code><a class='link' href='#DispatchPolicy'>DispatchPolicy</a></code> |
| </td> |
| <td><p>A specification of the UI clients in |target| that may have injected |
| events dispatched to them.</p> |
| <p>For example, if |dispatch_policy| is |EXCLUSIVE|, then only |target| may |
| have injected events dispatched to it, regardless of other factors, such |
| as surface occlusion by clients inside and outside of |target|.</p> |
| </td> |
| </tr> |
| <tr id="Config.relative_motion_range"> |
| <td><h3 id="Config.relative_motion_range" class="add-link hide-from-toc">10</h3></td> |
| <td><code>relative_motion_range</code></td> |
| <td> |
| <code><a class='link' href='#RelativeMotionRange'>RelativeMotionRange</a></code> |
| </td> |
| <td><p>Range of X and Y motion by a mouse device.</p> |
| </td> |
| </tr> |
| <tr id="Config.scroll_v_range"> |
| <td><h3 id="Config.scroll_v_range" class="add-link hide-from-toc">7</h3></td> |
| <td><code>scroll_v_range</code></td> |
| <td> |
| <code><a class='link' href='../fuchsia.input.report/'>fuchsia.input.report</a>/<a class='link' href='../fuchsia.input.report/#Axis'>Axis</a></code> |
| </td> |
| <td><p>Range of vertical scroll values issued by the device.</p> |
| </td> |
| </tr> |
| <tr id="Config.scroll_h_range"> |
| <td><h3 id="Config.scroll_h_range" class="add-link hide-from-toc">8</h3></td> |
| <td><code>scroll_h_range</code></td> |
| <td> |
| <code><a class='link' href='../fuchsia.input.report/'>fuchsia.input.report</a>/<a class='link' href='../fuchsia.input.report/#Axis'>Axis</a></code> |
| </td> |
| <td><p>Range of horizontal scroll values issued by the device.</p> |
| </td> |
| </tr> |
| <tr id="Config.buttons"> |
| <td><h3 id="Config.buttons" class="add-link hide-from-toc">9</h3></td> |
| <td><code>buttons</code></td> |
| <td> |
| <code>vector<uint8>[32]</code> |
| </td> |
| <td><p>Mouse button identifiers issued by the device, in priority order.</p> |
| <p>The priority order of mouse buttons is a policy choice enacted by the injector. |
| This priority order is conveyed verbatim to UI clients via |
| <a class='link' href='#fuchsia.ui.pointer.MouseDeviceInfo.buttons'>fuchsia.ui.pointer.MouseDeviceInfo.buttons</a>, so button priority is shared consistently |
| between multiple UI clients. For example, to swap the left-side (0x1) and right-side (0x2) |
| physical buttons from their traditional roles of primary and secondary mouse buttons, the |
| injector can specify [0x2, 0x1, ... ] in this <a class='link' href='#buttons'>buttons</a> vector.</p> |
| <p>Note that preserving the physical button ID is also a policy choice. If preserved, a |
| discerning UI client can distinguish between the ground truth (which physical button was |
| pressed) versus the desired interpretation (what priority does that physical button have, on |
| the current system).</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### Event {#Event data-text="Event"} |
| |
| |
| *Defined in [fuchsia.ui.pointerinjector/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/event.fidl;l=85)* |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="Event.timestamp"> |
| <td><h3 id="Event.timestamp" class="add-link hide-from-toc">1</h3></td> |
| <td><code>timestamp</code></td> |
| <td> |
| <code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#time'>time</a></code> |
| </td> |
| <td><p>The time when this event was observed.</p> |
| <p>Required.</p> |
| </td> |
| </tr> |
| <tr id="Event.data"> |
| <td><h3 id="Event.data" class="add-link hide-from-toc">2</h3></td> |
| <td><code>data</code></td> |
| <td> |
| <code><a class='link' href='#Data'>Data</a></code> |
| </td> |
| <td><p>The event's data.</p> |
| <p>Required.</p> |
| </td> |
| </tr> |
| <tr id="Event.trace_flow_id"> |
| <td><h3 id="Event.trace_flow_id" class="add-link hide-from-toc">3</h3></td> |
| <td><code>trace_flow_id</code></td> |
| <td> |
| <code>uint64</code> |
| </td> |
| <td><p>An identifier to correlate this event's send/receive occurrence across |
| component boundaries or abstraction layers.</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### PointerSample {#PointerSample data-text="PointerSample"} |
| |
| |
| *Defined in [fuchsia.ui.pointerinjector/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/event.fidl;l=33)* |
| <p>A description of each sampled data point for a pointer device.</p> |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="PointerSample.pointer_id"> |
| <td><h3 id="PointerSample.pointer_id" class="add-link hide-from-toc">1</h3></td> |
| <td><code>pointer_id</code></td> |
| <td> |
| <code>uint32</code> |
| </td> |
| <td><p>An identifier of the pointer that issued this event. |
| It is unique only to a specific pointer device.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.phase"> |
| <td><h3 id="PointerSample.phase" class="add-link hide-from-toc">2</h3></td> |
| <td><code>phase</code></td> |
| <td> |
| <code><a class='link' href='#EventPhase'>EventPhase</a></code> |
| </td> |
| <td><p>The state of this event in the pointer event stream's state machine.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.position_in_viewport"> |
| <td><h3 id="PointerSample.position_in_viewport" class="add-link hide-from-toc">3</h3></td> |
| <td><code>position_in_viewport</code></td> |
| <td> |
| <code><a class='link' href='#Point2'>Point2</a></code> |
| </td> |
| <td><p>The position of this event, in the viewport's coordinate system.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.relative_motion"> |
| <td><h3 id="PointerSample.relative_motion" class="add-link hide-from-toc">7</h3></td> |
| <td><code>relative_motion</code></td> |
| <td> |
| <code><a class='link' href='#RelativeMotion'>RelativeMotion</a></code> |
| </td> |
| <td><p>The movement of a mouse, independent of the viewport's coordinate |
| system.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.scroll_v"> |
| <td><h3 id="PointerSample.scroll_v" class="add-link hide-from-toc">4</h3></td> |
| <td><code>scroll_v</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td><p>Relative vertical scrolling displacement by detent.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.scroll_h"> |
| <td><h3 id="PointerSample.scroll_h" class="add-link hide-from-toc">5</h3></td> |
| <td><code>scroll_h</code></td> |
| <td> |
| <code>int64</code> |
| </td> |
| <td><p>Relative horizontal scrolling displacement by detent.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.scroll_v_physical_pixel"> |
| <td><h3 id="PointerSample.scroll_v_physical_pixel" class="add-link hide-from-toc">8</h3></td> |
| <td><code>scroll_v_physical_pixel</code></td> |
| <td> |
| <code>float64</code> |
| </td> |
| <td><p>Recommended vertical scrolling displacement by physical pixel, it is |
| computed with accelerator, detent / mm to pixel ratio, etc.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.scroll_h_physical_pixel"> |
| <td><h3 id="PointerSample.scroll_h_physical_pixel" class="add-link hide-from-toc">9</h3></td> |
| <td><code>scroll_h_physical_pixel</code></td> |
| <td> |
| <code>float64</code> |
| </td> |
| <td><p>Recommended horizontal scrolling displacement by physical pixel, it |
| is computed with accelerator, detent / mm to pixel ratio, etc.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.is_precision_scroll"> |
| <td><h3 id="PointerSample.is_precision_scroll" class="add-link hide-from-toc">10</h3></td> |
| <td><code>is_precision_scroll</code></td> |
| <td> |
| <code>bool</code> |
| </td> |
| <td><p>Indicated if the scroll event is from a precision scroll device (HI_RES |
| mouse or touchpad). Clients may want to play interpolation animations |
| on non precision scroll device for smooth scrolling.</p> |
| </td> |
| </tr> |
| <tr id="PointerSample.pressed_buttons"> |
| <td><h3 id="PointerSample.pressed_buttons" class="add-link hide-from-toc">6</h3></td> |
| <td><code>pressed_buttons</code></td> |
| <td> |
| <code>vector<uint8>[32]</code> |
| </td> |
| <td><p>Identifiers of currently pressed buttons.</p> |
| </td> |
| </tr> |
| </table> |
| |
| ### Viewport {#Viewport data-text="Viewport"} |
| |
| |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=148)* |
| <p>A rectangular region that directs injected events into a target.</p> |
| <p>The viewport relates a pointer's position across multiple independent |
| coordinate systems: the context, the viewport, and the dispatch clients. |
| Intuitively, the viewport is how a pointer's position is mapped to an |
| interactive part of the scene.</p> |
| <p>A matrix is used to relate the viewport coordinate system to the context |
| coordinate system. A pair of extents defines the viewport's size in the |
| viewport coordinate system. Together, they define the viewport's placement |
| in the context coordinate system.</p> |
| <p>The viewport coordinate system is used to convey a pointer's coordinates in |
| a scale-invariant way to dispatch clients, so that pointer movement can be |
| interpreted correctly under effects like magnification. The context defines |
| the viewport's minimal and maximal extents in the viewport coordinate |
| system.</p> |
| <ul> |
| <li>The boundary of the viewport, a rectangle, is axis aligned with the |
| viewport coordinate system; however it may otherwise be freely positioned |
| ("float") within it: there is translation and scaling, but no rotation.</li> |
| <li>Floating gives the injector some choice in how to convey coordinates, such |
| as in Vulkan NDC, or in display pixel coordinates.</li> |
| <li>The viewport rectangle defines a latch region used in dispatch (described |
| below).</li> |
| </ul> |
| <p>A dispatch client receives a pointer's coordinates in the viewport |
| coordinate system, along with a matrix to convert coordinates from the |
| viewport coordinate system to the dispatch client's coordinate system.</p> |
| <p>All fields required.</p> |
| <p>TODO(fxbug.dev/81800): Rename Viewport, it is used in Flatland.</p> |
| |
| <table> |
| <tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr> |
| <tr id="Viewport.extents"> |
| <td><h3 id="Viewport.extents" class="add-link hide-from-toc">1</h3></td> |
| <td><code>extents</code></td> |
| <td> |
| <code><a class='link' href='#Extents'>Extents</a></code> |
| </td> |
| <td><p>The viewport's minimal and maximal extents in the viewport coordinate |
| system.</p> |
| </td> |
| </tr> |
| <tr id="Viewport.viewport_to_context_transform"> |
| <td><h3 id="Viewport.viewport_to_context_transform" class="add-link hide-from-toc">2</h3></td> |
| <td><code>viewport_to_context_transform</code></td> |
| <td> |
| <code><a class='link' href='#Mat3'>Mat3</a></code> |
| </td> |
| <td><p>A transformation matrix that describes how to map the viewport |
| coordinate system to the context coordinate system.</p> |
| <p>This transform, together with |extents|, defines the viewport's |
| placement in the context coordinate system.</p> |
| <p>This transform must be an invertible matrix (i.e., has a non-zero |
| determinant), which guarantees it describes a bijection between the |
| viewport coordinate system and the context coordinate system. A |
| non-invertible matrix is rejected.</p> |
| </td> |
| </tr> |
| </table> |
| |
| |
| ## **UNIONS** |
| |
| ### Context [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#Context data-text="Context"} |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=100)* |
| <p>The region from which injection is attempted for injected events. As the |
| context, it serves two purposes: |
| (1) Scoping. It confirms the |Device|'s authority to inject pointer events |
| on the specified target. Specifically, the context must be a view-tree |
| ancestor of the target. |
| (2) Coordinate System. It provides the reference coordinate system to define |
| the viewport's position and size, relative to the target.</p> |
| <table> |
| <tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr> |
| <tr id="Context.view"> |
| <td><h3 id="Context.view" class="add-link hide-from-toc">1</h3></td> |
| <td><code>view</code></td> |
| <td> |
| <code><a class='link' href='../fuchsia.ui.views/'>fuchsia.ui.views</a>/<a class='link' href='../fuchsia.ui.views/#ViewRef'>ViewRef</a></code> |
| </td> |
| <td><p>A Scenic view from which injection is attempted for injected events.</p> |
| <ul> |
| <li>This view must be connected to the scene graph for injection.</li> |
| <li>Injected events are confined to this view and its sub-views.</li> |
| </ul> |
| </td> |
| </tr> |
| </table> |
| |
| ### Data [flexible](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#Data data-text="Data"} |
| *Defined in [fuchsia.ui.pointerinjector/event.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/event.fidl;l=73)* |
| <p>A selection of FIFO data sent over the channel. |
| Each data may have a different issuance policy.</p> |
| <table> |
| <tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr> |
| <tr id="Data.viewport"> |
| <td><h3 id="Data.viewport" class="add-link hide-from-toc">1</h3></td> |
| <td><code>viewport</code></td> |
| <td> |
| <code><a class='link' href='#Viewport'>Viewport</a></code> |
| </td> |
| <td><p>The parameters of the viewport, sufficient for a client to correctly |
| interpret the position and scale of pointer events dispatched to it.</p> |
| <ul> |
| <li>It is issued on every change to the viewport.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr id="Data.pointer_sample"> |
| <td><h3 id="Data.pointer_sample" class="add-link hide-from-toc">2</h3></td> |
| <td><code>pointer_sample</code></td> |
| <td> |
| <code><a class='link' href='#PointerSample'>PointerSample</a></code> |
| </td> |
| <td><p>A description of each sampled data point in a pointer event stream.</p> |
| <ul> |
| <li>It is issued on every sample in the pointer event stream.</li> |
| </ul> |
| </td> |
| </tr> |
| </table> |
| |
| ### Target [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#Target data-text="Target"} |
| *Defined in [fuchsia.ui.pointerinjector/config.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=109)* |
| <p>The region in which dispatch is attempted for injected events. |
| The particular dispatch policy is specified in |Config|.</p> |
| <table> |
| <tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr> |
| <tr id="Target.view"> |
| <td><h3 id="Target.view" class="add-link hide-from-toc">1</h3></td> |
| <td><code>view</code></td> |
| <td> |
| <code><a class='link' href='../fuchsia.ui.views/'>fuchsia.ui.views</a>/<a class='link' href='../fuchsia.ui.views/#ViewRef'>ViewRef</a></code> |
| </td> |
| <td><p>A Scenic view in which dispatch is attempted for injected events.</p> |
| <ul> |
| <li>This view must be connected to the scene graph for dispatch.</li> |
| <li>Injected events are confined to this view and its sub-views.</li> |
| </ul> |
| </td> |
| </tr> |
| </table> |
| |
| |
| |
| ## **CONSTANTS** |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Type</th><th>Description</th></tr> |
| <tr id="MAX_INJECT"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/device.fidl;l=6">MAX_INJECT</a></td> |
| <td> |
| <code>128</code> |
| </td> |
| <td><code>uint32</code></td> |
| <td></td> |
| </tr> |
| </table> |
| |
| ## **TYPE ALIASES** |
| |
| <table> |
| <tr><th>Name</th><th>Value</th><th>Description</th></tr> |
| <tr id="Extents"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=15">Extents</a></td> |
| <td> |
| <code>array</code>[<code>2</code>]</td> |
| <td><p>A floating-point pair of points, representing minimal and maximal extents.</p> |
| <ul> |
| <li>The values are placed in (minimal, maximal) order.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr id="Mat3"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=19">Mat3</a></td> |
| <td> |
| <code>array</code>[<code>9</code>]</td> |
| <td><p>A floating-point 3x3 matrix.</p> |
| <ul> |
| <li>The values are placed in column-major order.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr id="Point2"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=11">Point2</a></td> |
| <td> |
| <code>array</code>[<code>2</code>]</td> |
| <td><p>A floating-point two-dimensional point.</p> |
| <ul> |
| <li>The values are placed in (x, y) order.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr id="RelativeMotion"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/event.fidl;l=30">RelativeMotion</a></td> |
| <td> |
| <code>array</code>[<code>2</code>]</td> |
| <td><p>The relative motion performed by a mouse device.</p> |
| <ul> |
| <li>The valid range is defined in <a class='link' href='#Config.RelativeMotionRange'>Config.RelativeMotionRange</a>.</li> |
| <li>The values are placed in (x, y) order.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr id="RelativeMotionRange"> |
| <td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.ui.pointerinjector/config.fidl;l=23">RelativeMotionRange</a></td> |
| <td> |
| <code>array</code>[<code>2</code>]</td> |
| <td><p>The valid values of relative motion for a mouse device.</p> |
| <ul> |
| <li>The ranges are placed in (x, y) order.</li> |
| </ul> |
| </td> |
| </tr> |
| </table> |