Skip to content

Commit e55f75f

Browse files
committed
Prioritize redraws over processing updates
1 parent 03a9582 commit e55f75f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/window_handle.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub(crate) struct WindowHandle {
8181
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
8282
pub(crate) context_menu: RwSignal<Option<(Menu, Point, bool)>>,
8383
dropper_file: Option<PathBuf>,
84+
has_pending_redraw: bool,
8485
}
8586

8687
impl WindowHandle {
@@ -172,6 +173,7 @@ impl WindowHandle {
172173
context_menu,
173174
last_pointer_down: None,
174175
dropper_file: None,
176+
has_pending_redraw: false,
175177
};
176178
window_handle.app_state.set_root_size(size.get_untracked());
177179
if let Some(theme) = theme.get_untracked() {
@@ -632,6 +634,7 @@ impl WindowHandle {
632634
}
633635

634636
pub fn paint(&mut self) -> Option<peniko::Image> {
637+
self.has_pending_redraw = false;
635638
let mut cx = PaintCx {
636639
app_state: &mut self.app_state,
637640
paint_state: &mut self.paint_state,
@@ -743,7 +746,8 @@ impl WindowHandle {
743746
}
744747

745748
pub(crate) fn process_update(&mut self) {
746-
if self.process_update_no_paint() {
749+
if !self.has_pending_redraw && self.process_update_no_paint() {
750+
self.has_pending_redraw = true;
747751
self.schedule_repaint();
748752
}
749753
}

0 commit comments

Comments
 (0)