Reorder request_redraw checks so that the update_mode logic is localized
This commit is contained in:
parent
bf645cff79
commit
4c116a90e6
@ -650,10 +650,12 @@ impl<T: Event> WinitAppRunnerState<T> {
|
|||||||
self.redraw_requested = true;
|
self.redraw_requested = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Running the app may have changed the WinitSettings resource, so we have to re-extract it.
|
// Read RequestRedraw events that may have been sent during the update
|
||||||
let (config, windows) = focused_windows_state.get(self.world());
|
if let Some(app_redraw_events) = self.world().get_resource::<Events<RequestRedraw>>() {
|
||||||
let focused = windows.iter().any(|(_, window)| window.focused);
|
if redraw_event_reader.read(app_redraw_events).last().is_some() {
|
||||||
update_mode = config.update_mode(focused);
|
self.redraw_requested = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Running the app may have produced WindowCloseRequested events that should be processed
|
// Running the app may have produced WindowCloseRequested events that should be processed
|
||||||
if let Some(close_request_events) =
|
if let Some(close_request_events) =
|
||||||
@ -668,12 +670,10 @@ impl<T: Event> WinitAppRunnerState<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read RequestRedraw events that may have been sent during the update
|
// Running the app may have changed the WinitSettings resource, so we have to re-extract it.
|
||||||
if let Some(app_redraw_events) = self.world().get_resource::<Events<RequestRedraw>>() {
|
let (config, windows) = focused_windows_state.get(self.world());
|
||||||
if redraw_event_reader.read(app_redraw_events).last().is_some() {
|
let focused = windows.iter().any(|(_, window)| window.focused);
|
||||||
self.redraw_requested = true;
|
update_mode = config.update_mode(focused);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The update mode could have been changed, so we need to redraw and force an update
|
// The update mode could have been changed, so we need to redraw and force an update
|
||||||
|
Loading…
Reference in New Issue
Block a user