Skip to content

Commit

Permalink
Make request_repaint_after actually respect the delay
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
athre0z committed Jan 30, 2024
1 parent d72f92c commit 58db3a8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 58db3a8

Please sign in to comment.