wayland_bridge::seat

Struct InputDispatcher

Source
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, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _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>,

Source§

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>,

Source§

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