From 0afbdd1a5d637642e49f03adda1e75bbe68b12e4 Mon Sep 17 00:00:00 2001 From: Ilya Filtsin Date: Sat, 25 Feb 2023 22:42:32 +0300 Subject: [PATCH] Wrap animator in main proceed thread --- src/main.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index e09e9e8..a9f9056 100644 --- a/src/main.rs +++ b/src/main.rs @@ -256,7 +256,7 @@ fn main_inner() { surface::EventStatus::Idle => {} }; - if animator.proceed() { + if animations && animator.proceed() { should_redraw = true } @@ -273,9 +273,14 @@ fn main_inner() { } display.flush().unwrap(); - event_loop - .dispatch(animator.proceed_step(), &mut ()) - .unwrap(); + + let timeout = if animations { + animator.proceed_step() + } else { + None + }; + + event_loop.dispatch(timeout, &mut ()).unwrap(); } }