1
0
Fork 0
forked from wry/wry

wayland: add a generic wayland client

This commit is contained in:
Julian Orth 2022-07-30 13:16:58 +02:00
parent 163adbd893
commit 2512470231
34 changed files with 2627 additions and 1 deletions

View file

@ -0,0 +1,37 @@
use {
crate::{
wire::{wl_compositor::CreateSurface, WlCompositorId},
wl_usr::{usr_ifs::usr_wl_surface::UsrWlSurface, usr_object::UsrObject, UsrCon},
},
std::rc::Rc,
};
pub struct UsrWlCompositor {
pub id: WlCompositorId,
pub con: Rc<UsrCon>,
}
impl UsrWlCompositor {
pub fn create_surface(&self) -> Rc<UsrWlSurface> {
let sfc = Rc::new(UsrWlSurface {
id: self.con.id(),
con: self.con.clone(),
});
self.con.request(CreateSurface {
self_id: self.id,
id: sfc.id,
});
self.con.add_object(sfc.clone());
sfc
}
}
usr_object_base! {
UsrWlCompositor, WlCompositor;
}
impl UsrObject for UsrWlCompositor {
fn destroy(&self) {
// nothing
}
}