pub struct DisplayHandle { /* private fields */ }
Expand description
Implementations§
source§impl DisplayHandle
impl DisplayHandle
sourcepub fn backend_handle(&self) -> Handle
pub fn backend_handle(&self) -> Handle
Returns the underlying Handle
from wayland-backend
.
sourcepub fn insert_client(
&mut self,
stream: UnixStream,
data: Arc<dyn ClientData>,
) -> Result<Client>
pub fn insert_client( &mut self, stream: UnixStream, data: Arc<dyn ClientData>, ) -> Result<Client>
Insert a new client in your Display
This client will be associated with the provided ClientData
, that you can then retrieve from
it via Client::get_data()
, and its requests will be processed by the Display
and your
callbacks.
sourcepub fn get_client(&self, id: ObjectId) -> Result<Client, InvalidId>
pub fn get_client(&self, id: ObjectId) -> Result<Client, InvalidId>
Retrieve the Client
which owns the object represented by the given ID
sourcepub fn create_global<State, I: Resource + 'static, U: Send + Sync + 'static>(
&self,
version: u32,
data: U,
) -> GlobalIdwhere
State: GlobalDispatch<I, U> + 'static,
pub fn create_global<State, I: Resource + 'static, U: Send + Sync + 'static>(
&self,
version: u32,
data: U,
) -> GlobalIdwhere
State: GlobalDispatch<I, U> + 'static,
Create a new protocol global
This global will be advertized to clients through the wl_registry
according to the rules
defined by your GlobalDispatch
implementation for the given interface. Whenever a client
binds this global, the associated GlobalDispatch::bind()
method will be invoked on your
State
.
sourcepub fn disable_global<State: 'static>(&self, id: GlobalId)
pub fn disable_global<State: 'static>(&self, id: GlobalId)
Disable this global
Clients will be notified of the global removal, and it will not be advertized to new clients. However the state associated with this global is not freed, so clients which already know about it can still bind it.
sourcepub fn remove_global<State: 'static>(&self, id: GlobalId)
pub fn remove_global<State: 'static>(&self, id: GlobalId)
Remove this global
Clients will be notified of the global removal if it was not already disabled. The state associated with this global is freed, meaning clients trying to bind it will receive a protocol error.
When removing a global, it is recommended to first disable it using
disable_global()
to allow some time for clients to register that
the global is getting removed, to avoid a race where a client would be killed because it bound a global
at the same as the server decided to remove it. After the global has been disabled for some time (like
a few seconds) it should be safe to actually remove it.
sourcepub fn object_info(&self, id: ObjectId) -> Result<ObjectInfo, InvalidId>
pub fn object_info(&self, id: ObjectId) -> Result<ObjectInfo, InvalidId>
Access the protocol information for a Wayland object
Returns an error if the object is no longer valid.
sourcepub fn send_event<I: Resource>(
&self,
resource: &I,
event: I::Event<'_>,
) -> Result<(), InvalidId>
pub fn send_event<I: Resource>( &self, resource: &I, event: I::Event<'_>, ) -> Result<(), InvalidId>
Send an event to given Wayland object
This is intended to be a low-level method. You can alternatively use the methods on the
type representing your object, or Resource::send_event()
, which may be more convenient.
sourcepub fn post_error<I: Resource>(&self, resource: &I, code: u32, error: String)
pub fn post_error<I: Resource>(&self, resource: &I, code: u32, error: String)
Trigger a protocol error on this object
This is intended to be a low-level method. See Resource::post_error()
, for a more convenient
method.
sourcepub fn get_object_data(
&self,
id: ObjectId,
) -> Result<Arc<dyn Any + Send + Sync + 'static>, InvalidId>
pub fn get_object_data( &self, id: ObjectId, ) -> Result<Arc<dyn Any + Send + Sync + 'static>, InvalidId>
Access the object data associated with this object
This is intended to be a low-level method. See Resource::object_data()
, for a more convenient
method.
sourcepub fn flush_clients(&mut self) -> Result<()>
pub fn flush_clients(&mut self) -> Result<()>
Flush outgoing buffers into their respective sockets.
Trait Implementations§
source§impl Clone for DisplayHandle
impl Clone for DisplayHandle
source§fn clone(&self) -> DisplayHandle
fn clone(&self) -> DisplayHandle
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DisplayHandle
impl Debug for DisplayHandle
Auto Trait Implementations§
impl Freeze for DisplayHandle
impl RefUnwindSafe for DisplayHandle
impl Send for DisplayHandle
impl Sync for DisplayHandle
impl Unpin for DisplayHandle
impl UnwindSafe for DisplayHandle
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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.