fix(sctk): reduce event spam for redraw requests

This commit is contained in:
Ashley Wulber 2024-10-21 23:49:59 -04:00
parent 175a71590a
commit 90c0aefa25
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
7 changed files with 53 additions and 79 deletions

View file

@ -949,7 +949,7 @@ async fn run_instance<P>(
);
actions += 1;
}
Event::Winit(window_id, event) => {
Event::Winit(window_id, event::WindowEvent::RedrawRequested) => {
let Some(mut current_compositor) = compositor.as_mut() else {
continue;
};
@ -959,6 +959,8 @@ async fn run_instance<P>(
else {
continue;
};
// TODO only redraw when requested by event...
window.redraw_requested = false;
let physical_size = window.state.physical_size();
let mut logical_size = window.state.logical_size();
@ -1203,7 +1205,8 @@ async fn run_instance<P>(
}
},
}
}
Event::Winit(window_id, event) => {
if !is_daemon
&& matches!(event, winit::event::WindowEvent::Destroyed)
&& !is_window_opening