Return an Option
from Window::raw_window_handle()
+ add WindowConfigured
event
#2769
Labels
S - api
Design and usability
Milestone
It's not great that the Android backend will simply panic if
Window::raw_window_handle()
is called while the app is suspended and it would be nicer if the API instead returned anOption
to convey when no handle is currently available.Winit could then promise/guarantee that a handle will always be available for
RedrawRequested
events and it would be platform-dependent whether a handle is also be accessible outside of redraw events.This could potentially also benefit the Wayland backend which has to wait for an ack from the compositor before a raw handle should be accessible for creating graphics API surfaces after creating a new
Window
. (Right now the wayland backend has to synchronously wait for a compositor round trip inWindow::new
and this is also having a pretty significant impact on the backend's internal design because it needs to have a buffering abstraction to avoid a reentrancy problem)To help give applications a natural place to initialize graphics API surfaces (i.e. egl,vulkan/wgpu surfaces) for new windows, then we could also add a
WindowConfigured
orWindowReady
event that all backends will be guaranteed to dispatch once for any new window at the earliest point at which a raw-window-handle is accessible.The text was updated successfully, but these errors were encountered: