From 497e52da5933b437e87aea8278d36ed68ae08d59 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 7 Oct 2023 17:50:45 +0400 Subject: Update bounds of toplevel windows --- src/layout.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/layout.rs b/src/layout.rs index 144bdf02..ba362814 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1603,15 +1603,19 @@ impl Workspace { } } + fn toplevel_bounds(&self) -> Size { + Size::from(( + max(self.working_area.size.w - self.options.gaps * 2, 1), + max(self.working_area.size.h - self.options.gaps * 2, 1), + )) + } + pub fn configure_new_window(&self, window: &Window) { let width = ColumnWidth::default().resolve(&self.options, self.working_area.size.w); let height = self.working_area.size.h - self.options.gaps * 2; let size = Size::from((max(width, 1), max(height, 1))); - let bounds = Size::from(( - max(self.working_area.size.w - self.options.gaps * 2, 1), - max(self.working_area.size.h - self.options.gaps * 2, 1), - )); + let bounds = self.toplevel_bounds(); window.toplevel().with_pending_state(|state| { state.size = Some(size); @@ -2071,10 +2075,17 @@ impl Workspace { impl Workspace { fn refresh(&self) { + let bounds = self.toplevel_bounds(); + for (col_idx, col) in self.columns.iter().enumerate() { for (win_idx, win) in col.windows.iter().enumerate() { let active = self.active_column_idx == col_idx && col.active_window_idx == win_idx; win.set_activated(active); + + win.toplevel().with_pending_state(|state| { + state.bounds = Some(bounds); + }); + win.toplevel().send_pending_configure(); win.refresh(); } -- cgit