diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/animation.rs | 6 | ||||
| -rw-r--r-- | src/config_error_notification.rs | 6 | ||||
| -rw-r--r-- | src/layout/mod.rs | 2 | ||||
| -rw-r--r-- | src/layout/monitor.rs | 2 | ||||
| -rw-r--r-- | src/layout/tile.rs | 3 | ||||
| -rw-r--r-- | src/layout/workspace.rs | 2 |
6 files changed, 11 insertions, 10 deletions
diff --git a/src/animation.rs b/src/animation.rs index bf0536e2..404c3d85 100644 --- a/src/animation.rs +++ b/src/animation.rs @@ -25,15 +25,17 @@ pub enum Curve { } impl Animation { - pub fn new(from: f64, to: f64, over: Duration) -> Self { + pub fn new(from: f64, to: f64, over_ms: u32) -> Self { // FIXME: ideally we shouldn't use current time here because animations started within the // same frame cycle should have the same start time to be synchronized. let now = get_monotonic_time(); + let duration = Duration::from_millis(u64::from(over_ms)) + .mul_f64(ANIMATION_SLOWDOWN.load(Ordering::Relaxed)); Self { from, to, - duration: over.mul_f64(ANIMATION_SLOWDOWN.load(Ordering::Relaxed)), + duration, start_time: now, current_time: now, curve: Curve::EaseOutCubic, diff --git a/src/config_error_notification.rs b/src/config_error_notification.rs index 73ae3d9b..b80e8d27 100644 --- a/src/config_error_notification.rs +++ b/src/config_error_notification.rs @@ -58,7 +58,7 @@ impl ConfigErrorNotification { self.buffers.borrow_mut().clear(); } - self.state = State::Showing(Animation::new(0., 1., Duration::from_millis(250))); + self.state = State::Showing(Animation::new(0., 1., 250)); } pub fn show(&mut self) { @@ -68,7 +68,7 @@ impl ConfigErrorNotification { } // Show from scratch even if already showing to bring attention. - self.state = State::Showing(Animation::new(0., 1., Duration::from_millis(250))); + self.state = State::Showing(Animation::new(0., 1., 250)); } pub fn hide(&mut self) { @@ -76,7 +76,7 @@ impl ConfigErrorNotification { return; } - self.state = State::Hiding(Animation::new(1., 0., Duration::from_millis(250))); + self.state = State::Hiding(Animation::new(1., 0., 250)); } pub fn advance_animations(&mut self, target_presentation_time: Duration) { diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 36f60d12..7c381358 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -1577,7 +1577,7 @@ impl<W: LayoutElement> Layout<W> { monitor.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( current_idx, idx as f64, - Duration::from_millis(250), + 250, ))); return Some(monitor.output.clone()); diff --git a/src/layout/monitor.rs b/src/layout/monitor.rs index 383ff965..accce645 100644 --- a/src/layout/monitor.rs +++ b/src/layout/monitor.rs @@ -96,7 +96,7 @@ impl<W: LayoutElement> Monitor<W> { self.workspace_switch = Some(WorkspaceSwitch::Animation(Animation::new( current_idx, idx as f64, - Duration::from_millis(250), + 250, ))); } diff --git a/src/layout/tile.rs b/src/layout/tile.rs index dfda6fbb..be96f6e6 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -114,8 +114,7 @@ impl<W: LayoutElement> Tile<W> { } pub fn start_open_animation(&mut self) { - self.open_animation = - Some(Animation::new(0., 1., Duration::from_millis(150)).with_curve(Curve::EaseOutExpo)); + self.open_animation = Some(Animation::new(0., 1., 150).with_curve(Curve::EaseOutExpo)); } pub fn window(&self) -> &W { diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 24372074..9165d7e0 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -401,7 +401,7 @@ impl<W: LayoutElement> Workspace<W> { self.view_offset_anim = Some(Animation::new( self.view_offset as f64, new_view_offset as f64, - Duration::from_millis(250), + 250, )); } |
