From 58db3a88409cd7dc58d8fec25083583ecfb2e23f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joel=20H=C3=B6ner?= Date: Tue, 30 Jan 2024 20:32:46 +0100 Subject: [PATCH] Make `request_repaint_after` actually respect the delay The branch that sets the repaint_delay to MAX was previously never actually taken, causing the repaint_delay to never be reset to MAX. This in turn effectively turn request_repaint_after into being equivalent to simply calling request_repaint, because the former only updates the repaint_time if it is shorter than the previous value. --- crates/egui/src/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index fa00bddff3c..f31ba38bd04 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -113,13 +113,13 @@ impl ContextImpl { let viewport = self.viewports.entry(viewport_id).or_default(); viewport.repaint.prev_frame_paint_delay = viewport.repaint.repaint_delay; + viewport.repaint.outstanding = viewport.repaint.outstanding.saturating_sub(1); if viewport.repaint.outstanding == 0 { // We are repainting now, so we can wait a while for the next repaint. viewport.repaint.repaint_delay = Duration::MAX; } else { viewport.repaint.repaint_delay = Duration::ZERO; - viewport.repaint.outstanding -= 1; if let Some(callback) = &self.request_repaint_callback { (callback)(RequestRepaintInfo { viewport_id,