forge
Explore
Log in

Don't you dare go Hollow

Synchronize column removal anim on consume left/right

Browse files at this commit

568c35ff876f126bb66ec7d7fb59a62424e6f8b5Ivan MolodetskikhParent: c4f600b
Visible when consuming left/right when always-centered and differing
horizontal view anim.
src/layout/mod.rsmodified+1 -1
@@ -1427,7 +1427,7 @@ impl<W: LayoutElement> Layout<W> {
14271427 let width = column.width;
14281428 let is_full_width = column.is_full_width;
14291429 let window = ws
1430- .remove_tile_by_idx(ws.active_column_idx, column.active_tile_idx)
1430+ .remove_tile_by_idx(ws.active_column_idx, column.active_tile_idx, None)
14311431 .into_window();
14321432
14331433 let workspace_idx = monitors[new_idx].active_workspace_idx;
src/layout/monitor.rsmodified+3 -3
@@ -346,7 +346,7 @@ impl<W: LayoutElement> Monitor<W> {
346346 let width = column.width;
347347 let is_full_width = column.is_full_width;
348348 let window = workspace
349- .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx)
349+ .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx, None)
350350 .into_window();
351351
352352 self.add_window(new_idx, window, true, width, is_full_width);
@@ -369,7 +369,7 @@ impl<W: LayoutElement> Monitor<W> {
369369 let width = column.width;
370370 let is_full_width = column.is_full_width;
371371 let window = workspace
372- .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx)
372+ .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx, None)
373373 .into_window();
374374
375375 self.add_window(new_idx, window, true, width, is_full_width);
@@ -392,7 +392,7 @@ impl<W: LayoutElement> Monitor<W> {
392392 let width = column.width;
393393 let is_full_width = column.is_full_width;
394394 let window = workspace
395- .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx)
395+ .remove_tile_by_idx(workspace.active_column_idx, column.active_tile_idx, None)
396396 .into_window();
397397
398398 self.add_window(new_idx, window, true, width, is_full_width);
src/layout/workspace.rsmodified+45 -14
@@ -912,7 +912,12 @@ impl<W: LayoutElement> Workspace<W> {
912912 }
913913 }
914914
915- pub fn remove_tile_by_idx(&mut self, column_idx: usize, window_idx: usize) -> Tile<W> {
915+ pub fn remove_tile_by_idx(
916+ &mut self,
917+ column_idx: usize,
918+ window_idx: usize,
919+ anim_config: Option<niri_config::Animation>,
920+ ) -> Tile<W> {
916921 let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);
917922
918923 let column = &mut self.columns[column_idx];
@@ -942,13 +947,14 @@ impl<W: LayoutElement> Workspace<W> {
942947 }
943948
944949 // Animate movement of the other columns.
950+ let movement_config = anim_config.unwrap_or(self.options.animations.window_movement.0);
945951 if self.active_column_idx <= column_idx {
946952 for col in &mut self.columns[column_idx + 1..] {
947- col.animate_move_from(offset);
953+ col.animate_move_from_with_config(offset, movement_config);
948954 }
949955 } else {
950956 for col in &mut self.columns[..column_idx] {
951- col.animate_move_from(-offset);
957+ col.animate_move_from_with_config(-offset, movement_config);
952958 }
953959 }
954960
@@ -957,6 +963,9 @@ impl<W: LayoutElement> Workspace<W> {
957963 return tile;
958964 }
959965
966+ let view_config =
967+ anim_config.unwrap_or(self.options.animations.horizontal_view_movement.0);
968+
960969 if column_idx < self.active_column_idx {
961970 // A column to the left was removed; preserve the current position.
962971 // FIXME: preserve activate_prev_column_on_removal.
@@ -969,16 +978,29 @@ impl<W: LayoutElement> Workspace<W> {
969978 if 0 < column_idx {
970979 let prev_offset = self.activate_prev_column_on_removal.unwrap();
971980
972- self.activate_column(self.active_column_idx - 1);
981+ self.activate_column_with_anim_config(self.active_column_idx - 1, view_config);
973982
974983 // Restore the view offset but make sure to scroll the view in case the
975984 // previous window had resized.
976985 let current_x = self.view_pos();
977- self.animate_view_offset(current_x, self.active_column_idx, prev_offset);
978- self.animate_view_offset_to_column(current_x, self.active_column_idx, None);
986+ self.animate_view_offset_with_config(
987+ current_x,
988+ self.active_column_idx,
989+ prev_offset,
990+ view_config,
991+ );
992+ self.animate_view_offset_to_column_with_config(
993+ current_x,
994+ self.active_column_idx,
995+ None,
996+ view_config,
997+ );
979998 }
980999 } else {
981- self.activate_column(min(self.active_column_idx, self.columns.len() - 1));
1000+ self.activate_column_with_anim_config(
1001+ min(self.active_column_idx, self.columns.len() - 1),
1002+ view_config,
1003+ );
9821004 }
9831005
9841006 return tile;
@@ -1061,7 +1083,7 @@ impl<W: LayoutElement> Workspace<W> {
10611083 let column = &self.columns[column_idx];
10621084
10631085 let window_idx = column.position(window).unwrap();
1064- self.remove_tile_by_idx(column_idx, window_idx)
1086+ self.remove_tile_by_idx(column_idx, window_idx, None)
10651087 .into_window()
10661088 }
10671089
@@ -1404,7 +1426,11 @@ impl<W: LayoutElement> Workspace<W> {
14041426 // Make sure the previous (target) column is activated so the animation looks right.
14051427 self.activate_prev_column_on_removal = Some(self.static_view_offset() + offset_x);
14061428 let offset_x = offset_x + self.columns[source_col_idx].render_offset().x;
1407- let tile = self.remove_tile_by_idx(source_col_idx, 0);
1429+ let tile = self.remove_tile_by_idx(
1430+ source_col_idx,
1431+ 0,
1432+ Some(self.options.animations.window_movement.0),
1433+ );
14081434 self.enter_output_for_window(tile.window());
14091435
14101436 let next_col_idx = source_col_idx;
@@ -1433,7 +1459,7 @@ impl<W: LayoutElement> Workspace<W> {
14331459
14341460 let offset_x = source_column.render_offset().x;
14351461
1436- let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);
1462+ let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx, None);
14371463
14381464 self.add_tile_at(
14391465 self.active_column_idx,
@@ -1477,7 +1503,11 @@ impl<W: LayoutElement> Workspace<W> {
14771503
14781504 // Make sure the target column gets activated.
14791505 self.activate_prev_column_on_removal = None;
1480- let tile = self.remove_tile_by_idx(source_col_idx, 0);
1506+ let tile = self.remove_tile_by_idx(
1507+ source_col_idx,
1508+ 0,
1509+ Some(self.options.animations.window_movement.0),
1510+ );
14811511 self.enter_output_for_window(tile.window());
14821512
14831513 let prev_next_x = self.column_x(target_column_idx + 1);
@@ -1502,7 +1532,7 @@ impl<W: LayoutElement> Workspace<W> {
15021532 let width = source_column.width;
15031533 let is_full_width = source_column.is_full_width;
15041534
1505- let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);
1535+ let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx, None);
15061536
15071537 self.add_tile(
15081538 tile,
@@ -1534,7 +1564,7 @@ impl<W: LayoutElement> Workspace<W> {
15341564 - self.column_x(self.active_column_idx);
15351565 let prev_y = self.columns[source_column_idx].tile_y(0);
15361566
1537- let tile = self.remove_tile_by_idx(source_column_idx, 0);
1567+ let tile = self.remove_tile_by_idx(source_column_idx, 0, None);
15381568 self.enter_output_for_window(tile.window());
15391569
15401570 let prev_next_x = self.column_x(self.active_column_idx + 1);
@@ -1581,7 +1611,8 @@ impl<W: LayoutElement> Workspace<W> {
15811611
15821612 let width = source_column.width;
15831613 let is_full_width = source_column.is_full_width;
1584- let tile = self.remove_tile_by_idx(self.active_column_idx, source_column.active_tile_idx);
1614+ let tile =
1615+ self.remove_tile_by_idx(self.active_column_idx, source_column.active_tile_idx, None);
15851616
15861617 self.add_tile(
15871618 tile,