aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2025-08-12 22:34:13 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2025-08-14 15:58:59 +0300
commitc9873a0885bf50544bc2b72154dc257c66cb7959 (patch)
treedf2c131a6ee17e0e0949c564ee82e97b1f725382
parent7a6be2a923d8d19d544bb6c52cf172b89ca8298c (diff)
downloadniri-c9873a0885bf50544bc2b72154dc257c66cb7959.tar.gz
niri-c9873a0885bf50544bc2b72154dc257c66cb7959.tar.bz2
niri-c9873a0885bf50544bc2b72154dc257c66cb7959.zip
layout: Remove by-ref animation_snapshot() getter
It was used in only one place, and that place was due for an update to use the cached data.
-rw-r--r--niri-visual-tests/src/test_window.rs4
-rw-r--r--src/layout/mod.rs1
-rw-r--r--src/layout/scrolling.rs8
-rw-r--r--src/layout/tests.rs4
-rw-r--r--src/window/mapped.rs4
5 files changed, 3 insertions, 18 deletions
diff --git a/niri-visual-tests/src/test_window.rs b/niri-visual-tests/src/test_window.rs
index 7ac9c463..7fee44c6 100644
--- a/niri-visual-tests/src/test_window.rs
+++ b/niri-visual-tests/src/test_window.rs
@@ -255,10 +255,6 @@ impl LayoutElement for TestWindow {
&EMPTY
}
- fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> {
- None
- }
-
fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> {
None
}
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 5deda707..7bf25b42 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -270,7 +270,6 @@ pub trait LayoutElement {
/// Runs periodic clean-up tasks.
fn refresh(&self);
- fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot>;
fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot>;
fn set_interactive_resize(&mut self, data: Option<InteractiveResizeData>);
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs
index 37feb227..94f2aa97 100644
--- a/src/layout/scrolling.rs
+++ b/src/layout/scrolling.rs
@@ -4041,15 +4041,13 @@ impl<W: LayoutElement> Column<W> {
.find(|(_, tile)| tile.window().id() == window)
.unwrap();
- let height = f64::from(tile.window().size().h);
- let offset = tile
- .window()
- .animation_snapshot()
- .map_or(0., |from| from.size.h - height);
+ let prev_height = self.data[tile_idx].size.h;
tile.update_window();
self.data[tile_idx].update(tile);
+ let offset = prev_height - self.data[tile_idx].size.h;
+
let is_tabbed = self.display_mode == ColumnDisplay::Tabbed;
// Move windows below in tandem with resizing.
diff --git a/src/layout/tests.rs b/src/layout/tests.rs
index d7c66ba4..afb83d38 100644
--- a/src/layout/tests.rs
+++ b/src/layout/tests.rs
@@ -244,10 +244,6 @@ impl LayoutElement for TestWindow {
&EMPTY
}
- fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> {
- None
- }
-
fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> {
None
}
diff --git a/src/window/mapped.rs b/src/window/mapped.rs
index 995c76bf..f179bced 100644
--- a/src/window/mapped.rs
+++ b/src/window/mapped.rs
@@ -1174,10 +1174,6 @@ impl LayoutElement for Mapped {
&self.rules
}
- fn animation_snapshot(&self) -> Option<&LayoutElementRenderSnapshot> {
- self.animation_snapshot.as_ref()
- }
-
fn take_animation_snapshot(&mut self) -> Option<LayoutElementRenderSnapshot> {
self.animation_snapshot.take()
}