mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
doc: change remaining EventsCleared references to MainEventsCleared (#1390)
This commit is contained in:
parent
c4d07952cb
commit
ad7d4939a8
|
@ -215,10 +215,10 @@ fn setup_control_flow_observers() {
|
||||||
|
|
||||||
// Core Animation registers its `CFRunLoopObserver` that performs drawing operations in
|
// Core Animation registers its `CFRunLoopObserver` that performs drawing operations in
|
||||||
// `CA::Transaction::ensure_implicit` with a priority of `0x1e8480`. We set the main_end
|
// `CA::Transaction::ensure_implicit` with a priority of `0x1e8480`. We set the main_end
|
||||||
// priority to be 0, in order to send EventsCleared before RedrawRequested. This value was
|
// priority to be 0, in order to send MainEventsCleared before RedrawRequested. This value was
|
||||||
// chosen conservatively to guard against apple using different priorities for their redraw
|
// chosen conservatively to guard against apple using different priorities for their redraw
|
||||||
// observers in different OS's or on different devices. If it so happens that it's too
|
// observers in different OS's or on different devices. If it so happens that it's too
|
||||||
// conservative, the main symptom would be non-redraw events coming in after `EventsCleared`.
|
// conservative, the main symptom would be non-redraw events coming in after `MainEventsCleared`.
|
||||||
//
|
//
|
||||||
// The value of `0x1e8480` was determined by inspecting stack traces and the associated
|
// The value of `0x1e8480` was determined by inspecting stack traces and the associated
|
||||||
// registers for every `CFRunLoopAddObserver` call on an iPad Air 2 running iOS 11.4.
|
// registers for every `CFRunLoopAddObserver` call on an iPad Air 2 running iOS 11.4.
|
||||||
|
|
|
@ -122,7 +122,7 @@ extern "C" fn control_flow_begin_handler(
|
||||||
}
|
}
|
||||||
|
|
||||||
// end is queued with the lowest priority to ensure it is processed after other observers
|
// end is queued with the lowest priority to ensure it is processed after other observers
|
||||||
// without that, LoopDestroyed would get sent after EventsCleared
|
// without that, LoopDestroyed would get sent after MainEventsCleared
|
||||||
extern "C" fn control_flow_end_handler(
|
extern "C" fn control_flow_end_handler(
|
||||||
_: CFRunLoopObserverRef,
|
_: CFRunLoopObserverRef,
|
||||||
activity: CFRunLoopActivity,
|
activity: CFRunLoopActivity,
|
||||||
|
|
|
@ -273,7 +273,7 @@ enum RunnerState {
|
||||||
/// to be marked as cleared to send `NewEvents`, depending on the current `ControlFlow`.
|
/// to be marked as cleared to send `NewEvents`, depending on the current `ControlFlow`.
|
||||||
DeferredNewEvents(Instant),
|
DeferredNewEvents(Instant),
|
||||||
/// The event loop is handling the OS's events and sending them to the user's callback.
|
/// The event loop is handling the OS's events and sending them to the user's callback.
|
||||||
/// `NewEvents` has been sent, and `EventsCleared` hasn't.
|
/// `NewEvents` has been sent, and `MainEventsCleared` hasn't.
|
||||||
HandlingEvents,
|
HandlingEvents,
|
||||||
HandlingRedraw,
|
HandlingRedraw,
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
self.call_event_handler(Event::NewEvents(start_cause));
|
self.call_event_handler(Event::NewEvents(start_cause));
|
||||||
}
|
}
|
||||||
// This can be reached if the control flow is changed to poll during a `RedrawRequested`
|
// This can be reached if the control flow is changed to poll during a `RedrawRequested`
|
||||||
// that was sent after `EventsCleared`.
|
// that was sent after `MainEventsCleared`.
|
||||||
ControlFlow::Poll => self.call_event_handler(Event::NewEvents(StartCause::Poll)),
|
ControlFlow::Poll => self.call_event_handler(Event::NewEvents(StartCause::Poll)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,7 +451,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
|
|
||||||
fn main_events_cleared(&mut self) {
|
fn main_events_cleared(&mut self) {
|
||||||
match self.runner_state {
|
match self.runner_state {
|
||||||
// If we were handling events, send the EventsCleared message.
|
// If we were handling events, send the MainEventsCleared message.
|
||||||
RunnerState::HandlingEvents => {
|
RunnerState::HandlingEvents => {
|
||||||
self.call_event_handler(Event::MainEventsCleared);
|
self.call_event_handler(Event::MainEventsCleared);
|
||||||
self.runner_state = RunnerState::HandlingRedraw;
|
self.runner_state = RunnerState::HandlingRedraw;
|
||||||
|
@ -466,14 +466,14 @@ impl<T> EventLoopRunner<T> {
|
||||||
// branch handles those.
|
// branch handles those.
|
||||||
RunnerState::DeferredNewEvents(wait_start) => {
|
RunnerState::DeferredNewEvents(wait_start) => {
|
||||||
match self.control_flow {
|
match self.control_flow {
|
||||||
// If we had deferred a Poll, send the Poll NewEvents and EventsCleared.
|
// If we had deferred a Poll, send the Poll NewEvents and MainEventsCleared.
|
||||||
ControlFlow::Poll => {
|
ControlFlow::Poll => {
|
||||||
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
||||||
self.call_event_handler(Event::MainEventsCleared);
|
self.call_event_handler(Event::MainEventsCleared);
|
||||||
self.runner_state = RunnerState::HandlingRedraw;
|
self.runner_state = RunnerState::HandlingRedraw;
|
||||||
}
|
}
|
||||||
// If we had deferred a WaitUntil and the resume time has since been reached,
|
// If we had deferred a WaitUntil and the resume time has since been reached,
|
||||||
// send the resume notification and EventsCleared event.
|
// send the resume notification and MainEventsCleared event.
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
if Instant::now() >= resume_time {
|
if Instant::now() >= resume_time {
|
||||||
self.call_event_handler(Event::NewEvents(
|
self.call_event_handler(Event::NewEvents(
|
||||||
|
@ -496,7 +496,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
|
|
||||||
fn redraw_events_cleared(&mut self) {
|
fn redraw_events_cleared(&mut self) {
|
||||||
match self.runner_state {
|
match self.runner_state {
|
||||||
// If we were handling events, send the EventsCleared message.
|
// If we were handling events, send the MainEventsCleared message.
|
||||||
RunnerState::HandlingEvents => {
|
RunnerState::HandlingEvents => {
|
||||||
self.call_event_handler(Event::MainEventsCleared);
|
self.call_event_handler(Event::MainEventsCleared);
|
||||||
self.runner_state = RunnerState::HandlingRedraw;
|
self.runner_state = RunnerState::HandlingRedraw;
|
||||||
|
@ -518,7 +518,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
// branch handles those.
|
// branch handles those.
|
||||||
RunnerState::DeferredNewEvents(wait_start) => {
|
RunnerState::DeferredNewEvents(wait_start) => {
|
||||||
match self.control_flow {
|
match self.control_flow {
|
||||||
// If we had deferred a Poll, send the Poll NewEvents and EventsCleared.
|
// If we had deferred a Poll, send the Poll NewEvents and MainEventsCleared.
|
||||||
ControlFlow::Poll => {
|
ControlFlow::Poll => {
|
||||||
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
self.call_event_handler(Event::NewEvents(StartCause::Poll));
|
||||||
self.call_event_handler(Event::MainEventsCleared);
|
self.call_event_handler(Event::MainEventsCleared);
|
||||||
|
@ -526,7 +526,7 @@ impl<T> EventLoopRunner<T> {
|
||||||
self.call_event_handler(Event::RedrawEventsCleared);
|
self.call_event_handler(Event::RedrawEventsCleared);
|
||||||
}
|
}
|
||||||
// If we had deferred a WaitUntil and the resume time has since been reached,
|
// If we had deferred a WaitUntil and the resume time has since been reached,
|
||||||
// send the resume notification and EventsCleared event.
|
// send the resume notification and MainEventsCleared event.
|
||||||
ControlFlow::WaitUntil(resume_time) => {
|
ControlFlow::WaitUntil(resume_time) => {
|
||||||
if Instant::now() >= resume_time {
|
if Instant::now() >= resume_time {
|
||||||
self.call_event_handler(Event::NewEvents(
|
self.call_event_handler(Event::NewEvents(
|
||||||
|
|
|
@ -30,7 +30,7 @@ pub struct WindowState {
|
||||||
|
|
||||||
pub fullscreen: Option<Fullscreen>,
|
pub fullscreen: Option<Fullscreen>,
|
||||||
/// Used to supress duplicate redraw attempts when calling `request_redraw` multiple
|
/// Used to supress duplicate redraw attempts when calling `request_redraw` multiple
|
||||||
/// times in `EventsCleared`.
|
/// times in `MainEventsCleared`.
|
||||||
pub queued_out_of_band_redraw: bool,
|
pub queued_out_of_band_redraw: bool,
|
||||||
pub is_dark_mode: bool,
|
pub is_dark_mode: bool,
|
||||||
pub high_surrogate: Option<u16>,
|
pub high_surrogate: Option<u16>,
|
||||||
|
|
|
@ -392,10 +392,10 @@ impl Window {
|
||||||
/// This is the **strongly encouraged** method of redrawing windows, as it can integrate with
|
/// This is the **strongly encouraged** method of redrawing windows, as it can integrate with
|
||||||
/// OS-requested redraws (e.g. when a window gets resized).
|
/// OS-requested redraws (e.g. when a window gets resized).
|
||||||
///
|
///
|
||||||
/// This function can cause `RedrawRequested` events to be emitted after `Event::EventsCleared`
|
/// This function can cause `RedrawRequested` events to be emitted after `Event::MainEventsCleared`
|
||||||
/// but before `Event::NewEvents` if called in the following circumstances:
|
/// but before `Event::NewEvents` if called in the following circumstances:
|
||||||
/// * While processing `EventsCleared`.
|
/// * While processing `MainEventsCleared`.
|
||||||
/// * While processing a `RedrawRequested` event that was sent during `EventsCleared` or any
|
/// * While processing a `RedrawRequested` event that was sent during `MainEventsCleared` or any
|
||||||
/// directly subsequent `RedrawRequested` event.
|
/// directly subsequent `RedrawRequested` event.
|
||||||
///
|
///
|
||||||
/// ## Platform-specific
|
/// ## Platform-specific
|
||||||
|
|
Loading…
Reference in a new issue