pub struct PointerId {
pub source: PointerSource,
pub slot: u32,
}Expand description
The identity of one pointer contact: which device it comes from and which slot on that device.
It rides beside a PointerEvent, never inside it: a shell hands a
touch contact to the root as InputEvent::PointerContact, the root
unwraps it, and the widget receiving the plain InputEvent::Pointer reads
the identity from EventCtx::pointer_id. A bare InputEvent::Pointer
from a shell means PointerId::MOUSE.
A slot is the shell’s own numbering of simultaneous contacts on one source:
slot 0 is the gesture’s first contact, and a slot is free again once its
contact ended. The mouse only ever has slot 0.
§Multi-contact contract
Applied at the root (crate::app::RenderRoot::event):
- (a) With no live pointer capture, a slot-
0contact is hit-tested exactly like a plainInputEvent::Pointer— the same overlay, hover, focus and blur bookkeeping — and a capture taken on itsDownlatches this id as the gesture’s claimant. - (b) With no live capture, a contact on slot
1or above is dropped at the root. Additional contacts exist only inside a captured gesture. - (c) While a capture is live, the claimant’s own events take the
captured path as usual. An event with any other id reaches the captor —
and only the captor: the containers above it on that path forward it
without running their own handling — only if the captor opted in with
EventCtx::capture_contactson its capturingDown; otherwise the root drops it. Only the claimant’sUp/Cancelends the capture: another contact’sUp/Cancelnever releases it, whether it came from a touch while a mouse holds the capture or the other way round. A container that takes the gesture over from the captor (EventCtx::release_captured_child) ends the opt-in, and the other contacts are dropped from then on.
See InputEvent::PointerContact for the full contract.
Fields§
§source: PointerSourceThe device the contact comes from.
slot: u32The contact’s slot on that device (0 for the first contact).
Implementations§
Trait Implementations§
impl Copy for PointerId
impl Eq for PointerId
impl StructuralPartialEq for PointerId
Auto Trait Implementations§
impl Freeze for PointerId
impl RefUnwindSafe for PointerId
impl Send for PointerId
impl Sync for PointerId
impl Unpin for PointerId
impl UnsafeUnpin for PointerId
impl UnwindSafe for PointerId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.