2026-03-04 01:53:44 -03:00
|
|
|
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;
|
2026-03-04 22:07:53 -03:00
|
|
|
mod seat;
|
2026-03-04 01:53:44 -03:00
|
|
|
mod util;
|
|
|
|
|
mod xdg;
|
|
|
|
|
|
|
|
|
|
struct ClientWlRegistry {
|
|
|
|
|
globals: Rc<Globals>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl ClientWlRegistry {
|
|
|
|
|
fn new(globals: &Rc<Globals>) -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
globals: globals.clone(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl WlRegistryHandler for ClientWlRegistry {
|
|
|
|
|
fn handle_bind(&mut self, slf: &Rc<WlRegistry>, name: u32, id: Rc<dyn Object>) {
|
|
|
|
|
match id.interface() {
|
|
|
|
|
XdgWmBase::INTERFACE => id
|
|
|
|
|
.downcast::<XdgWmBase>()
|
|
|
|
|
.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())
|
|
|
|
|
}
|