diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-25 11:46:04 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-25 11:46:04 +0300 |
| commit | f86a9bed1a821f8c818c9085f7fdd021020dfd56 (patch) | |
| tree | 65e4aca5fbc829910dc706e3b72b0f9cfcddafa3 /src/layout | |
| parent | cfa87d508ee496eab20e0dde6cd2478aa92822f3 (diff) | |
| download | niri-f86a9bed1a821f8c818c9085f7fdd021020dfd56.tar.gz niri-f86a9bed1a821f8c818c9085f7fdd021020dfd56.tar.bz2 niri-f86a9bed1a821f8c818c9085f7fdd021020dfd56.zip | |
layout: Break out early on min size
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/workspace.rs | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 8ba65692..c948bdf2 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -3168,12 +3168,11 @@ impl<W: LayoutElement> Column<W> { // // However, most max height uses are for fixed-size dialogs, where min height == max_height. // This case is separately handled above. - while auto_tiles_left > 0 { + 'outer: while auto_tiles_left > 0 { // Wayland requires us to round the requested size for a window to integer logical // pixels, therefore we compute the remaining auto height dynamically. let mut height_left_2 = height_left; let mut total_weight_2 = total_weight; - let mut unsatisfied_min = false; for ((h, tile), min_size) in zip(zip(&mut heights, &self.tiles), &min_size) { let weight = match *h { WindowHeight::Auto { weight } => weight, @@ -3191,24 +3190,26 @@ impl<W: LayoutElement> Column<W> { height_left -= auto; total_weight -= weight; auto_tiles_left -= 1; - unsatisfied_min = true; - } else { - auto = tile.tile_height_for_window_height( - tile.window_height_for_tile_height(auto).round().max(1.), - ); + + // If a min height was unsatisfied, then we allocate the tile more than the + // auto height, which means that the remaining auto tiles now have less height + // to work with, and the loop must run again. + // + // If we keep going in this loop and break out later, we may allocate less + // height to the subsequent tiles than would be available next iteration and + // potentially trip their min height check earlier than necessary, leading to + // visible snapping. + continue 'outer; } + auto = tile.tile_height_for_window_height( + tile.window_height_for_tile_height(auto).round().max(1.), + ); + height_left_2 -= auto; total_weight_2 -= weight; } - // If some min height was unsatisfied, then we allocated the tile more than the auto - // height, which means that the remaining auto tiles now have less height to work - // with, and the loop must run again. - if unsatisfied_min { - continue; - } - // All min heights were satisfied, fill them in. for (h, tile) in zip(&mut heights, &self.tiles) { let weight = match *h { |
