1
0
Fork 0
forked from wry/wry

wayland: add bug entry for alacritty

This commit is contained in:
Julian Orth 2024-03-29 15:33:06 +01:00
parent a65921ca80
commit 7661e011c0
2 changed files with 22 additions and 3 deletions

View file

@ -6,6 +6,14 @@ static BUGS: Lazy<AHashMap<&'static str, Bugs>> = Lazy::new(|| {
"chromium", "chromium",
Bugs { Bugs {
respect_min_max_size: true, respect_min_max_size: true,
..Default::default()
},
);
map.insert(
"Alacritty",
Bugs {
min_size: Some((100, 100)),
..Default::default()
}, },
); );
map map
@ -17,9 +25,11 @@ pub fn get(app_id: &str) -> &'static Bugs {
pub static NONE: Bugs = Bugs { pub static NONE: Bugs = Bugs {
respect_min_max_size: false, respect_min_max_size: false,
min_size: None,
}; };
#[derive(Debug)] #[derive(Default, Debug)]
pub struct Bugs { pub struct Bugs {
pub respect_min_max_size: bool, pub respect_min_max_size: bool,
pub min_size: Option<(i32, i32)>,
} }

View file

@ -156,7 +156,12 @@ impl XdgToplevel {
fn send_configure_checked(&self, mut width: i32, mut height: i32) { fn send_configure_checked(&self, mut width: i32, mut height: i32) {
width = width.max(1); width = width.max(1);
height = height.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() { if let Some(min) = self.min_width.get() {
width = width.max(min); width = width.max(min);
} }
@ -647,7 +652,11 @@ impl ToplevelNodeBase for XdgToplevel {
impl XdgSurfaceExt for XdgToplevel { impl XdgSurfaceExt for XdgToplevel {
fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> { fn initial_configure(self: Rc<Self>) -> Result<(), XdgSurfaceError> {
let rect = self.xdg.absolute_desired_extents.get(); 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(()) Ok(())
} }