pub struct EguiState { /* private fields */ }Expand description
smithay-egui state object
Implementations§
Source§impl EguiState
impl EguiState
Sourcepub fn context(&self) -> &Context
pub fn context(&self) -> &Context
Retrieve the underlying egui::Context
Sourcepub fn wants_keyboard(&self) -> bool
pub fn wants_keyboard(&self) -> bool
If true, egui is currently listening on text input (e.g. typing text in a TextEdit).
Sourcepub fn wants_pointer(&self) -> bool
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.
Sourcepub fn handle_device_added(&self, device: &impl Device)
pub fn handle_device_added(&self, device: &impl Device)
Pass new input devices to EguiState for internal tracking
Sourcepub fn handle_device_removed(&self, device: &impl Device)
pub fn handle_device_removed(&self, device: &impl Device)
Remove input devices to EguiState for internal tracking
Sourcepub fn handle_keyboard(
&self,
handle: &KeysymHandle<'_>,
pressed: bool,
modifiers: ModifiersState,
)
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].
Sourcepub fn handle_pointer_motion(&self, position: Point<i32, Logical>)
pub fn handle_pointer_motion(&self, position: Point<i32, Logical>)
Pass new pointer coordinates to EguiState
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.
Sourcepub fn handle_pointer_axis(&self, x_amount: f64, y_amount: f64)
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.
Sourcepub fn set_focused(&self, focused: bool)
pub fn set_focused(&self, focused: bool)
Set if this EguiState should consider itself focused
Sourcepub fn render(
&self,
ui: impl FnMut(&Context),
renderer: &mut GlowRenderer,
area: Rectangle<i32, Logical>,
scale: f64,
alpha: f32,
) -> Result<TextureRenderElement<GlesTexture>, GlesError>
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]
uiis your drawing functionrendereris aGlowRendererarealimits the space egui will be using and offsets the resultscaleis the scale egui should render inalphaapplies (additional) transparency to the whole uistart_timeneed to be a fixed point in time before the firstruncall to measure animation-times and the like.modifiersshould be the current state of modifiers pressed on the keyboards.
Sourcepub fn set_zindex(&self, idx: u8)
pub fn set_zindex(&self, idx: u8)
Sets the z_index as reported by SpaceElement::z_index.
The default is RenderZindex::Overlay.
Sourcepub fn last_output(&self) -> Option<PlatformOutput>
pub fn last_output(&self) -> Option<PlatformOutput>
Returns the egui PlatformOutput generated by the last Self::render call
Trait Implementations§
Source§impl<D: SeatHandler> KeyboardTarget<D> for EguiState
impl<D: SeatHandler> KeyboardTarget<D> for EguiState
Source§fn enter(
&self,
_seat: &Seat<D>,
_data: &mut D,
keys: Vec<KeysymHandle<'_>>,
_serial: Serial,
)
fn enter( &self, _seat: &Seat<D>, _data: &mut D, keys: Vec<KeysymHandle<'_>>, _serial: Serial, )
Source§fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial)
fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial)
Source§fn key(
&self,
_seat: &Seat<D>,
_data: &mut D,
key: KeysymHandle<'_>,
state: KeyState,
_serial: Serial,
_time: u32,
)
fn key( &self, _seat: &Seat<D>, _data: &mut D, key: KeysymHandle<'_>, state: KeyState, _serial: Serial, _time: u32, )
Source§fn modifiers(
&self,
_seat: &Seat<D>,
_data: &mut D,
modifiers: ModifiersState,
_serial: Serial,
)
fn modifiers( &self, _seat: &Seat<D>, _data: &mut D, modifiers: ModifiersState, _serial: Serial, )
Source§fn replace(
&self,
replaced: <D as SeatHandler>::KeyboardFocus,
seat: &Seat<D>,
data: &mut D,
keys: Vec<KeysymHandle<'_>>,
modifiers: ModifiersState,
serial: Serial,
)
fn replace( &self, replaced: <D as SeatHandler>::KeyboardFocus, seat: &Seat<D>, data: &mut D, keys: Vec<KeysymHandle<'_>>, modifiers: ModifiersState, serial: Serial, )
Source§impl<D: SeatHandler> PointerTarget<D> for EguiState
impl<D: SeatHandler> PointerTarget<D> for EguiState
Source§fn enter(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)
fn enter(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)
Source§fn motion(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)
fn motion(&self, _seat: &Seat<D>, _data: &mut D, event: &MotionEvent)
Source§fn relative_motion(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &RelativeMotionEvent,
)
fn relative_motion( &self, _seat: &Seat<D>, _data: &mut D, _event: &RelativeMotionEvent, )
Source§fn axis(&self, _seat: &Seat<D>, _data: &mut D, _frame: AxisFrame)
fn axis(&self, _seat: &Seat<D>, _data: &mut D, _frame: AxisFrame)
Source§fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial, _time: u32)
fn leave(&self, _seat: &Seat<D>, _data: &mut D, _serial: Serial, _time: u32)
Source§fn gesture_swipe_begin(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GestureSwipeBeginEvent,
)
fn gesture_swipe_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeBeginEvent, )
Source§fn gesture_swipe_update(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GestureSwipeUpdateEvent,
)
fn gesture_swipe_update( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeUpdateEvent, )
Source§fn gesture_swipe_end(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GestureSwipeEndEvent,
)
fn gesture_swipe_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureSwipeEndEvent, )
Source§fn gesture_pinch_begin(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GesturePinchBeginEvent,
)
fn gesture_pinch_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchBeginEvent, )
Source§fn gesture_pinch_update(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GesturePinchUpdateEvent,
)
fn gesture_pinch_update( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchUpdateEvent, )
Source§fn gesture_pinch_end(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GesturePinchEndEvent,
)
fn gesture_pinch_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GesturePinchEndEvent, )
Source§fn gesture_hold_begin(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GestureHoldBeginEvent,
)
fn gesture_hold_begin( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureHoldBeginEvent, )
Source§fn gesture_hold_end(
&self,
_seat: &Seat<D>,
_data: &mut D,
_event: &GestureHoldEndEvent,
)
fn gesture_hold_end( &self, _seat: &Seat<D>, _data: &mut D, _event: &GestureHoldEndEvent, )
Source§fn replace(
&self,
replaced: <D as SeatHandler>::PointerFocus,
seat: &Seat<D>,
data: &mut D,
event: &MotionEvent,
)
fn replace( &self, replaced: <D as SeatHandler>::PointerFocus, seat: &Seat<D>, data: &mut D, event: &MotionEvent, )
Source§impl SpaceElement for EguiState
Available on crate feature desktop_integration only.
impl SpaceElement for EguiState
desktop_integration only.Source§fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool
fn is_in_input_region(&self, point: &Point<f64, Logical>) -> bool
Source§fn set_activate(&self, _activated: bool)
fn set_activate(&self, _activated: bool)
Source§fn output_enter(&self, _output: &Output, _overlap: Rectangle<i32, Logical>)
fn output_enter(&self, _output: &Output, _overlap: Rectangle<i32, Logical>)
Source§fn output_leave(&self, _output: &Output)
fn output_leave(&self, _output: &Output)
Auto Trait Implementations§
impl Freeze for EguiState
impl !RefUnwindSafe for EguiState
impl Send for EguiState
impl Sync for EguiState
impl Unpin for EguiState
impl UnsafeUnpin for EguiState
impl !UnwindSafe for EguiState
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.