From 48e8f6262ee28aea6a21f952f4d118073a4c61a9 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:10:21 +0900 Subject: [PATCH 1/2] Update run.rs --- crates/eframe/src/native/run.rs | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/crates/eframe/src/native/run.rs b/crates/eframe/src/native/run.rs index 61585f9bb4a..84b2de60937 100644 --- a/crates/eframe/src/native/run.rs +++ b/crates/eframe/src/native/run.rs @@ -92,7 +92,6 @@ impl WinitAppWrapper { if cfg!(target_os = "windows") { // Fix flickering on Windows, see https://github.com/emilk/egui/pull/2280 - self.windows_next_repaint_times.remove(&window_id); self.winit_app.run_ui_and_paint(event_loop, window_id) } else { // Fix for https://github.com/emilk/egui/issues/2425 @@ -148,32 +147,26 @@ impl WinitAppWrapper { } fn check_redraw_requests(&mut self, event_loop: &ActiveEventLoop) { - let mut next_repaint_time = self.windows_next_repaint_times.values().min().copied(); + let now = Instant::now(); self.windows_next_repaint_times .retain(|window_id, repaint_time| { - if Instant::now() < *repaint_time { + if now < *repaint_time { return true; // not yet ready }; - next_repaint_time = None; event_loop.set_control_flow(ControlFlow::Poll); if let Some(window) = self.winit_app.window(*window_id) { log::trace!("request_redraw for {window_id:?}"); - let is_minimized = window.is_minimized().unwrap_or(false); - if is_minimized { - false - } else { - window.request_redraw(); - true - } + window.request_redraw(); } else { log::trace!("No window found for {window_id:?}"); - false } + false }); + let next_repaint_time = self.windows_next_repaint_times.values().min().copied(); if let Some(next_repaint_time) = next_repaint_time { event_loop.set_control_flow(ControlFlow::WaitUntil(next_repaint_time)); }; @@ -282,7 +275,6 @@ impl ApplicationHandler for WinitAppWrapper { event_loop_context::with_event_loop_context(event_loop, move || { let event_result = match event { winit::event::WindowEvent::RedrawRequested => { - self.windows_next_repaint_times.remove(&window_id); self.winit_app.run_ui_and_paint(event_loop, window_id) } _ => self.winit_app.window_event(event_loop, window_id, event), From 8f7369609197ef2616c8aa428332bd8f32ce4d18 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Sun, 1 Sep 2024 00:20:50 +0900 Subject: [PATCH 2/2] Update shadow.rs --- crates/epaint/src/shadow.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/epaint/src/shadow.rs b/crates/epaint/src/shadow.rs index ea6454f99cf..bb386d21dc7 100644 --- a/crates/epaint/src/shadow.rs +++ b/crates/epaint/src/shadow.rs @@ -11,7 +11,7 @@ pub struct Shadow { /// Move the shadow by this much. /// /// For instance, a value of `[1.0, 2.0]` will move the shadow 1 point to the right and 2 points down, - /// causing a drop-shadow effet. + /// causing a drop-shadow effect. pub offset: Vec2, /// The width of the blur, i.e. the width of the fuzzy penumbra.