diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-09 19:59:03 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-02-10 07:29:33 -0800 |
| commit | 0b83d9932b5b8b93837d9c0683b19e5de5587a43 (patch) | |
| tree | 37446481805bb47a7b5b9d7ecb5ec34fd2cdedc7 /src/layout | |
| parent | 6bd92ab926b53d8da916966798213fcc9b0bf0b2 (diff) | |
| download | niri-0b83d9932b5b8b93837d9c0683b19e5de5587a43.tar.gz niri-0b83d9932b5b8b93837d9c0683b19e5de5587a43.tar.bz2 niri-0b83d9932b5b8b93837d9c0683b19e5de5587a43.zip | |
tab indicator: Use full column height
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/scrolling.rs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 45323ec7..f3916d46 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -3470,6 +3470,30 @@ impl<W: LayoutElement> Column<W> { tile.update_render_elements(is_active, tile_view_rect); } + // We'd like to use the active tile's animated size for the tab indicator, however we need + // to be mindful of the case where the active tile is smaller than some other tile in the + // column. The column assumes the size of the largest tile. + // + // We expect users to mainly resize tabbed columns by width, so matching the animated size + // is more important here. Besides, we always try to resize all windows in a column to the + // same width when possible, and also the animation for going into tabbed mode doesn't move + // tiles horizontally as much. + // + // For height though, it's a different story. First, users probably aren't resizing a + // tabbed column by height. Second, we don't match windows by height, so it's easy to have + // a smaller active tile than the rest of the column, e.g. by adding a fixed-size dialog. + // Then, switching to that dialog and back should ideally keep the tab indicator position + // fixed. Third, the animation for making a column tabbed moves tiles vertically, and using + // the active tile's animated size in this case only works for the topmost tile, and looks + // broken otherwise. + let mut max_height = 0.; + for tile in &self.tiles { + max_height = f64::max(max_height, tile.tile_size().h); + } + + let tile = &self.tiles[active_idx]; + let area_size = Size::from((tile.animated_tile_size().w, max_height)); + let config = self.tab_indicator.config(); let offsets = self.tile_offsets_iter(self.data.iter().copied()); let tabs = zip(&self.tiles, offsets) @@ -3486,8 +3510,6 @@ impl<W: LayoutElement> Column<W> { // many changes to the code for too little benefit (it's mostly invisible anyway). let enabled = self.display_mode == ColumnDisplay::Tabbed && !self.is_fullscreen; - let area_size = self.tiles[active_idx].animated_tile_size(); - self.tab_indicator.update_render_elements( enabled, Rectangle::new(self.tiles_origin(), area_size), |
