From 4c22c3285d8b10fbcef1c45a0788c3ddca03ec62 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 24 Nov 2024 09:41:43 +0300 Subject: Refactor animation timing to use lazy clocks --- src/layout/monitor.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/layout/monitor.rs') 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 Monitor { 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 Monitor { 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 Monitor { } for ws in &mut self.workspaces { - ws.advance_animations(current_time); + ws.advance_animations(); } } @@ -1112,7 +1111,7 @@ impl Monitor { 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, -- cgit