From 8b0dc1902c251569fe710b87c4a74b46c536272d Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 13 Apr 2024 14:55:11 +0400 Subject: Set window-resize animation config for view-offset anim caused by resize --- src/layout/workspace.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/layout') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index ef8548ae..07dae721 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -903,7 +903,8 @@ impl Workspace { column.update_tile_sizes(false); // Move other columns in tandem with resizing. - if column.tiles[tile_idx].resize_animation().is_some() && offset != 0 { + let started_animation = column.tiles[tile_idx].resize_animation().is_some() && offset != 0; + if started_animation { if self.active_column_idx <= col_idx { for col in &mut self.columns[col_idx + 1..] { col.animate_move_from_with_config( @@ -932,6 +933,20 @@ impl Workspace { // FIXME: we will want to skip the animation in some cases here to make continuously // resizing windows not look janky. self.animate_view_offset_to_column(current_x, col_idx, None); + + // If this animated resize caused a view animation, make sure that it uses the same + // config. This is important for always-centered view. + if let Some(ViewOffsetAdjustment::Animation(anim)) = &mut self.view_offset_adj { + // FIXME: animate_view_offset_to_column() will keep the previous running view + // offset animation if the target was the same; maybe we shouldn't replace in this + // case? + if started_animation { + anim.replace_config( + self.options.animations.window_resize, + niri_config::Animation::default_window_resize(), + ); + } + } } } -- cgit