Fixes missed RequestRedraw events in about_to_wait()
This fixes RequestRedraw events that can be missed in `about_to_wait()` which was reading from the cursor before `run_app_update()` is called. This adds a subsequent read to update the redraw_requested flag if any `RequestRedraw` were sent. Was reported in #16817
This commit is contained in:
parent
ad3817cc1b
commit
f47729ed48
@ -583,6 +583,15 @@ impl<T: Event> ApplicationHandler<T> for WinitAppRunnerState<T> {
|
|||||||
#[cfg(not(feature = "custom_cursor"))]
|
#[cfg(not(feature = "custom_cursor"))]
|
||||||
self.update_cursors();
|
self.update_cursors();
|
||||||
self.ran_update_since_last_redraw = true;
|
self.ran_update_since_last_redraw = true;
|
||||||
|
|
||||||
|
// Read RequestRedraw events that may have been sent during the update
|
||||||
|
if let Some(app_redraw_events) =
|
||||||
|
self.world().get_resource::<Events<RequestRedraw>>()
|
||||||
|
{
|
||||||
|
if redraw_event_reader.read(app_redraw_events).last().is_some() {
|
||||||
|
self.redraw_requested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.redraw_requested = true;
|
self.redraw_requested = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user