Struct smithay_client_toolkit::WaylandSource
source · [−]pub struct WaylandSource { /* private fields */ }
Expand description
An adapter to insert a Wayland EventQueue
into a calloop event loop
This is a struct that implements calloop::EventSource
. It generates an
event whenever events need to be dispatched. At this point your calloop callback
will be given access to the EventQueue
and you should call .dispatch_pending()
and forward its return value, allowing you to handle orphan events as you prefer.
If you don’t use orphan events, the quick_insert
method will directly
insert the source into a provided LoopHandle
with an adapter which will panic
whenever an oprhan event is encountered.
Implementations
sourceimpl WaylandSource
impl WaylandSource
sourcepub fn new(queue: EventQueue) -> WaylandSource
pub fn new(queue: EventQueue) -> WaylandSource
Wrap an EventQueue
as a WaylandSource
.
sourcepub fn quick_insert<Data: 'static>(
self,
handle: LoopHandle<'_, Data>
) -> Result<RegistrationToken, InsertError<WaylandSource>>
pub fn quick_insert<Data: 'static>(
self,
handle: LoopHandle<'_, Data>
) -> Result<RegistrationToken, InsertError<WaylandSource>>
Insert this source into given event loop with an adapter that panics on orphan events
The adapter will pass the event loop’s global shared data as dispatch_data
too all
callbacks.
sourcepub fn queue(&mut self) -> &mut EventQueue
pub fn queue(&mut self) -> &mut EventQueue
Access the underlying event queue
This method can be used if you need to access the underlying EventQueue
while this
WaylandSource
is currently inserted in an event loop.
Note that you should be careful when interacting with it if you invoke methods that
interact with the wayland socket (such as dispatch()
or prepare_read()
). These may
interefere with the proper waking up of this event source in the event loop.
Trait Implementations
sourceimpl Debug for WaylandSource
impl Debug for WaylandSource
sourceimpl EventSource for WaylandSource
impl EventSource for WaylandSource
type Metadata = EventQueue
type Metadata = EventQueue
Some metadata of your event source Read more
sourcefn process_events<F>(
&mut self,
readiness: Readiness,
token: Token,
callback: F
) -> Result<PostAction> where
F: FnMut((), &mut EventQueue) -> Result<u32>,
fn process_events<F>(
&mut self,
readiness: Readiness,
token: Token,
callback: F
) -> Result<PostAction> where
F: FnMut((), &mut EventQueue) -> Result<u32>,
Process any relevant events Read more
sourcefn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn register(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
Register yourself to this poll instance Read more
sourcefn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
fn reregister(
&mut self,
poll: &mut Poll,
token_factory: &mut TokenFactory
) -> Result<()>
Re-register your file descriptors Read more
sourcefn unregister(&mut self, poll: &mut Poll) -> Result<()>
fn unregister(&mut self, poll: &mut Poll) -> Result<()>
Unregister your file descriptors Read more
Auto Trait Implementations
impl !RefUnwindSafe for WaylandSource
impl !Send for WaylandSource
impl !Sync for WaylandSource
impl Unpin for WaylandSource
impl !UnwindSafe for WaylandSource
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more