forge
Explore
Log in

Don't you dare go Hollow

layout/scrolling: Rename animate_move_from() to animate_move_x_from()

Browse files at this commit

674105f89b3e78d8903a9443fe5fb379feb5d93eIvan MolodetskikhParent: 357a453
src/layout/scrolling.rsmodified+26 -26
@@ -193,7 +193,7 @@ pub struct Column<W: LayoutElement> {
193193 tab_indicator: TabIndicator,
194194
195195 /// Animation of the render offset during window swapping.
196- move_animation: Option<MoveAnimation>,
196+ move_x_animation: Option<MoveAnimation>,
197197
198198 /// Animation of a column visually moving vertically.
199199 move_y_animation: Option<MoveAnimation>,
@@ -936,11 +936,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
936936 let offset = self.column_x(col_idx + 1) - prev_next_x;
937937 if self.active_column_idx <= col_idx {
938938 for col in &mut self.columns[col_idx + 1..] {
939- col.animate_move_from(-offset);
939+ col.animate_move_x_from(-offset);
940940 }
941941 } else {
942942 for col in &mut self.columns[..=col_idx] {
943- col.animate_move_from(offset);
943+ col.animate_move_x_from(offset);
944944 }
945945 }
946946 }
@@ -999,11 +999,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
999999 let config = anim_config.unwrap_or(self.options.animations.window_movement.0);
10001000 if self.active_column_idx <= idx {
10011001 for col in &mut self.columns[idx + 1..] {
1002- col.animate_move_from_with_config(-offset, config);
1002+ col.animate_move_x_from_with_config(-offset, config);
10031003 }
10041004 } else {
10051005 for col in &mut self.columns[..idx] {
1006- col.animate_move_from_with_config(offset, config);
1006+ col.animate_move_x_from_with_config(offset, config);
10071007 }
10081008 }
10091009
@@ -1143,11 +1143,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
11431143 // Animate movement of the other columns.
11441144 if self.active_column_idx <= column_idx {
11451145 for col in &mut self.columns[column_idx + 1..] {
1146- col.animate_move_from_with_config(offset, movement_config);
1146+ col.animate_move_x_from_with_config(offset, movement_config);
11471147 }
11481148 } else {
11491149 for col in &mut self.columns[..=column_idx] {
1150- col.animate_move_from_with_config(-offset, movement_config);
1150+ col.animate_move_x_from_with_config(-offset, movement_config);
11511151 }
11521152 }
11531153
@@ -1172,11 +1172,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
11721172 let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);
11731173 if self.active_column_idx <= column_idx {
11741174 for col in &mut self.columns[column_idx + 1..] {
1175- col.animate_move_from_with_config(offset, movement_config);
1175+ col.animate_move_x_from_with_config(offset, movement_config);
11761176 }
11771177 } else {
11781178 for col in &mut self.columns[..column_idx] {
1179- col.animate_move_from_with_config(-offset, movement_config);
1179+ col.animate_move_x_from_with_config(-offset, movement_config);
11801180 }
11811181 }
11821182
@@ -1304,7 +1304,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
13041304 // Notably, this is necessary to fix the animation jump when resizing width back
13051305 // and forth in quick succession (in a way that cancels the resize animation).
13061306 if ongoing_resize_anim {
1307- col.animate_move_from_with_config(
1307+ col.animate_move_x_from_with_config(
13081308 offset,
13091309 self.options.animations.window_resize.anim,
13101310 );
@@ -1315,7 +1315,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
13151315 } else {
13161316 for col in &mut self.columns[..=col_idx] {
13171317 if ongoing_resize_anim {
1318- col.animate_move_from_with_config(
1318+ col.animate_move_x_from_with_config(
13191319 -offset,
13201320 self.options.animations.window_resize.anim,
13211321 );
@@ -1700,17 +1700,17 @@ impl<W: LayoutElement> ScrollingSpace<W> {
17001700
17011701 // The column we just moved is offset by the difference between its new and old position.
17021702 let new_col_x = self.column_x(new_idx);
1703- self.columns[new_idx].animate_move_from(current_col_x - new_col_x);
1703+ self.columns[new_idx].animate_move_x_from(current_col_x - new_col_x);
17041704
17051705 // All columns in between moved by the width of the column that we just moved.
17061706 let others_x_offset = next_col_x - current_col_x;
17071707 if self.active_column_idx < new_idx {
17081708 for col in &mut self.columns[self.active_column_idx..new_idx] {
1709- col.animate_move_from(others_x_offset);
1709+ col.animate_move_x_from(others_x_offset);
17101710 }
17111711 } else {
17121712 for col in &mut self.columns[new_idx + 1..=self.active_column_idx] {
1713- col.animate_move_from(-others_x_offset);
1713+ col.animate_move_x_from(-others_x_offset);
17141714 }
17151715 }
17161716
@@ -3973,7 +3973,7 @@ impl<W: LayoutElement> Column<W> {
39733973 is_pending_fullscreen: false,
39743974 display_mode,
39753975 tab_indicator: TabIndicator::new(options.layout.tab_indicator),
3976- move_animation: None,
3976+ move_x_animation: None,
39773977 move_y_animation: None,
39783978 view_size,
39793979 working_area,
@@ -4076,9 +4076,9 @@ impl<W: LayoutElement> Column<W> {
40764076 }
40774077
40784078 pub fn advance_animations(&mut self) {
4079- if let Some(move_) = &mut self.move_animation {
4079+ if let Some(move_) = &mut self.move_x_animation {
40804080 if move_.anim.is_done() {
4081- self.move_animation = None;
4081+ self.move_x_animation = None;
40824082 }
40834083 }
40844084 if let Some(move_) = &mut self.move_y_animation {
@@ -4095,14 +4095,14 @@ impl<W: LayoutElement> Column<W> {
40954095 }
40964096
40974097 pub fn are_animations_ongoing(&self) -> bool {
4098- self.move_animation.is_some()
4098+ self.move_x_animation.is_some()
40994099 || self.move_y_animation.is_some()
41004100 || self.tab_indicator.are_animations_ongoing()
41014101 || self.tiles.iter().any(Tile::are_animations_ongoing)
41024102 }
41034103
41044104 pub fn are_transitions_ongoing(&self) -> bool {
4105- self.move_animation.is_some()
4105+ self.move_x_animation.is_some()
41064106 || self.move_y_animation.is_some()
41074107 || self.tab_indicator.are_animations_ongoing()
41084108 || self.tiles.iter().any(Tile::are_transitions_ongoing)
@@ -4167,7 +4167,7 @@ impl<W: LayoutElement> Column<W> {
41674167 pub fn render_offset(&self) -> Point<f64, Logical> {
41684168 let mut offset = Point::from((0., 0.));
41694169
4170- if let Some(move_) = &self.move_animation {
4170+ if let Some(move_) = &self.move_x_animation {
41714171 offset.x += move_.from * move_.anim.value();
41724172 }
41734173 if let Some(move_) = &self.move_y_animation {
@@ -4177,25 +4177,25 @@ impl<W: LayoutElement> Column<W> {
41774177 offset
41784178 }
41794179
4180- pub fn animate_move_from(&mut self, from_x_offset: f64) {
4181- self.animate_move_from_with_config(
4180+ pub fn animate_move_x_from(&mut self, from_x_offset: f64) {
4181+ self.animate_move_x_from_with_config(
41824182 from_x_offset,
41834183 self.options.animations.window_movement.0,
41844184 );
41854185 }
41864186
4187- pub fn animate_move_from_with_config(
4187+ pub fn animate_move_x_from_with_config(
41884188 &mut self,
41894189 from_x_offset: f64,
41904190 config: niri_config::Animation,
41914191 ) {
41924192 let current_offset = self
4193- .move_animation
4193+ .move_x_animation
41944194 .as_ref()
41954195 .map_or(0., |move_| move_.from * move_.anim.value());
41964196
41974197 let anim = Animation::new(self.clock.clone(), 1., 0., 0., config);
4198- self.move_animation = Some(MoveAnimation {
4198+ self.move_x_animation = Some(MoveAnimation {
41994199 anim,
42004200 from: from_x_offset + current_offset,
42014201 });
@@ -4226,7 +4226,7 @@ impl<W: LayoutElement> Column<W> {
42264226 }
42274227
42284228 pub fn offset_move_anim_current(&mut self, offset: f64) {
4229- if let Some(move_) = self.move_animation.as_mut() {
4229+ if let Some(move_) = self.move_x_animation.as_mut() {
42304230 // If the anim is almost done, there's little point trying to offset it; we can let
42314231 // things jump. If it turns out like a bad idea, we could restart the anim instead.
42324232 let value = move_.anim.value();