From a0d002c318b79b09a9ba4b4cbeea772fa3b7de33 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 4 Sep 2025 08:16:47 +0300 Subject: layout/tile: Animate un/fullscreen resize This turned out to require quite a few changes. We keep track of the tile resize animation progress separately now, in order to provide a resizing black fullscreen backdrop for non-resizable windows. The window is always rendered in the middle of the tile, which once again aids with the resizing black fullscreen backdrop. The backdrop itself will fade in from transparency so that it's less jarring. The resize animation now keeps track of the fullscreen progress to deal with the case where an unfullscreen resize is interrupted by another non-fullscreen resize. In this case, the fullscreen progress continues animating to avoid sudden disappearance of the fullscreen backdrop. Some things like border visibility switch to this fullscreen progress once again to avoid jarring appearance/disappearance. The border radius animates in accordance with the fullscreen progress to match the visuals. --- src/layout/scrolling.rs | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'src/layout/scrolling.rs') diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 04788bca..78a072ff 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -2778,11 +2778,10 @@ impl ScrollingSpace { } pub fn set_fullscreen(&mut self, window: &W::Id, is_fullscreen: bool) -> bool { - let (mut col_idx, tile_idx) = self + let mut col_idx = self .columns .iter() - .enumerate() - .find_map(|(col_idx, col)| col.position(window).map(|tile_idx| (col_idx, tile_idx))) + .position(|col| col.contains(window)) .unwrap(); if is_fullscreen == self.columns[col_idx].is_pending_fullscreen { @@ -2796,21 +2795,7 @@ impl ScrollingSpace { if is_fullscreen && (col.tiles.len() > 1 && !is_tabbed) { // This wasn't the only window in its column; extract it into a separate column. - let activate = self.active_column_idx == col_idx && col.active_tile_idx == tile_idx; - - let removed = self.remove_tile_by_idx(col_idx, tile_idx, Transaction::new(), None); - // Create a column manually to disable the resize animation. - let column = Column::new_with_tile( - removed.tile, - self.view_size, - self.working_area, - self.scale, - removed.width, - removed.is_full_width, - false, - ); - self.add_column(Some(col_idx + 1), column, activate, None); - + self.consume_or_expel_window_right(Some(window)); col_idx += 1; col = &mut self.columns[col_idx]; } @@ -4881,7 +4866,7 @@ impl Column { } self.is_pending_fullscreen = is_fullscreen; - self.update_tile_sizes(false); + self.update_tile_sizes(true); } fn set_column_display(&mut self, display: ColumnDisplay) { -- cgit