aboutsummaryrefslogtreecommitdiff
path: root/src/layout/monitor.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-11-24 09:41:43 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-11-25 04:07:59 -0800
commit4c22c3285d8b10fbcef1c45a0788c3ddca03ec62 (patch)
tree506174fe9962a91598ac25d4d2dee1cdaa3d5292 /src/layout/monitor.rs
parent93cee2994ab9ccf59a09f61d5b8acf6cd937d654 (diff)
downloadniri-4c22c3285d8b10fbcef1c45a0788c3ddca03ec62.tar.gz
niri-4c22c3285d8b10fbcef1c45a0788c3ddca03ec62.tar.bz2
niri-4c22c3285d8b10fbcef1c45a0788c3ddca03ec62.zip
Refactor animation timing to use lazy clocks
Diffstat (limited to 'src/layout/monitor.rs')
-rw-r--r--src/layout/monitor.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs
index aad921bb..52e73cce 100644
--- a/src/layout/monitor.rs
+++ b/src/layout/monitor.rs
@@ -184,7 +184,7 @@ impl<W: LayoutElement> Monitor<W> {
self.active_workspace_idx = idx;
self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new(
- self.clock.now(),
+ self.clock.clone(),
current_idx,
idx as f64,
0.,
@@ -734,9 +734,8 @@ impl<W: LayoutElement> Monitor<W> {
Some(column.tiles[column.active_tile_idx].window())
}
- pub fn advance_animations(&mut self, current_time: Duration) {
+ pub fn advance_animations(&mut self) {
if let Some(WorkspaceSwitch::Animation(anim)) = &mut self.workspace_switch {
- anim.set_current_time(current_time);
if anim.is_done() {
self.workspace_switch = None;
self.clean_up_workspaces();
@@ -744,7 +743,7 @@ impl<W: LayoutElement> Monitor<W> {
}
for ws in &mut self.workspaces {
- ws.advance_animations(current_time);
+ ws.advance_animations();
}
}
@@ -1112,7 +1111,7 @@ impl<W: LayoutElement> Monitor<W> {
self.active_workspace_idx = new_idx;
self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new(
- self.clock.now(),
+ self.clock.clone(),
gesture.current_idx,
new_idx as f64,
velocity,