mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
tab indicator: Use full column height
This commit is contained in:
+24
-2
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user