Clamp single tiled window height

Now that we have floating for taller-than-screen windows.
This commit is contained in:
Ivan Molodetskikh
2024-12-29 22:22:55 +03:00
parent 44bf45794e
commit 6cb5135f34
+5 -8
View File
@@ -3553,8 +3553,7 @@ impl<W: LayoutElement> Column<W> {
} }
}; };
// If there are multiple windows in a column, clamp the height according to other windows' // Clamp the height according to other windows' min sizes, or simply to working area height.
// min sizes.
let min_height_taken = self let min_height_taken = self
.tiles .tiles
.iter() .iter()
@@ -3562,12 +3561,10 @@ impl<W: LayoutElement> Column<W> {
.filter(|(idx, _)| *idx != tile_idx) .filter(|(idx, _)| *idx != tile_idx)
.map(|(_, tile)| f64::max(1., tile.min_size().h) + self.options.gaps) .map(|(_, tile)| f64::max(1., tile.min_size().h) + self.options.gaps)
.sum::<f64>(); .sum::<f64>();
if min_height_taken > 0. { let height_left =
let height_left = self.working_area.size.h - self.options.gaps - min_height_taken - self.options.gaps;
self.working_area.size.h - self.options.gaps - min_height_taken - self.options.gaps; let height_left = f64::max(1., tile.window_height_for_tile_height(height_left));
let height_left = f64::max(1., tile.window_height_for_tile_height(height_left)); window_height = f64::min(height_left, window_height);
window_height = f64::min(height_left, window_height);
}
// Clamp it against the window height constraints. // Clamp it against the window height constraints.
let win = &self.tiles[tile_idx].window(); let win = &self.tiles[tile_idx].window();