diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-01 10:46:52 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-01 10:48:16 +0300 |
| commit | 68776f1cee9cda05755347068604ba066b228a0e (patch) | |
| tree | ec9ed710fb2bb9390661c8f57d5bb5fd84a07f53 /src | |
| parent | a0e2a15c60162e4f0a589fb5f0ce0899bce213b5 (diff) | |
| download | niri-68776f1cee9cda05755347068604ba066b228a0e.tar.gz niri-68776f1cee9cda05755347068604ba066b228a0e.tar.bz2 niri-68776f1cee9cda05755347068604ba066b228a0e.zip | |
layout: Verify that individual tiles don't get sized taller than working area
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/scrolling.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 8649da27..6e56212c 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -3443,6 +3443,11 @@ impl<W: LayoutElement> Column<W> { let mut window_height = height.round().max(1.); if let Some(max) = max_non_auto_window_height { window_height = f64::min(window_height, max); + } else { + // In any case, clamp to the working area height. + let height_left = self.working_area.size.h - self.options.gaps * 2.; + let max = tile.window_height_for_tile_height(height_left).round(); + window_height = f64::min(window_height, max); } WindowHeight::Fixed(tile.tile_height_for_window_height(window_height)) @@ -4080,8 +4085,27 @@ impl<W: LayoutElement> Column<W> { } let requested_size = tile.window().requested_size().unwrap(); - total_height += tile.tile_height_for_window_height(f64::from(requested_size.h)); - total_min_height += f64::max(1., tile.min_size().h); + let requested_tile_height = + tile.tile_height_for_window_height(f64::from(requested_size.h)); + let min_tile_height = f64::max(1., tile.min_size().h); + + if !self.is_fullscreen + && self.scale.round() == self.scale + && self.working_area.size.h.round() == self.working_area.size.h + && self.options.gaps.round() == self.options.gaps + { + let total_height = requested_tile_height + self.options.gaps * 2.; + let total_min_height = min_tile_height + self.options.gaps * 2.; + let max_height = f64::max(total_min_height, self.working_area.size.h); + assert!( + total_height <= max_height, + "each tile in a column mustn't go beyond working area height \ + (tile height {total_height} > max height {max_height})" + ); + } + + total_height += requested_tile_height; + total_min_height += min_tile_height; } if tile_count > 1 |
