diff --git a/src/bugs.rs b/src/bugs.rs index 65909357..f0b320c3 100644 --- a/src/bugs.rs +++ b/src/bugs.rs @@ -6,6 +6,14 @@ static BUGS: Lazy> = Lazy::new(|| { "chromium", Bugs { respect_min_max_size: true, + ..Default::default() + }, + ); + map.insert( + "Alacritty", + Bugs { + min_size: Some((100, 100)), + ..Default::default() }, ); map @@ -17,9 +25,11 @@ pub fn get(app_id: &str) -> &'static Bugs { pub static NONE: Bugs = Bugs { respect_min_max_size: false, + min_size: None, }; -#[derive(Debug)] +#[derive(Default, Debug)] pub struct Bugs { pub respect_min_max_size: bool, + pub min_size: Option<(i32, i32)>, } diff --git a/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs b/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs index 271247fb..2fd3cabf 100644 --- a/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs +++ b/src/ifs/wl_surface/xdg_surface/xdg_toplevel.rs @@ -156,7 +156,12 @@ impl XdgToplevel { fn send_configure_checked(&self, mut width: i32, mut height: i32) { width = width.max(1); height = height.max(1); - if self.bugs.get().respect_min_max_size { + let bugs = self.bugs.get(); + if let Some((mw, mh)) = bugs.min_size { + width = width.max(mw); + height = height.max(mh); + } + if bugs.respect_min_max_size { if let Some(min) = self.min_width.get() { width = width.max(min); } @@ -647,7 +652,11 @@ impl ToplevelNodeBase for XdgToplevel { impl XdgSurfaceExt for XdgToplevel { fn initial_configure(self: Rc) -> Result<(), XdgSurfaceError> { let rect = self.xdg.absolute_desired_extents.get(); - self.send_configure(rect.width(), rect.height()); + if rect.is_empty() { + self.send_configure(0, 0); + } else { + self.send_configure_checked(rect.width(), rect.height()); + } Ok(()) }