-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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() -> Result
as our portable run API available on all platforms (Re-work event loop run APIs: addsrun -> Result<>
,run_ondemand
andpump_events
#2767) - Replace
run_return()
withpump_events()
andrun_ondemand()
(for Windows, macOS, Linux + Android) (Re-work event loop run APIs: addsrun -> Result<>
,run_ondemand
andpump_events
#2767) - Maybe add
run_noreturn() ->!
extension API for iOS - Rename
LoopDestroyed
LoopExiting
(RenameLoopDestroyed
toLoopExiting
#2975) - Remove
RedrawEventsCleared
(Remove RedrawEventsCleared + MainEventsCleared, and add AboutToWait #2976) - Rename
MainEventsCleared
->AboutToPoll
AboutToWait
(ConceptuallyNewEvents
andAboutToWait
can 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
RedrawRequested
is 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
RedrawRequested
callback (and they shouldn't defer the redraw outside of the winit callback). - Make it clearer that
Resumed
events are delivered on all platforms (not just mobile) andResumed
events 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
RedrawRequested
throttling by default where there's a suitable mechanism provided by the window system- By
WM_PAINT
on Windows - Either with
drawRect
or display link on macOS (same for iOS?) - 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?