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> {
193 tab_indicator: TabIndicator,193 tab_indicator: TabIndicator,
194 194
195 /// Animation of the render offset during window swapping.195 /// Animation of the render offset during window swapping.
196- move_animation: Option<MoveAnimation>,196+ move_x_animation: Option<MoveAnimation>,
197 197
198 /// Animation of a column visually moving vertically.198 /// Animation of a column visually moving vertically.
199 move_y_animation: Option<MoveAnimation>,199 move_y_animation: Option<MoveAnimation>,
@@ -936,11 +936,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
936 let offset = self.column_x(col_idx + 1) - prev_next_x;936 let offset = self.column_x(col_idx + 1) - prev_next_x;
937 if self.active_column_idx <= col_idx {937 if self.active_column_idx <= col_idx {
938 for col in &mut self.columns[col_idx + 1..] {938 for col in &mut self.columns[col_idx + 1..] {
939- col.animate_move_from(-offset);939+ col.animate_move_x_from(-offset);
940 }940 }
941 } else {941 } else {
942 for col in &mut self.columns[..=col_idx] {942 for col in &mut self.columns[..=col_idx] {
943- col.animate_move_from(offset);943+ col.animate_move_x_from(offset);
944 }944 }
945 }945 }
946 }946 }
@@ -999,11 +999,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
999 let config = anim_config.unwrap_or(self.options.animations.window_movement.0);999 let config = anim_config.unwrap_or(self.options.animations.window_movement.0);
1000 if self.active_column_idx <= idx {1000 if self.active_column_idx <= idx {
1001 for col in &mut self.columns[idx + 1..] {1001 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);
1003 }1003 }
1004 } else {1004 } else {
1005 for col in &mut self.columns[..idx] {1005 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);
1007 }1007 }
1008 }1008 }
1009 1009
@@ -1143,11 +1143,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
1143 // Animate movement of the other columns.1143 // Animate movement of the other columns.
1144 if self.active_column_idx <= column_idx {1144 if self.active_column_idx <= column_idx {
1145 for col in &mut self.columns[column_idx + 1..] {1145 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);
1147 }1147 }
1148 } else {1148 } else {
1149 for col in &mut self.columns[..=column_idx] {1149 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);
1151 }1151 }
1152 }1152 }
1153 1153
@@ -1172,11 +1172,11 @@ impl<W: LayoutElement> ScrollingSpace<W> {
1172 let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);1172 let offset = self.column_x(column_idx + 1) - self.column_x(column_idx);
1173 if self.active_column_idx <= column_idx {1173 if self.active_column_idx <= column_idx {
1174 for col in &mut self.columns[column_idx + 1..] {1174 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);
1176 }1176 }
1177 } else {1177 } else {
1178 for col in &mut self.columns[..column_idx] {1178 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);
1180 }1180 }
1181 }1181 }
1182 1182
@@ -1304,7 +1304,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
1304 // Notably, this is necessary to fix the animation jump when resizing width back1304 // Notably, this is necessary to fix the animation jump when resizing width back
1305 // and forth in quick succession (in a way that cancels the resize animation).1305 // and forth in quick succession (in a way that cancels the resize animation).
1306 if ongoing_resize_anim {1306 if ongoing_resize_anim {
1307- col.animate_move_from_with_config(1307+ col.animate_move_x_from_with_config(
1308 offset,1308 offset,
1309 self.options.animations.window_resize.anim,1309 self.options.animations.window_resize.anim,
1310 );1310 );
@@ -1315,7 +1315,7 @@ impl<W: LayoutElement> ScrollingSpace<W> {
1315 } else {1315 } else {
1316 for col in &mut self.columns[..=col_idx] {1316 for col in &mut self.columns[..=col_idx] {
1317 if ongoing_resize_anim {1317 if ongoing_resize_anim {
1318- col.animate_move_from_with_config(1318+ col.animate_move_x_from_with_config(
1319 -offset,1319 -offset,
1320 self.options.animations.window_resize.anim,1320 self.options.animations.window_resize.anim,
1321 );1321 );
@@ -1700,17 +1700,17 @@ impl<W: LayoutElement> ScrollingSpace<W> {
1700 1700
1701 // The column we just moved is offset by the difference between its new and old position.1701 // The column we just moved is offset by the difference between its new and old position.
1702 let new_col_x = self.column_x(new_idx);1702 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);
1704 1704
1705 // All columns in between moved by the width of the column that we just moved.1705 // All columns in between moved by the width of the column that we just moved.
1706 let others_x_offset = next_col_x - current_col_x;1706 let others_x_offset = next_col_x - current_col_x;
1707 if self.active_column_idx < new_idx {1707 if self.active_column_idx < new_idx {
1708 for col in &mut self.columns[self.active_column_idx..new_idx] {1708 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);
1710 }1710 }
1711 } else {1711 } else {
1712 for col in &mut self.columns[new_idx + 1..=self.active_column_idx] {1712 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);
1714 }1714 }
1715 }1715 }
1716 1716
@@ -3973,7 +3973,7 @@ impl<W: LayoutElement> Column<W> {
3973 is_pending_fullscreen: false,3973 is_pending_fullscreen: false,
3974 display_mode,3974 display_mode,
3975 tab_indicator: TabIndicator::new(options.layout.tab_indicator),3975 tab_indicator: TabIndicator::new(options.layout.tab_indicator),
3976- move_animation: None,3976+ move_x_animation: None,
3977 move_y_animation: None,3977 move_y_animation: None,
3978 view_size,3978 view_size,
3979 working_area,3979 working_area,
@@ -4076,9 +4076,9 @@ impl<W: LayoutElement> Column<W> {
4076 }4076 }
4077 4077
4078 pub fn advance_animations(&mut self) {4078 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 {
4080 if move_.anim.is_done() {4080 if move_.anim.is_done() {
4081- self.move_animation = None;4081+ self.move_x_animation = None;
4082 }4082 }
4083 }4083 }
4084 if let Some(move_) = &mut self.move_y_animation {4084 if let Some(move_) = &mut self.move_y_animation {
@@ -4095,14 +4095,14 @@ impl<W: LayoutElement> Column<W> {
4095 }4095 }
4096 4096
4097 pub fn are_animations_ongoing(&self) -> bool {4097 pub fn are_animations_ongoing(&self) -> bool {
4098- self.move_animation.is_some()4098+ self.move_x_animation.is_some()
4099 || self.move_y_animation.is_some()4099 || self.move_y_animation.is_some()
4100 || self.tab_indicator.are_animations_ongoing()4100 || self.tab_indicator.are_animations_ongoing()
4101 || self.tiles.iter().any(Tile::are_animations_ongoing)4101 || self.tiles.iter().any(Tile::are_animations_ongoing)
4102 }4102 }
4103 4103
4104 pub fn are_transitions_ongoing(&self) -> bool {4104 pub fn are_transitions_ongoing(&self) -> bool {
4105- self.move_animation.is_some()4105+ self.move_x_animation.is_some()
4106 || self.move_y_animation.is_some()4106 || self.move_y_animation.is_some()
4107 || self.tab_indicator.are_animations_ongoing()4107 || self.tab_indicator.are_animations_ongoing()
4108 || self.tiles.iter().any(Tile::are_transitions_ongoing)4108 || self.tiles.iter().any(Tile::are_transitions_ongoing)
@@ -4167,7 +4167,7 @@ impl<W: LayoutElement> Column<W> {
4167 pub fn render_offset(&self) -> Point<f64, Logical> {4167 pub fn render_offset(&self) -> Point<f64, Logical> {
4168 let mut offset = Point::from((0., 0.));4168 let mut offset = Point::from((0., 0.));
4169 4169
4170- if let Some(move_) = &self.move_animation {4170+ if let Some(move_) = &self.move_x_animation {
4171 offset.x += move_.from * move_.anim.value();4171 offset.x += move_.from * move_.anim.value();
4172 }4172 }
4173 if let Some(move_) = &self.move_y_animation {4173 if let Some(move_) = &self.move_y_animation {
@@ -4177,25 +4177,25 @@ impl<W: LayoutElement> Column<W> {
4177 offset4177 offset
4178 }4178 }
4179 4179
4180- pub fn animate_move_from(&mut self, from_x_offset: f64) {4180+ pub fn animate_move_x_from(&mut self, from_x_offset: f64) {
4181- self.animate_move_from_with_config(4181+ self.animate_move_x_from_with_config(
4182 from_x_offset,4182 from_x_offset,
4183 self.options.animations.window_movement.0,4183 self.options.animations.window_movement.0,
4184 );4184 );
4185 }4185 }
4186 4186
4187- pub fn animate_move_from_with_config(4187+ pub fn animate_move_x_from_with_config(
4188 &mut self,4188 &mut self,
4189 from_x_offset: f64,4189 from_x_offset: f64,
4190 config: niri_config::Animation,4190 config: niri_config::Animation,
4191 ) {4191 ) {
4192 let current_offset = self4192 let current_offset = self
4193- .move_animation4193+ .move_x_animation
4194 .as_ref()4194 .as_ref()
4195 .map_or(0., |move_| move_.from * move_.anim.value());4195 .map_or(0., |move_| move_.from * move_.anim.value());
4196 4196
4197 let anim = Animation::new(self.clock.clone(), 1., 0., 0., config);4197 let anim = Animation::new(self.clock.clone(), 1., 0., 0., config);
4198- self.move_animation = Some(MoveAnimation {4198+ self.move_x_animation = Some(MoveAnimation {
4199 anim,4199 anim,
4200 from: from_x_offset + current_offset,4200 from: from_x_offset + current_offset,
4201 });4201 });
@@ -4226,7 +4226,7 @@ impl<W: LayoutElement> Column<W> {
4226 }4226 }
4227 4227
4228 pub fn offset_move_anim_current(&mut self, offset: f64) {4228 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() {
4230 // If the anim is almost done, there's little point trying to offset it; we can let4230 // If the anim is almost done, there's little point trying to offset it; we can let
4231 // things jump. If it turns out like a bad idea, we could restart the anim instead.4231 // things jump. If it turns out like a bad idea, we could restart the anim instead.
4232 let value = move_.anim.value();4232 let value = move_.anim.value();