v0.20.0-alpha1
Pre-release
Pre-release
goddessfreya
released this
08 Feb 07:48
·
1458 commits
to master
since this release
- Changes below are considered breaking.
- Change all occurrences of
EventsLoop
toEventLoop
. - Previously flat API is now exposed through
event
,event_loop
,monitor
, andwindow
modules. os
module changes:- Renamed to
platform
. - All traits now have platform-specific suffixes.
- Exposes new
desktop
module on Windows, Mac, and Linux.
- Renamed to
- Changes to event loop types:
EventLoopProxy::wakeup
has been removed in favor ofsend_event
.- Major: New
run
method drives winit event loop.- Returns
!
to ensure API behaves identically across all supported platforms.- This allows
emscripten
implementation to work without lying about the API.
- This allows
ControlFlow
's variants have been replaced withWait
,WaitUntil(Instant)
,Poll
, andExit
.- Is read after
EventsCleared
is processed. Wait
waits until new events are available.WaitUntil
waits until either new events are available or the provided time has been reached.Poll
instantly resumes the event loop.Exit
aborts the event loop.
- Is read after
- Takes a closure that implements
'static + FnMut(Event<T>, &EventLoop<T>, &mut ControlFlow)
.&EventLoop<T>
is provided to allow newWindow
s to be created.
- Returns
- Major:
platform::desktop
module exposesEventLoopExtDesktop
trait withrun_return
method.- Behaves identically to
run
, but returns control flow to the calling context and can take non-'static
closures.
- Behaves identically to
EventLoop
'spoll_events
andrun_forever
methods have been removed in favor ofrun
andrun_return
.
- Changes to events:
- Remove
Event::Awakened
in favor ofEvent::UserEvent(T)
.- Can be sent with
EventLoopProxy::send_event
.
- Can be sent with
- Rename
WindowEvent::Refresh
toWindowEvent::RedrawRequested
.RedrawRequested
can be sent by the user with theWindow::request_redraw
method.
EventLoop
,EventLoopProxy
, andEvent
are now generic overT
, for use inUserEvent
.- Major: Add
NewEvents(StartCause)
,EventsCleared
, andLoopDestroyed
variants toEvent
.NewEvents
is emitted when new events are ready to be processed by event loop.StartCause
describes why new events are available, withResumeTimeReached
,Poll
,WaitCancelled
, andInit
(sent once at start of loop).
EventsCleared
is emitted when all available events have been processed.- Can be used to perform logic that depends on all events being processed (e.g. an iteration of a game loop).
LoopDestroyed
is emitted when therun
orrun_return
method is about to exit.
- Remove
- Rename
MonitorId
toMonitorHandle
. - Removed
serde
implementations fromControlFlow
. - Rename several functions to improve both internal consistency and compliance with Rust API guidelines.
- Remove
WindowBuilder::multitouch
field, since it was only implemented on a few platforms. Multitouch is always enabled now. - Breaking: On macOS, change
ns
identifiers to use snake_case for consistency with iOS'sui
identifiers. - Add
MonitorHandle::video_modes
method for retrieving supported video modes for the given monitor. - On Wayland, the window now exists even if nothing has been drawn.
- On Windows, fix initial dimensions of a fullscreen window.
- On Windows, Fix transparent borderless windows rendering wrong.