forge
Explore
Log in

Don't you dare go Hollow

Sync expel animations

Browse files at this commit

3b37f1a5579e9ae7eebb4c96d09b18ed8d6da8e2Ivan MolodetskikhParent: dee0abb
src/layout/workspace.rsmodified+41 -9
@@ -713,7 +713,7 @@ impl<W: LayoutElement> Workspace<W> {
713 is_full_width: bool,713 is_full_width: bool,
714 ) {714 ) {
715 let tile = Tile::new(window, self.options.clone());715 let tile = Tile::new(window, self.options.clone());
716- self.add_tile_at(col_idx, tile, activate, width, is_full_width);716+ self.add_tile_at(col_idx, tile, activate, width, is_full_width, None);
717 }717 }
718 718
719 fn add_tile_at(719 fn add_tile_at(
@@ -723,6 +723,7 @@ impl<W: LayoutElement> Workspace<W> {
723 activate: bool,723 activate: bool,
724 width: ColumnWidth,724 width: ColumnWidth,
725 is_full_width: bool,725 is_full_width: bool,
726+ anim_config: Option<niri_config::Animation>,
726 ) {727 ) {
727 self.enter_output_for_window(tile.window());728 self.enter_output_for_window(tile.window());
728 729
@@ -757,19 +758,23 @@ impl<W: LayoutElement> Workspace<W> {
757 758
758 let prev_offset = (!was_empty).then(|| self.static_view_offset());759 let prev_offset = (!was_empty).then(|| self.static_view_offset());
759 760
760- self.activate_column(col_idx);761+ self.activate_column_with_anim_config(
762+ col_idx,
763+ anim_config.unwrap_or(self.options.animations.horizontal_view_movement.0),
764+ );
761 self.activate_prev_column_on_removal = prev_offset;765 self.activate_prev_column_on_removal = prev_offset;
762 }766 }
763 767
764 // Animate movement of other columns.768 // Animate movement of other columns.
765 let offset = self.column_x(col_idx + 1) - self.column_x(col_idx);769 let offset = self.column_x(col_idx + 1) - self.column_x(col_idx);
770+ let config = anim_config.unwrap_or(self.options.animations.window_movement.0);
766 if self.active_column_idx <= col_idx {771 if self.active_column_idx <= col_idx {
767 for col in &mut self.columns[col_idx + 1..] {772 for col in &mut self.columns[col_idx + 1..] {
768- col.animate_move_from(-offset);773+ col.animate_move_from_with_config(-offset, config);
769 }774 }
770 } else {775 } else {
771 for col in &mut self.columns[..col_idx] {776 for col in &mut self.columns[..col_idx] {
772- col.animate_move_from(offset);777+ col.animate_move_from_with_config(offset, config);
773 }778 }
774 }779 }
775 }780 }
@@ -790,14 +795,21 @@ impl<W: LayoutElement> Workspace<W> {
790 self.add_window_at(col_idx, window, activate, width, is_full_width);795 self.add_window_at(col_idx, window, activate, width, is_full_width);
791 }796 }
792 797
793- fn add_tile(&mut self, tile: Tile<W>, activate: bool, width: ColumnWidth, is_full_width: bool) {798+ fn add_tile(
799+ &mut self,
800+ tile: Tile<W>,
801+ activate: bool,
802+ width: ColumnWidth,
803+ is_full_width: bool,
804+ anim_config: Option<niri_config::Animation>,
805+ ) {
794 let col_idx = if self.columns.is_empty() {806 let col_idx = if self.columns.is_empty() {
795 0807 0
796 } else {808 } else {
797 self.active_column_idx + 1809 self.active_column_idx + 1
798 };810 };
799 811
800- self.add_tile_at(col_idx, tile, activate, width, is_full_width);812+ self.add_tile_at(col_idx, tile, activate, width, is_full_width, anim_config);
801 }813 }
802 814
803 pub fn add_window_right_of(815 pub fn add_window_right_of(
@@ -1423,7 +1435,15 @@ impl<W: LayoutElement> Workspace<W> {
1423 1435
1424 let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);1436 let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);
1425 1437
1426- self.add_tile_at(self.active_column_idx, tile, true, width, is_full_width);1438+ self.add_tile_at(
1439+ self.active_column_idx,
1440+ tile,
1441+ true,
1442+ width,
1443+ is_full_width,
1444+ Some(self.options.animations.window_movement.0),
1445+ );
1446+
1427 // We added to the left, don't activate even further left on removal.1447 // We added to the left, don't activate even further left on removal.
1428 self.activate_prev_column_on_removal = None;1448 self.activate_prev_column_on_removal = None;
1429 1449
@@ -1484,7 +1504,13 @@ impl<W: LayoutElement> Workspace<W> {
1484 1504
1485 let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);1505 let tile = self.remove_tile_by_idx(source_col_idx, source_column.active_tile_idx);
1486 1506
1487- self.add_tile(tile, true, width, is_full_width);1507+ self.add_tile(
1508+ tile,
1509+ true,
1510+ width,
1511+ is_full_width,
1512+ Some(self.options.animations.window_movement.0),
1513+ );
1488 1514
1489 let new_col = &mut self.columns[self.active_column_idx];1515 let new_col = &mut self.columns[self.active_column_idx];
1490 let offset_y = prev_y - new_col.tile_y(0);1516 let offset_y = prev_y - new_col.tile_y(0);
@@ -1557,7 +1583,13 @@ impl<W: LayoutElement> Workspace<W> {
1557 let is_full_width = source_column.is_full_width;1583 let is_full_width = source_column.is_full_width;
1558 let tile = self.remove_tile_by_idx(self.active_column_idx, source_column.active_tile_idx);1584 let tile = self.remove_tile_by_idx(self.active_column_idx, source_column.active_tile_idx);
1559 1585
1560- self.add_tile(tile, true, width, is_full_width);1586+ self.add_tile(
1587+ tile,
1588+ true,
1589+ width,
1590+ is_full_width,
1591+ Some(self.options.animations.window_movement.0),
1592+ );
1561 1593
1562 let new_col = &mut self.columns[self.active_column_idx];1594 let new_col = &mut self.columns[self.active_column_idx];
1563 let offset_y = prev_y - new_col.tile_y(0);1595 let offset_y = prev_y - new_col.tile_y(0);