|
|
|
@ -418,7 +418,7 @@ impl EventCtx {
|
|
|
|
|
pub const ANIM_FRAME_TIMER: TimerToken = TimerToken(1);
|
|
|
|
|
|
|
|
|
|
/// How long into the future we should schedule the animation frame timer.
|
|
|
|
|
const ANIM_FRAME_DEADLINE: Duration = Duration::from_millis(1);
|
|
|
|
|
const ANIM_FRAME_DURATION: Duration = Duration::from_millis(1);
|
|
|
|
|
|
|
|
|
|
// 0 == `TimerToken::INVALID`,
|
|
|
|
|
// 1 == `Self::ANIM_FRAME_TIMER`.
|
|
|
|
@ -464,10 +464,10 @@ impl EventCtx {
|
|
|
|
|
self.paint_requested = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Request a timer event to be delivered after `deadline` elapses.
|
|
|
|
|
pub fn request_timer(&mut self, deadline: Duration) -> TimerToken {
|
|
|
|
|
/// Request a timer event to be delivered after `duration` elapses.
|
|
|
|
|
pub fn request_timer(&mut self, duration: Duration) -> TimerToken {
|
|
|
|
|
let token = self.next_timer_token();
|
|
|
|
|
self.register_timer(token, deadline);
|
|
|
|
|
self.register_timer(token, duration);
|
|
|
|
|
token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -475,7 +475,7 @@ impl EventCtx {
|
|
|
|
|
pub fn request_anim_frame(&mut self) {
|
|
|
|
|
if !self.anim_frame_scheduled {
|
|
|
|
|
self.anim_frame_scheduled = true;
|
|
|
|
|
self.register_timer(Self::ANIM_FRAME_TIMER, Self::ANIM_FRAME_DEADLINE);
|
|
|
|
|
self.register_timer(Self::ANIM_FRAME_TIMER, Self::ANIM_FRAME_DURATION);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -549,8 +549,8 @@ impl EventCtx {
|
|
|
|
|
self.transition_out = None;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn register_timer(&mut self, token: TimerToken, deadline: Duration) {
|
|
|
|
|
if self.timers.push((token, deadline)).is_err() {
|
|
|
|
|
fn register_timer(&mut self, token: TimerToken, duration: Duration) {
|
|
|
|
|
if self.timers.push((token, duration)).is_err() {
|
|
|
|
|
// The timer queue is full, this would be a development error in the layout
|
|
|
|
|
// layer. Let's panic in the debug env.
|
|
|
|
|
#[cfg(feature = "ui_debug")]
|
|
|
|
|