Initial commit
This commit is contained in:
commit
673af15cfd
13 changed files with 1927 additions and 0 deletions
55
src/main.rs
Normal file
55
src/main.rs
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
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 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())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue