Add resize/move via pointer

This commit is contained in:
Val Packett 2026-03-04 22:07:53 -03:00
parent 673af15cfd
commit 20e16ca508
5 changed files with 315 additions and 17 deletions

View file

@ -25,19 +25,25 @@ impl XdgWmBaseHandler for ClientXdgWmBase {
surface: &Rc<WlSurface>,
) {
id.set_handler(ClientXdgSurface {
deco: Rc::new(Deco::new(surface, &self.globals)),
deco: None,
globals: self.globals.clone(),
surface: surface.clone(),
});
slf.send_get_xdg_surface(id, surface);
}
}
struct ClientXdgSurface {
deco: Rc<Deco>,
globals: Rc<Globals>,
surface: Rc<WlSurface>,
deco: Option<Rc<Deco>>,
}
impl XdgSurfaceHandler for ClientXdgSurface {
fn handle_get_toplevel(&mut self, slf: &Rc<XdgSurface>, id: &Rc<XdgToplevel>) {
id.set_handler(ClientXdgToplevel::new(&self.deco));
let deco = Deco::new(&self.surface, id, &self.globals);
id.set_handler(ClientXdgToplevel::new(&deco));
self.deco = Some(deco);
slf.send_get_toplevel(id);
}
@ -58,15 +64,14 @@ impl XdgSurfaceHandler for ClientXdgSurface {
fn handle_set_window_geometry(
&mut self,
slf: &Rc<XdgSurface>,
x: i32,
y: i32,
width: i32,
height: i32,
mut x: i32,
mut y: i32,
mut width: i32,
mut height: i32,
) {
let (x, y, width, height) = self
.deco
.handle_window_geometry(x, y, width, height)
.unwrap();
if let Some(deco) = self.deco.as_ref() {
(x, y, width, height) = deco.handle_window_geometry(x, y, width, height).unwrap();
}
slf.send_set_window_geometry(x, y, width, height);
}