Update bounds of toplevel windows
Browse files at this commit497e52da5933b437e87aea8278d36ed68ae08d59Parent: 994bc641 changed file +15 -4
- src/layout.rs +15 -4
src/layout.rsmodified+15 -4
| @@ -1603,15 +1603,19 @@ impl<W: LayoutElement> Workspace<W> { | ||
| 1603 | 1603 | } |
| 1604 | 1604 | } |
| 1605 | 1605 | |
| 1606 | + fn toplevel_bounds(&self) -> Size<i32, Logical> { | |
| 1607 | + Size::from(( | |
| 1608 | + max(self.working_area.size.w - self.options.gaps * 2, 1), | |
| 1609 | + max(self.working_area.size.h - self.options.gaps * 2, 1), | |
| 1610 | + )) | |
| 1611 | + } | |
| 1612 | + | |
| 1606 | 1613 | pub fn configure_new_window(&self, window: &Window) { |
| 1607 | 1614 | let width = ColumnWidth::default().resolve(&self.options, self.working_area.size.w); |
| 1608 | 1615 | let height = self.working_area.size.h - self.options.gaps * 2; |
| 1609 | 1616 | let size = Size::from((max(width, 1), max(height, 1))); |
| 1610 | 1617 | |
| 1611 | - let bounds = Size::from(( | |
| 1612 | - max(self.working_area.size.w - self.options.gaps * 2, 1), | |
| 1613 | - max(self.working_area.size.h - self.options.gaps * 2, 1), | |
| 1614 | - )); | |
| 1618 | + let bounds = self.toplevel_bounds(); | |
| 1615 | 1619 | |
| 1616 | 1620 | window.toplevel().with_pending_state(|state| { |
| 1617 | 1621 | state.size = Some(size); |
| @@ -2071,10 +2075,17 @@ impl<W: LayoutElement> Workspace<W> { | ||
| 2071 | 2075 | |
| 2072 | 2076 | impl Workspace<Window> { |
| 2073 | 2077 | fn refresh(&self) { |
| 2078 | + let bounds = self.toplevel_bounds(); | |
| 2079 | + | |
| 2074 | 2080 | for (col_idx, col) in self.columns.iter().enumerate() { |
| 2075 | 2081 | for (win_idx, win) in col.windows.iter().enumerate() { |
| 2076 | 2082 | let active = self.active_column_idx == col_idx && col.active_window_idx == win_idx; |
| 2077 | 2083 | win.set_activated(active); |
| 2084 | + | |
| 2085 | + win.toplevel().with_pending_state(|state| { | |
| 2086 | + state.bounds = Some(bounds); | |
| 2087 | + }); | |
| 2088 | + | |
| 2078 | 2089 | win.toplevel().send_pending_configure(); |
| 2079 | 2090 | win.refresh(); |
| 2080 | 2091 | } |