Skip to main content

FocusTarget

Enum FocusTarget 

Source
pub enum FocusTarget {
    Window(Window),
    Popup(PopupKind),
    LayerSurface(LayerSurface),
    Subsurface(WlSurface, Box<FocusTarget>),
}
Expand description

Input-event target for Smithay’s seat handlers. Smithay requires a concrete type as the “target” of a keyboard / pointer / touch event; FocusTarget bridges that to the concrete Wayland surface behind a window, popup, or layer surface.

Variants§

§

Window(Window)

§

Popup(PopupKind)

§

LayerSurface(LayerSurface)

§

Subsurface(WlSurface, Box<FocusTarget>)

A subsurface under the pointer, which takes the pointer’s events on its own surface (a browser draws its permission and menu bubbles so), with the window, popup, or layer surface it belongs to, which everything but those events goes by: the keyboard, the window policy, a grab’s window.

Implementations§

Source§

impl FocusTarget

Source

pub(crate) fn owner(&self) -> &FocusTarget

The window, popup, or layer surface this target is, or a subsurface belongs to.

Source

fn under_point( self, origin: Point<f64, Logical>, p: Point<f64, Logical>, ) -> (FocusTarget, Point<f64, Logical>)

This target, or the subsurface of its surface tree that takes input at the logical point p where one does, with the origin pointer events there are local to; origin is where this target’s own surface lies. A point the tree takes no input at leaves the target as it is.

Trait Implementations§

Source§

impl Clone for FocusTarget

Source§

fn clone(&self) -> FocusTarget

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FocusTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl DndFocus<AppState> for FocusTarget

Forward drag-and-drop focus events (enter / motion / leave / drop) to the wrapped target’s underlying wl_surface, reusing the WlSurface offer-data type.

Source§

type OfferData<S: Source> = <WlSurface as DndFocus<AppState>>::OfferData<S>

OfferData implementation returned by this target
Source§

fn enter<S: Source>( &self, data: &mut AppState, dh: &DisplayHandle, source: Arc<S>, seat: &Seat<AppState>, location: Point<f64, Logical>, serial: &Serial, ) -> Option<Self::OfferData<S>>

An active Drag’n’Drop operation has entered the client
Source§

fn motion<S: Source>( &self, data: &mut AppState, offer: Option<&mut Self::OfferData<S>>, seat: &Seat<AppState>, location: Point<f64, Logical>, time: InputTime, )

An active Drag’n’Drop operation, which has previously entered the client, has been moved
Source§

fn leave<S: Source>( &self, data: &mut AppState, offer: Option<&mut Self::OfferData<S>>, seat: &Seat<AppState>, )

An active Drag’n’Drop operation, which has previously entered the client, left again.
Source§

fn drop<S: Source>( &self, data: &mut AppState, offer: Option<&mut Self::OfferData<S>>, seat: &Seat<AppState>, )

An active Drag’n’Drop operation, which has previously entered the client, has been dropped.
Source§

impl From<LayerSurface> for FocusTarget

Wrap a layer surface as a focus target.

Source§

fn from(l: DesktopLayerSurface) -> Self

Converts to this type from the input type.
Source§

impl From<PopupKind> for FocusTarget

Wrap a popup as a focus target.

Source§

fn from(p: PopupKind) -> Self

Converts to this type from the input type.
Source§

impl From<Window> for FocusTarget

Wrap a Window as a focus target.

Source§

fn from(w: Window) -> Self

Converts to this type from the input type.
Source§

impl IsAlive for FocusTarget

Liveness of a focus target: true while its underlying window / popup / layer surface is still alive, so dead targets are dropped from focus.

Source§

fn alive(&self) -> bool

Check if object is alive
Source§

impl KeyboardTarget<AppState> for FocusTarget

Forward every keyboard event (enter / leave / key / modifiers) to the wrapped target’s underlying wl_surface, which carries Smithay’s real keyboard-target implementation; a subsurface’s events go to the surface it belongs to, since keyboard focus is a whole window’s.

Source§

