#[repr(u32)]pub enum DispatchPolicy {
ExclusiveTarget = 1,
TopHitAndAncestorsInTarget = 2,
MouseHoverAndLatchInTarget = 3,
}
Expand description
A specification of the UI clients that may have injected events dispatched to them in an |Target|. One is specified in |Config|.
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.
- 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.
- 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.
Variants§
ExclusiveTarget = 1
A single client latches onto a pointer event stream, where:
- the pointer event stream starts within the viewport rectangle,
- the latch happens on the ADD phase of the pointer event stream,
- the client is the |Target| itself. Ownership is assigned immediately to the client.
Note: This policy guarantees confidentiality, integrity, and availability of dispatch to the client, but by itself, does not confer immunity against UI redress attacks.
TopHitAndAncestorsInTarget = 2
Multiple clients may latch onto a pointer stream, where:
- the pointer stream starts within the viewport rectangle,
- 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,
- the top-most surface’s client latches onto the pointer stream,
- the client’s ancestors in the |Target|’s view tree also latch onto the pointer stream.
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.
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.
MouseHoverAndLatchInTarget = 3
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.
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.
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.
Implementations§
Source§impl DispatchPolicy
impl DispatchPolicy
pub fn from_primitive(prim: u32) -> Option<Self>
pub const fn into_primitive(self) -> u32
pub fn is_unknown(&self) -> bool
is_unknown
Trait Implementations§
Source§impl Clone for DispatchPolicy
impl Clone for DispatchPolicy
Source§fn clone(&self) -> DispatchPolicy
fn clone(&self) -> DispatchPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DispatchPolicy
impl Debug for DispatchPolicy
Source§impl<D: ResourceDialect> Decode<DispatchPolicy, D> for DispatchPolicy
impl<D: ResourceDialect> Decode<DispatchPolicy, D> for DispatchPolicy
Source§impl<D: ResourceDialect> Encode<DispatchPolicy, D> for DispatchPolicy
impl<D: ResourceDialect> Encode<DispatchPolicy, D> for DispatchPolicy
Source§impl Hash for DispatchPolicy
impl Hash for DispatchPolicy
Source§impl Ord for DispatchPolicy
impl Ord for DispatchPolicy
Source§fn cmp(&self, other: &DispatchPolicy) -> Ordering
fn cmp(&self, other: &DispatchPolicy) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for DispatchPolicy
impl PartialEq for DispatchPolicy
Source§impl PartialOrd for DispatchPolicy
impl PartialOrd for DispatchPolicy
Source§impl TypeMarker for DispatchPolicy
impl TypeMarker for DispatchPolicy
Source§type Owned = DispatchPolicy
type Owned = DispatchPolicy
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.Source§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read moreSource§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for DispatchPolicy
impl ValueTypeMarker for DispatchPolicy
Source§type Borrowed<'a> = DispatchPolicy
type Borrowed<'a> = DispatchPolicy
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more