layout: Remove by-ref animation_snapshot() getter
Browse files at this commitc9873a0885bf50544bc2b72154dc257c66cb7959Parent: 7a6be2a5 changed files +3 -18
- niri-visual-tests/src/test_window.rs +0 -4
- src/layout/mod.rs +0 -1
- src/layout/scrolling.rs +3 -5
- src/layout/tests.rs +0 -4
- src/window/mapped.rs +0 -4
niri-visual-tests/src/test_window.rsmodified+0 -4
| @@ -255,10 +255,6 @@ impl LayoutElement for TestWindow { | |||
| 255 | &EMPTY | 255 | &EMPTY |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | ||
| 259 | - None | ||
| 260 | - } | ||
| 261 | - | ||
| 262 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { | 258 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { |
| 263 | None | 259 | None |
| 264 | } | 260 | } |
src/layout/mod.rsmodified+0 -1
| @@ -270,7 +270,6 @@ pub trait LayoutElement { | |||
| 270 | /// Runs periodic clean-up tasks. | 270 | /// Runs periodic clean-up tasks. |
| 271 | fn refresh(&self); | 271 | fn refresh(&self); |
| 272 | 272 | ||
| 273 | - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>; | ||
| 274 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>; | 273 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>; |
| 275 | 274 | ||
| 276 | fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>); | 275 | fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>); |
src/layout/scrolling.rsmodified+3 -5
| @@ -4041,15 +4041,13 @@ impl<W: LayoutElement> Column<W> { | |||
| 4041 | .find(|(_, tile)| tile.window().id() == window) | 4041 | .find(|(_, tile)| tile.window().id() == window) |
| 4042 | .unwrap(); | 4042 | .unwrap(); |
| 4043 | 4043 | ||
| 4044 | - let height = f64::from(tile.window().size().h); | 4044 | + let prev_height = self.data[tile_idx].size.h; |
| 4045 | - let offset = tile | ||
| 4046 | - .window() | ||
| 4047 | - .animation_snapshot() | ||
| 4048 | - .map_or(0., |from| from.size.h - height); | ||
| 4049 | 4045 | ||
| 4050 | tile.update_window(); | 4046 | tile.update_window(); |
| 4051 | self.data[tile_idx].update(tile); | 4047 | self.data[tile_idx].update(tile); |
| 4052 | 4048 | ||
| 4049 | + let offset = prev_height - self.data[tile_idx].size.h; | ||
| 4050 | + | ||
| 4053 | let is_tabbed = self.display_mode == ColumnDisplay::Tabbed; | 4051 | let is_tabbed = self.display_mode == ColumnDisplay::Tabbed; |
| 4054 | 4052 | ||
| 4055 | // Move windows below in tandem with resizing. | 4053 | // Move windows below in tandem with resizing. |
src/layout/tests.rsmodified+0 -4
| @@ -244,10 +244,6 @@ impl LayoutElement for TestWindow { | |||
| 244 | &EMPTY | 244 | &EMPTY |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | ||
| 248 | - None | ||
| 249 | - } | ||
| 250 | - | ||
| 251 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { | 247 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { |
| 252 | None | 248 | None |
| 253 | } | 249 | } |
src/window/mapped.rsmodified+0 -4
| @@ -1174,10 +1174,6 @@ impl LayoutElement for Mapped { | |||
| 1174 | &self.rules | 1174 | &self.rules |
| 1175 | } | 1175 | } |
| 1176 | 1176 | ||
| 1177 | - fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> { | ||
| 1178 | - self.animation_snapshot.as_ref() | ||
| 1179 | - } | ||
| 1180 | - | ||
| 1181 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { | 1177 | fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> { |
| 1182 | self.animation_snapshot.take() | 1178 | self.animation_snapshot.take() |
| 1183 | } | 1179 | } |