toplevel: send 0x0 size until window has been mapped
This commit is contained in:
parent
a254ebe5ed
commit
96fe270413
2 changed files with 31 additions and 22 deletions
|
|
@ -12,7 +12,8 @@ static BUGS: Lazy<AHashMap<&'static str, Bugs>> = Lazy::new(|| {
|
||||||
map.insert(
|
map.insert(
|
||||||
"Alacritty",
|
"Alacritty",
|
||||||
Bugs {
|
Bugs {
|
||||||
min_size: Some((100, 100)),
|
min_width: Some(100),
|
||||||
|
min_height: Some(100),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
@ -25,11 +26,13 @@ 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,
|
min_width: None,
|
||||||
|
min_height: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Default, 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)>,
|
pub min_width: Option<i32>,
|
||||||
|
pub min_height: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ pub struct XdgToplevel {
|
||||||
pub drag: CloneCell<Option<Rc<XdgToplevelDragV1>>>,
|
pub drag: CloneCell<Option<Rc<XdgToplevelDragV1>>>,
|
||||||
is_mapped: Cell<bool>,
|
is_mapped: Cell<bool>,
|
||||||
dialog: CloneCell<Option<Rc<XdgDialogV1>>>,
|
dialog: CloneCell<Option<Rc<XdgDialogV1>>>,
|
||||||
|
extents_set: Cell<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for XdgToplevel {
|
impl Debug for XdgToplevel {
|
||||||
|
|
@ -144,6 +145,7 @@ impl XdgToplevel {
|
||||||
drag: Default::default(),
|
drag: Default::default(),
|
||||||
is_mapped: Cell::new(false),
|
is_mapped: Cell::new(false),
|
||||||
dialog: Default::default(),
|
dialog: Default::default(),
|
||||||
|
extents_set: Cell::new(false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,27 +162,30 @@ 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);
|
if self.extents_set.get() {
|
||||||
height = height.max(1);
|
width = width.max(1);
|
||||||
|
height = height.max(1);
|
||||||
|
}
|
||||||
let bugs = self.bugs.get();
|
let bugs = self.bugs.get();
|
||||||
if let Some((mw, mh)) = bugs.min_size {
|
macro_rules! apply {
|
||||||
width = width.max(mw);
|
($field:expr, $min:ident, $max:ident) => {
|
||||||
height = height.max(mh);
|
if $field != 0 {
|
||||||
}
|
if let Some(min) = bugs.$min {
|
||||||
if bugs.respect_min_max_size {
|
$field = $field.max(min);
|
||||||
if let Some(min) = self.min_width.get() {
|
}
|
||||||
width = width.max(min);
|
if bugs.respect_min_max_size {
|
||||||
}
|
if let Some(min) = self.$min.get() {
|
||||||
if let Some(min) = self.min_height.get() {
|
$field = $field.max(min);
|
||||||
height = height.max(min);
|
}
|
||||||
}
|
if let Some(max) = self.$max.get() {
|
||||||
if let Some(max) = self.max_width.get() {
|
$field = $field.min(max);
|
||||||
width = width.min(max);
|
}
|
||||||
}
|
}
|
||||||
if let Some(max) = self.max_height.get() {
|
}
|
||||||
height = height.min(max);
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
apply!(width, min_width, max_width);
|
||||||
|
apply!(height, min_height, max_height);
|
||||||
self.send_configure(width, height)
|
self.send_configure(width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -582,6 +587,7 @@ impl ToplevelNodeBase for XdgToplevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tl_change_extents_impl(self: Rc<Self>, rect: &Rect) {
|
fn tl_change_extents_impl(self: Rc<Self>, rect: &Rect) {
|
||||||
|
self.extents_set.set(true);
|
||||||
let nw = rect.width();
|
let nw = rect.width();
|
||||||
let nh = rect.height();
|
let nh = rect.height();
|
||||||
let de = self.xdg.absolute_desired_extents.get();
|
let de = self.xdg.absolute_desired_extents.get();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue