Skip to main content

EguiState

Struct EguiState 

Source
pub struct EguiState { /* private fields */ }
Expand description

smithay-egui state object

Implementations§

Source§

impl EguiState

Source

pub fn new(area: Rectangle<i32, Logical>) -> EguiState

Creates a new EguiState

Source

pub fn context(&self) -> &Context

Retrieve the underlying egui::Context

Source

pub fn wants_keyboard(&self) -> bool

If true, egui is currently listening on text input (e.g. typing text in a TextEdit).

Source

pub fn wants_pointer(&self) -> bool

True if egui is currently interested in the pointer (mouse or touch). Could be the pointer is hovering over a Window or the user is dragging a widget. If false, the pointer is outside of any egui area and so you may want to forward it to other clients as usual. Returns false if a drag started outside of egui and then moved over an egui area.

Source

pub fn handle_device_added(&self, device: &impl Device)

Pass new input devices to EguiState for internal tracking

Source

pub fn handle_device_removed(&self, device: &impl Device)

Remove input devices to EguiState for internal tracking

Source

pub fn handle_keyboard( &self, handle: &KeysymHandle<'_>, pressed: bool, modifiers: ModifiersState, )

Pass keyboard events into EguiState.

You do not want to pass in events, egui should not react to, but you need to make sure they add up. So for every pressed event, you want to send a released one.

You likely want to use the filter-closure of [smithay::wayland::seat::KeyboardHandle::input] to optain these values. Use [smithay::wayland::seat::KeysymHandle] and the provided [smithay::wayland::seat::ModifiersState].

Source

pub fn handle_pointer_motion(&self, position: Point<i32, Logical>)

Pass new pointer coordinates to EguiState

Source

pub fn handle_pointer_button(&self, button: MouseButton, pressed: bool)

Pass pointer button presses to EguiState

Note: If you are unsure about which PointerButtonEvents to send to smithay-egui instead of normal clients, check EguiState::wants_pointer to figure out, if there is an egui-element below your pointer.

Source

pub fn handle_pointer_axis(&self, x_amount: f64, y_amount: f64)

Pass a pointer axis scrolling to EguiState

Note: If you are unsure about which PointerAxisEvents to send to smithay-egui instead of normal clients, check EguiState::wants_pointer to figure out, if there is an egui-element below your pointer.

Source

pub fn set_focused(&self, focused: bool)

Set if this EguiState should consider itself focused

Source

pub fn render( &self, ui: impl FnMut(&Context), renderer: &mut GlowRenderer, area: Rectangle<i32, Logical>, scale: f64, alpha: f32, ) -> Result<TextureRenderElement<GlesTexture>, GlesError>

Produce a new frame of egui. Returns a [RenderElement]

  • ui is your drawing function
  • renderer is a GlowRenderer
  • area limits the space egui will be using and offsets the result
  • scale is the scale egui should render in
  • alpha applies (additional) transparency to the whole ui
  • start_time need to be a fixed point in time before the first run call to measure animation-times and the like.
  • modifiers should be the current state of modifiers pressed on the keyboards.
Source

pub fn set_zindex(&self, idx: u8)

Sets the z_index as reported by SpaceElement::z_index.

The default is RenderZindex::Overlay.

Source

pub fn last_output(&self) -> Option<PlatformOutput>

Returns the egui PlatformOutput generated by the last Self::render call

Trait Implementations§

Source§

impl Clone for EguiState

Source§

fn clone(&self) -> EguiState

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 EguiState

Source§

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

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

impl IsAlive for EguiState

Source§

fn alive(&self) -> bool

Check if object is alive
Source§

impl<D: SeatHandler> KeyboardTarget<D> for EguiState

Source§

fn enter( &self, _seat: &Seat<D>, _data: &mut D, keys: Vec<KeysymHandle<'_>>, _serial: Serial, )

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

fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial)

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

fn key( &self, _seat: &Seat<D>, _data: &mut D, key: KeysymHandle<'_>, state: KeyState, _serial: Serial, _time: u32, )

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

fn modifiers( &self, _seat: &Seat<D>, _data: &mut D, modifiers: ModifiersState, _serial: Serial, )

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

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 EguiState

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<D: SeatHandler> PointerTarget<D> for EguiState

Source§

fn enter(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)

A pointer of a given seat entered this handler
Source§

fn motion(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)

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

fn relative_motion( &self, _seat: &Seat<D>, _data: &mut D, _event: &RelativeMotionEvent, )

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

fn button(&self, _seat: &Seat<D>, _data: &mut D, event: &ButtonEvent)

A pointer of a given seat clicked a button
Source§

fn axis(&self, _seat: &Seat<D>, _data: &mut D, _frame: AxisFrame)

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

fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial, _time: u32)

A pointer of a given seat left this handler
Source§

fn frame(&self, _seat: &Seat<D>, _data: &mut D)

End of a pointer frame
Source§

fn gesture_swipe_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeBeginEvent, )

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

fn gesture_swipe_update( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeUpdateEvent, )

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

fn gesture_swipe_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeEndEvent, )

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

fn gesture_pinch_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchBeginEvent, )

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

fn gesture_pinch_update( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchUpdateEvent, )

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

fn gesture_pinch_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchEndEvent, )

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

fn gesture_hold_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureHoldBeginEvent, )

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

fn gesture_hold_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureHoldEndEvent, )

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

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 SpaceElement for EguiState

Available on crate feature desktop_integration only.
Source§

fn bbox(&self) -> Rectangle<i32, Logical>

Returns the bounding box of this element
Source§

fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool

Returns whenever a given point inside this element will be able to receive input
Source§

fn set_activate(&self, _activated: bool)

Set the rendered state to activated, if applicable to this element
Source§

fn output_enter(&self, _output: &Output, _overlap: Rectangle<i32, Logical>)

The element is displayed on a given output. Read more
Source§

fn output_leave(&self, _output: &Output)

The element left a given output
Source§

fn z_index(&self) -> u8

Gets the z-index of this element
Source§

fn geometry(&self) -> Rectangle<i32, Logical>

Returns the geometry of this element. Read more
Source§

fn refresh(&self)

Periodically called to update internal state, if necessary

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> 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
Source§

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

Source§

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.
Source§

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.
Source§

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.
Source§

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.
Source§

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

Source§

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.

Source§

impl<T> Instrument for T

Source§

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

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

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,