Use intrinsic (buffer) size when geometry is not set

The simplest clients like vkcube do not set geometry, and were left
without decorations
This commit is contained in:
Val Packett 2026-03-19 23:19:40 -03:00
parent 186584398c
commit 36c87d4638
4 changed files with 196 additions and 4 deletions

View file

@ -21,6 +21,7 @@ use crate::{buffer::SimpleBufferPool, globals::Globals, util::Bounds};
#[derive(Default, Debug, Clone, PartialEq)]
struct DecoParams {
has_geometry: bool,
bounds: Bounds,
}
@ -156,6 +157,23 @@ impl Deco {
deco
}
pub fn handle_intrinsic_size(&self, width: i32, height: i32) {
let mut params = self.next_params.borrow_mut();
if params.has_geometry {
return;
}
log::debug!(
"decoration {:?} handling buffer size {width}x{height}",
self.wl_surface
);
params.bounds = Bounds {
x: 0,
y: 0,
width,
height,
};
}
pub fn handle_window_geometry(
&self,
x: i32,
@ -167,7 +185,9 @@ impl Deco {
"decoration {:?} handling geometry {width}x{height} @ {x},{y}",
self.wl_surface
);
self.next_params.borrow_mut().bounds = Bounds {
let mut params = self.next_params.borrow_mut();
params.has_geometry = true;
params.bounds = Bounds {
x,
y,
width,