container: predict window size for initial configure
previously, windows were allowed determine their own initial dimensions, then fed a resize afterwards. we now look up the parent container and try to predict + report the real size up front to minimise visual artifacting on spawn/destroy
This commit is contained in:
parent
fdf8569952
commit
f94d6c644c
3 changed files with 50 additions and 1 deletions
22
src/state.rs
22
src/state.rs
|
|
@ -1597,6 +1597,28 @@ impl State {
|
|||
self.config.get()?.initial_tile_state(data)
|
||||
}
|
||||
|
||||
pub fn predict_tiled_body_size(&self) -> Option<(i32, i32)> {
|
||||
let seat = self.seat_queue.last();
|
||||
let ws = self.ensure_map_workspace(seat.as_deref());
|
||||
let pos = ws.position.get();
|
||||
if pos.is_empty() {
|
||||
return None;
|
||||
}
|
||||
if let Some(c) = ws.container.get() {
|
||||
let la = c.clone().tl_last_active_child();
|
||||
let target = la
|
||||
.tl_data()
|
||||
.parent
|
||||
.get()
|
||||
.and_then(|n| n.node_into_container())
|
||||
.unwrap_or(c);
|
||||
Some(target.predict_child_body_size())
|
||||
} else {
|
||||
let tpuh = self.theme.title_plus_underline_height();
|
||||
Some((pos.width(), (pos.height() - tpuh).max(0)))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn update_capabilities(
|
||||
&self,
|
||||
data: &Rc<Client>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue