From ad7d4939a8be2e0d9436d43d0351e2f7599a4237 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Mon, 13 Jan 2020 20:15:44 +0100 Subject: [PATCH] doc: change remaining EventsCleared references to MainEventsCleared (#1390) --- src/platform_impl/ios/event_loop.rs | 4 ++-- src/platform_impl/macos/observer.rs | 2 +- src/platform_impl/windows/event_loop/runner.rs | 16 ++++++++-------- src/platform_impl/windows/window_state.rs | 2 +- src/window.rs | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/platform_impl/ios/event_loop.rs b/src/platform_impl/ios/event_loop.rs index f9f28b5a..61b389d4 100644 --- a/src/platform_impl/ios/event_loop.rs +++ b/src/platform_impl/ios/event_loop.rs @@ -215,10 +215,10 @@ fn setup_control_flow_observers() { // Core Animation registers its `CFRunLoopObserver` that performs drawing operations in // `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 // 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 // registers for every `CFRunLoopAddObserver` call on an iPad Air 2 running iOS 11.4. diff --git a/src/platform_impl/macos/observer.rs b/src/platform_impl/macos/observer.rs index edd8e994..aa7f5362 100644 --- a/src/platform_impl/macos/observer.rs +++ b/src/platform_impl/macos/observer.rs @@ -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 -// without that, LoopDestroyed would get sent after EventsCleared +// without that, LoopDestroyed would get sent after MainEventsCleared extern "C" fn control_flow_end_handler( _: CFRunLoopObserverRef, activity: CFRunLoopActivity, diff --git a/src/platform_impl/windows/event_loop/runner.rs b/src/platform_impl/windows/event_loop/runner.rs index ce376eb2..44a044d4 100644 --- a/src/platform_impl/windows/event_loop/runner.rs +++ b/src/platform_impl/windows/event_loop/runner.rs @@ -273,7 +273,7 @@ enum RunnerState { /// to be marked as cleared to send `NewEvents`, depending on the current `ControlFlow`. DeferredNewEvents(Instant), /// 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, HandlingRedraw, } @@ -408,7 +408,7 @@ impl EventLoopRunner { self.call_event_handler(Event::NewEvents(start_cause)); } // 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)), } } @@ -451,7 +451,7 @@ impl EventLoopRunner { fn main_events_cleared(&mut self) { match self.runner_state { - // If we were handling events, send the EventsCleared message. + // If we were handling events, send the MainEventsCleared message. RunnerState::HandlingEvents => { self.call_event_handler(Event::MainEventsCleared); self.runner_state = RunnerState::HandlingRedraw; @@ -466,14 +466,14 @@ impl EventLoopRunner { // branch handles those. RunnerState::DeferredNewEvents(wait_start) => { 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 => { self.call_event_handler(Event::NewEvents(StartCause::Poll)); self.call_event_handler(Event::MainEventsCleared); self.runner_state = RunnerState::HandlingRedraw; } // 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) => { if Instant::now() >= resume_time { self.call_event_handler(Event::NewEvents( @@ -496,7 +496,7 @@ impl EventLoopRunner { fn redraw_events_cleared(&mut self) { match self.runner_state { - // If we were handling events, send the EventsCleared message. + // If we were handling events, send the MainEventsCleared message. RunnerState::HandlingEvents => { self.call_event_handler(Event::MainEventsCleared); self.runner_state = RunnerState::HandlingRedraw; @@ -518,7 +518,7 @@ impl EventLoopRunner { // branch handles those. RunnerState::DeferredNewEvents(wait_start) => { 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 => { self.call_event_handler(Event::NewEvents(StartCause::Poll)); self.call_event_handler(Event::MainEventsCleared); @@ -526,7 +526,7 @@ impl EventLoopRunner { self.call_event_handler(Event::RedrawEventsCleared); } // 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) => { if Instant::now() >= resume_time { self.call_event_handler(Event::NewEvents( diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index 42cfeb7d..8150d119 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -30,7 +30,7 @@ pub struct WindowState { pub fullscreen: Option, /// 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 is_dark_mode: bool, pub high_surrogate: Option, diff --git a/src/window.rs b/src/window.rs index 0cb7c203..99644fee 100644 --- a/src/window.rs +++ b/src/window.rs @@ -392,10 +392,10 @@ impl Window { /// This is the **strongly encouraged** method of redrawing windows, as it can integrate with /// 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: - /// * While processing `EventsCleared`. - /// * While processing a `RedrawRequested` event that was sent during `EventsCleared` or any + /// * While processing `MainEventsCleared`. + /// * While processing a `RedrawRequested` event that was sent during `MainEventsCleared` or any /// directly subsequent `RedrawRequested` event. /// /// ## Platform-specific