use std::{process::Command, rc::Rc}; use wl_proxy::{ baseline::Baseline, object::{ConcreteObject, Object, ObjectCoreApi, ObjectRcUtils}, protocols::{ wayland::wl_registry::{WlRegistry, WlRegistryHandler}, xdg_shell::xdg_wm_base::XdgWmBase, }, simple::{SimpleCommandExt, SimpleProxy}, }; use crate::globals::Globals; mod buffer; mod deco; mod globals; mod seat; mod util; mod xdg; struct ClientWlRegistry { globals: Rc, } impl ClientWlRegistry { fn new(globals: &Rc) -> Self { Self { globals: globals.clone(), } } } impl WlRegistryHandler for ClientWlRegistry { fn handle_bind(&mut self, slf: &Rc, name: u32, id: Rc) { match id.interface() { XdgWmBase::INTERFACE => id .downcast::() .set_handler(xdg::ClientXdgWmBase { globals: self.globals.clone(), }), _ => {} } slf.send_bind(name, id); } } fn main() -> eyre::Result<()> { env_logger::builder().parse_default_env().init(); let server = SimpleProxy::new(Baseline::V2)?; Command::new("gtk4-demo") .with_wayland_display(server.display()) .spawn_and_forward_exit_code()?; Err(server.run(|| globals::ClientWlDisplay::new()).into()) }