pub struct InputDispatcher {
    pub pointers: ObjectRefSet<Pointer>,
    pub v5_pointers: ObjectRefSet<Pointer>,
    pub relative_pointers: ObjectRefSet<RelativePointer>,
    pub keyboards: ObjectRefSet<Keyboard>,
    pub touches: ObjectRefSet<Touch>,
    pub pointer_focus: Option<ObjectRef<Surface>>,
    pub keyboard_focus: Option<ObjectRef<Surface>>,
    pub keyboard_focus_source: Option<ObjectRef<Surface>>,
    /* private fields */
}

Fields§

§pointers: ObjectRefSet<Pointer>

The set of bound wl_pointer objects for this client.

Note we’re assuming a single wl_seat for now, so these all are pointers associated with that seat.

§v5_pointers: ObjectRefSet<Pointer>§relative_pointers: ObjectRefSet<RelativePointer>

The set of bound zwp_relative_pointer objects for this client.

Note we’re assuming a single wl_seat for now, so these all are relative pointers associated with that seat.

§keyboards: ObjectRefSet<Keyboard>

The set of bound wl_pointer objects for this client.

Note we’re assuming a single wl_seat for now, so these all are keyboards associated with that seat.

§touches: ObjectRefSet<Touch>

The set of bound wl_pointer objects for this client.

Note we’re assuming a single wl_seat for now, so these all are touches associated with that seat.

§pointer_focus: Option<ObjectRef<Surface>>

The current surface that has been advertised to have pointer focus.

§keyboard_focus: Option<ObjectRef<Surface>>

The current surface that has been advertised to have keyboard focus.

§keyboard_focus_source: Option<ObjectRef<Surface>>

The current surface that is the source for incoming keyboard events. This is the surface associated with the view that the native input pipeline has given focus. This is different from the above field as it will not change when we determine that a child view should have focus.

Implementations§

source§

impl InputDispatcher

source

pub fn has_focus(&self, surface_ref: ObjectRef<Surface>) -> bool

Returns true iff the given surface currently has keyboard focus.

source

pub fn clear_focus_on_surface_destroy(&mut self, surface: ObjectRef<Surface>)

Updates focus state in response to a surface being unmapped.

Since a new surface may be created with the same object id as surface, we need to ensure our current focus is cleared so we can send new focus enter events for the new surface. This does not send focus leave events as these are implicit with the surface being destroyed.

This has no effect if the surface being destroyed has no focus.

source§

impl InputDispatcher

source

pub fn new(event_queue: EventQueue) -> Self

source

pub fn handle_key_event( &mut self, source: ObjectRef<Surface>, event: &KeyEvent ) -> Result<(), Error>

source

pub fn send_keymap_event(&mut self, keymap_vmo: Vmo) -> Result<()>

Dispatches a keymap change event to all attached keyboards.

source

pub fn handle_keyboard_focus( &mut self, source: ObjectRef<Surface>, target: ObjectRef<Surface>, focused: bool ) -> Result<(), Error>

source

pub fn maybe_update_keyboard_focus( &mut self, source: ObjectRef<Surface>, new_target: ObjectRef<Surface> ) -> Result<(), Error>

source

pub fn handle_pointer_event( &mut self, surface: ObjectRef<Surface>, timestamp: i64, position: &[f32; 2], pressed_buttons: &Option<Vec<u8>>, relative_motion: &Option<[f32; 2]>, scroll_v: &Option<i64>, scroll_h: &Option<i64> ) -> Result<(), Error>

source

pub fn handle_touch_event( &mut self, surface: ObjectRef<Surface>, timestamp: i64, id: i32, position: &[f32; 2], phase: EventPhase ) -> Result<(), Error>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Encode<Ambiguous1> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> Encode<Ambiguous2> for T

source§

unsafe fn encode( self, _encoder: &mut Encoder<'_>, _offset: usize, _depth: Depth ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

impl<St> WithTag for St

source§

fn tagged<T>(self, tag: T) -> Tagged<T, St>

Produce a new stream from this one which yields item tupled with a constant tag