diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-13 14:55:11 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-04-13 14:57:55 +0400 |
| commit | 8b0dc1902c251569fe710b87c4a74b46c536272d (patch) | |
| tree | b1bcb64c828599bcfcb605ab94eab1e571ff632a /src/layout | |
| parent | 9d5f1c7ef7e1b038fe6242aaa04009bf21463d2a (diff) | |
| download | niri-8b0dc1902c251569fe710b87c4a74b46c536272d.tar.gz niri-8b0dc1902c251569fe710b87c4a74b46c536272d.tar.bz2 niri-8b0dc1902c251569fe710b87c4a74b46c536272d.zip | |
Set window-resize animation config for view-offset anim caused by resize
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/workspace.rs | 17 |
1 files changed, 16 insertions, 1 deletions
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<W: LayoutElement> Workspace<W> { 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<W: LayoutElement> Workspace<W> { // 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(), + ); + } + } } } |
