server: Shortcut to access `ClientId` of `Resource`
use wayland_backend::{
protocol::{Interface, Message},
- server::{InvalidId, ObjectId},
+ server::{ClientId, InvalidId, ObjectId},
};
mod client;
@@ -45,6 +45,10 @@ pub trait Resource: Sized {
fn id(&self) -> ObjectId;
+ fn client_id(&self) -> Option<ClientId> {
+ self.handle().upgrade().and_then(|dh| dh.get_client(self.id()).ok())
+ }
+
fn version(&self) -> u32;
fn data<U: 'static>(&self) -> Option<&U>;