fn enter( &self, seat: &Seat<AppState>, data: &mut AppState, keys: Vec<KeysymHandle<'_>>, serial: Serial, )

Keyboard focus of a given seat was assigned to this handler
Source§

fn leave(&self, seat: &Seat<AppState>, data: &mut AppState, serial: Serial)

The keyboard focus of a given seat left this handler
Source§

fn key( &self, seat: &Seat<AppState>, data: &mut AppState, key: KeysymHandle<'_>, state: KeyState, serial: Serial, time: InputTime, )

A key was pressed on a keyboard from a given seat
Source§

fn modifiers( &self, seat: &Seat<AppState>, data: &mut AppState, modifiers: ModifiersState, serial: Serial, )

Hold modifiers were changed on a keyboard from a given seat
§

fn replace( &self, replaced: <D as SeatHandler>::KeyboardFocus, seat: &Seat<D>, data: &mut D, keys: Vec<KeysymHandle<'_>>, modifiers: ModifiersState, serial: Serial, )

Keyboard focus of a given seat moved from another handler to this handler
Source§

impl PartialEq for FocusTarget

Source§

fn eq(&self, other: &FocusTarget) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PointerTarget<AppState> for FocusTarget

Forward every pointer event (motion, buttons, axis, and all swipe / pinch / hold gesture phases) to the wrapped target’s underlying wl_surface.

Source§

fn enter(&self, seat: &Seat<AppState>, data: &mut AppState, event: &MotionEvent)

A pointer of a given seat entered this handler
Source§

fn motion( &self, seat: &Seat<AppState>, data: &mut AppState, event: &MotionEvent, )

A pointer of a given seat moved over this handler
Source§

fn relative_motion( &self, seat: &Seat<AppState>, data: &mut AppState, event: &RelativeMotionEvent, )

A pointer of a given seat that provides relative motion moved over this handler
Source§

fn button( &self, seat: &Seat<AppState>, data: &mut AppState, event: &ButtonEvent, )

A pointer of a given seat clicked a button
Source§

fn axis(&self, seat: &Seat<AppState>, data: &mut AppState, frame: AxisFrame)

A pointer of a given seat scrolled on an axis
Source§

fn frame(&self, seat: &Seat<AppState>, data: &mut AppState)

End of a pointer frame
Source§

fn leave( &self, seat: &Seat<AppState>, data: &mut AppState, serial: Serial, time: InputTime, )

A pointer of a given seat left this handler
Source§

fn gesture_swipe_begin( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GestureSwipeBeginEvent, )

A pointer of a given seat started a swipe gesture
Source§

fn gesture_swipe_update( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GestureSwipeUpdateEvent, )

A pointer of a given seat updated a swipe gesture
Source§

fn gesture_swipe_end( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GestureSwipeEndEvent, )

A pointer of a given seat ended a swipe gesture
Source§

fn gesture_pinch_begin( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GesturePinchBeginEvent, )

A pointer of a given seat started a pinch gesture
Source§

fn gesture_pinch_update( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GesturePinchUpdateEvent, )

A pointer of a given seat updated a pinch gesture
Source§

fn gesture_pinch_end( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GesturePinchEndEvent, )

A pointer of a given seat ended a pinch gesture
Source§

fn gesture_hold_begin( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GestureHoldBeginEvent, )

A pointer of a given seat started a hold gesture
Source§

fn gesture_hold_end( &self, seat: &Seat<AppState>, data: &mut AppState, event: &GestureHoldEndEvent, )

A pointer of a given seat ended a hold gesture
§

fn replace( &self, replaced: <D as SeatHandler>::PointerFocus, seat: &Seat<D>, data: &mut D, event: &MotionEvent, )

A pointer of a given seat moved from another handler to this handler
Source§

impl StructuralPartialEq for FocusTarget

Source§

impl TouchTarget<AppState> for FocusTarget

Forward every touch event (down / up / motion / frame / cancel / shape / orientation) to the wrapped target’s underlying wl_surface.

Source§

fn down(&self, seat: &Seat<AppState>, data: &mut AppState, event: &DownEvent)

A new touch point has appeared on the target. Read more
Source§

fn up(&self, seat: &Seat<AppState>, data: &mut AppState, event: &UpEvent)

The touch point has disappeared. Read more
Source§

fn motion( &self, seat: &Seat<AppState>, data: &mut AppState, event: &MotionEvent, )

A touch point has changed coordinates.
Source§

fn frame(&self, seat: &Seat<AppState>, data: &mut AppState, marker: FrameMarker)

Indicates the end of a set of events that logically belong together. Read more
Source§

fn cancel( &self, seat: &Seat<AppState>, data: &mut AppState, marker: FrameMarker, )

Touch session cancelled. Read more
Source§

fn shape(&self, seat: &Seat<AppState>, data: &mut AppState, event: &ShapeEvent)

Sent when a touch point has changed its shape. Read more
Source§

fn orientation( &self, seat: &Seat<AppState>, data: &mut AppState, event: &OrientationEvent, )

Sent when a touch point has changed its orientation. Read more
Source§

fn last_frame( &self, seat: &Seat<AppState>, data: &mut AppState, ) -> Option<FrameMarker>

Returns last know [FrameMarker]. Read more
Source§

impl WaylandFocus for FocusTarget

Expose the wrapped target’s underlying wl_surface and same-client checks so Smithay can route focus and selection ownership by client.

Source§

fn wl_surface(&self) -> Option<Cow<'_, WlSurface>>

Returns the underlying wl_surface, if any. Read more
Source§

fn same_client_as(&self, object_id: &ObjectId) -> bool

Returns true, if the underlying wayland object originates from the same client connection as the provided ObjectId. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<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