diff --git a/src/window_handle.rs b/src/window_handle.rs index a83cdc51..e00b0f08 100644 --- a/src/window_handle.rs +++ b/src/window_handle.rs @@ -81,6 +81,7 @@ pub(crate) struct WindowHandle { #[cfg(any(target_os = "linux", target_os = "freebsd"))] pub(crate) context_menu: RwSignal>, dropper_file: Option, + has_pending_redraw: bool, } impl WindowHandle { @@ -172,6 +173,7 @@ impl WindowHandle { context_menu, last_pointer_down: None, dropper_file: None, + has_pending_redraw: false, }; window_handle.app_state.set_root_size(size.get_untracked()); if let Some(theme) = theme.get_untracked() { @@ -407,7 +409,7 @@ impl WindowHandle { } } - self.process_update(); + self.process_update() } pub(crate) fn scale(&mut self, scale: f64) { @@ -632,6 +634,7 @@ impl WindowHandle { } pub fn paint(&mut self) -> Option { + self.has_pending_redraw = false; let mut cx = PaintCx { app_state: &mut self.app_state, paint_state: &mut self.paint_state, @@ -743,8 +746,11 @@ impl WindowHandle { } pub(crate) fn process_update(&mut self) { - if self.process_update_no_paint() { - self.schedule_repaint(); + if !self.has_pending_redraw { + if self.process_update_no_paint() { + self.has_pending_redraw = true; + self.schedule_repaint(); + } } }