winit-sonoma-fix/examples
Robert Bragg ae7497e18f
Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait
The idea that redraw events are dispatched with a specific ordering
that makes it possible to specifically report when we have finished
dispatching redraw events isn't portable and the way in which we
dispatched RedrawEventsCleared was inconsistent across backends.

More generally speaking, there is no inherent relationship between
redrawing and event loop iterations. An event loop may wake up at any
frequency depending on what sources of input events are being listened
to but redrawing is generally throttled and in some way synchronized
with the display frequency.

Similarly there's no inherent relationship between a single event loop
iteration and the dispatching of any specific kind of "main" event.

An event loop wakes up when there are events to read (e.g. input
events or responses from a display server / compositor) and goes back
to waiting when there's nothing else to read.

There isn't really a special kind of "main" event that is dispatched
in order with respect to other events.

What we can do more portably is emit an event when the event loop
is about to block and wait for new events.

In practice this is very similar to how MainEventsCleared was
implemented except it wasn't the very last event previously since
redraw events could be dispatched afterwards.

The main backend where we don't strictly know when we're going to
wait for events is Web (since the real event loop is internal to
the browser). For now we emulate AboutToWait on Web similar to how
MainEventsCleared was dispatched.

In practice most applications almost certainly shouldn't care about
AboutToWait because the frequency of event loop iterations is
essentially arbitrary and usually irrelevant.
2023-07-28 20:37:56 +04:00
..
util Disallow cleanup for TLS in examples 2023-06-26 01:04:38 +04:00
child_window.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
control_flow.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
cursor.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
cursor_grab.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
custom_events.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
drag_window.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
fullscreen.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
handling_close.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
icon.png Window icons (#497) 2018-05-07 17:36:21 -04:00
ime.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
key_binding.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
monitor_list.rs Properly print outputs in monitor_list example 2023-01-30 14:17:41 +03:00
mouse_wheel.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
multithreaded.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
multiwindow.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
request_redraw.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
request_redraw_threaded.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
resizable.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
startup_notification.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
theme.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
timer.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
touchpad_gestures.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
transparent.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
video_modes.rs Fix clippy issues on stable 2023-01-27 07:18:58 +03:00
web.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
web_aspect_ratio.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
window.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
window_buttons.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
window_debug.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
window_drag_resize.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
window_icon.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00
window_ondemand.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
window_option_as_alt.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
window_pump_events.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
window_resize_increments.rs Remove RedrawEventsCleared + MainEventsCleared, and added AboutToWait 2023-07-28 20:37:56 +04:00
window_tabbing.rs Re-work event loop run() API so it can return a Result 2023-07-28 03:04:32 +04:00