Do not loop when animating and suspended

This commit is contained in:
Paul Rouget 2018-03-08 09:54:51 +01:00
parent 09ae72da05
commit 4ae9f3917a

View file

@ -487,9 +487,7 @@ impl Window {
} }
Event::Suspended(suspended) => { Event::Suspended(suspended) => {
self.suspended.set(suspended); self.suspended.set(suspended);
if suspended { if !suspended {
self.set_animation_state(AnimationState::Idle);
} else {
self.event_queue.borrow_mut().push(WindowEvent::Idle); self.event_queue.borrow_mut().push(WindowEvent::Idle);
} }
} }
@ -565,7 +563,7 @@ impl Window {
} }
fn is_animating(&self) -> bool { fn is_animating(&self) -> bool {
self.animation_state.get() == AnimationState::Animating self.animation_state.get() == AnimationState::Animating && !self.suspended.get()
} }
pub fn run<T>(&self, mut servo_callback: T) where T: FnMut() -> bool { pub fn run<T>(&self, mut servo_callback: T) where T: FnMut() -> bool {