aboutsummaryrefslogtreecommitdiff
path: root/src/layout/workspace.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-10-17 08:21:37 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-10-17 08:59:06 +0300
commit4b837f429c525d37785b17a29fec7d137cd7a1fe (patch)
tree2957afae3561dd60b841814b78ec0dd73c7fa60e /src/layout/workspace.rs
parenta480087618ea8835663ae0eb7da3bd066c1941d0 (diff)
downloadniri-4b837f429c525d37785b17a29fec7d137cd7a1fe.tar.gz
niri-4b837f429c525d37785b17a29fec7d137cd7a1fe.tar.bz2
niri-4b837f429c525d37785b17a29fec7d137cd7a1fe.zip
layout: Accept anim_config in remove_column_by_idx
Diffstat (limited to 'src/layout/workspace.rs')
-rw-r--r--src/layout/workspace.rs34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index b1afa24d..9cd2b0d3 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -1254,16 +1254,21 @@ impl<W: LayoutElement> Workspace<W> {
tile
}
- pub fn remove_column_by_idx(&mut self, column_idx: usize) -> Column<W> {
+ pub fn remove_column_by_idx(
+ &mut self,
+ column_idx: usize,
+ anim_config: Option<niri_config::Animation>,
+ ) -> Column<W> {
// Animate movement of the other columns.
+ let movement_config = anim_config.unwrap_or(self.options.animations.window_movement.0);
let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);
if self.active_column_idx <= column_idx {
for col in &mut self.columns[column_idx + 1..] {
- col.animate_move_from(offset);
+ col.animate_move_from_with_config(offset, movement_config);
}
} else {
for col in &mut self.columns[..column_idx] {
- col.animate_move_from(-offset);
+ col.animate_move_from_with_config(-offset, movement_config);
}
}
@@ -1301,6 +1306,8 @@ impl<W: LayoutElement> Workspace<W> {
return column;
}
+ let view_config = anim_config.unwrap_or(self.options.animations.horizontal_view_movement.0);
+
if column_idx < self.active_column_idx {
// A column to the left was removed; preserve the current position.
// FIXME: preserve activate_prev_column_on_removal.
@@ -1313,16 +1320,29 @@ impl<W: LayoutElement> Workspace<W> {
if 0 < column_idx {
let prev_offset = self.activate_prev_column_on_removal.unwrap();
- self.activate_column(self.active_column_idx - 1);
+ self.activate_column_with_anim_config(self.active_column_idx - 1, view_config);
// Restore the view offset but make sure to scroll the view in case the
// previous window had resized.
let current_x = self.view_pos();
- self.animate_view_offset(current_x, self.active_column_idx, prev_offset);
- self.animate_view_offset_to_column(current_x, self.active_column_idx, None);
+ self.animate_view_offset_with_config(
+ current_x,
+ self.active_column_idx,
+ prev_offset,
+ view_config,
+ );
+ self.animate_view_offset_to_column_with_config(
+ current_x,
+ self.active_column_idx,
+ None,
+ view_config,
+ );
}
} else {
- self.activate_column(min(self.active_column_idx, self.columns.len() - 1));
+ self.activate_column_with_anim_config(
+ min(self.active_column_idx, self.columns.len() - 1),
+ view_config,
+ );
}
column