-
Notifications
You must be signed in to change notification settings - Fork 1.2k
EventLoop 3.0 Changes #2900
Description
Considering the changes being made for run()-> Result<>, pump_events, run_ondemand, and addressing inconsistent ordering guarantees for events like MainEventsCleared and RedrawRequested, as well as removing and renaming several core events, then it feels like a similar level of change as happened for EventLoop 2.0.
The details are a bit scattered though, and although some things have been agreed as part of lengthy issue discussions we still need to track those ideas at least as a reminder as to what is left to do.
I'm going to be lite on details here, but a lot of the background discussion probably happened here #2706 and maybe a few other issues we can link back here too.
- Replace
run() ->!withrun() -> Resultas our portable run API available on all platforms (Re-work event loop run APIs: addsrun -> Result<>,run_ondemandandpump_events#2767) - Replace
run_return()withpump_events()andrun_ondemand()(for Windows, macOS, Linux + Android) (Re-work event loop run APIs: addsrun -> Result<>,run_ondemandandpump_events#2767) - Maybe add
run_noreturn() ->!extension API for iOS (discussed in Return immediately fromrun_appon web #4165) - Rename
LoopDestroyedLoopExiting(RenameLoopDestroyedtoLoopExiting#2975) - Remove
RedrawEventsCleared(Remove RedrawEventsCleared + MainEventsCleared, and add AboutToWait #2976) - Rename
MainEventsCleared->AboutToPollAboutToWait(ConceptuallyNewEventsandAboutToWaitcan be seen as a way to observe the underlying blocking/polling of the event loop - similar to registering an observer with a macOSRunLoop) (Remove RedrawEventsCleared + MainEventsCleared, and add AboutToWait #2976) - Document that
RedrawRequestedis no longer guaranteed to be delivered in order with respect to any other event - it is platform specific - Make it clearer that applications should redraw any time they get a
RedrawRequestedcallback (and they shouldn't defer the redraw outside of the winit callback). - Make it clearer that
Resumedevents are delivered on all platforms (not just mobile) andResumedevents are a good place to initialize an application because it's the first point where it's possible to start creating Windows across all platforms. - Remove lifetime from the
Event - Aim to implement
RedrawRequestedthrottling by default where there's a suitable mechanism provided by the window system- By
WM_PAINTon Windows - Either with
drawRector display link on macOS (same for iOS?) (Implement VSync source (frame pacing) #2412) - By frame callbacks on Wayland
- Via requestAnimationFrame for Web
- Maybe via Choreographer on Android
- By praying on X11
- By
I don't mind if we want to collate this information somewhere else, or in a different, better way etc but wanted to a least get a basic task list laid out somewhere
Maybe a milestone would be a nicer way to organize this?