-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Discussion: mobile and web Window creation APIs #696
Copy link
Copy link
Closed
Labels
C - needs discussionDirection must be ironed outDirection must be ironed outDS - androidAffects the Android backendAffects the Android backendDS - uikitAffects the UIKit backend (iOS, tvOS, watchOS, visionOS)Affects the UIKit backend (iOS, tvOS, watchOS, visionOS)DS - webAffects the Web backend (WebAssembly/WASM)Affects the Web backend (WebAssembly/WASM)S - apiDesign and usabilityDesign and usability
Metadata
Metadata
Assignees
Labels
C - needs discussionDirection must be ironed outDirection must be ironed outDS - androidAffects the Android backendAffects the Android backendDS - uikitAffects the UIKit backend (iOS, tvOS, watchOS, visionOS)Affects the UIKit backend (iOS, tvOS, watchOS, visionOS)DS - webAffects the Web backend (WebAssembly/WASM)Affects the Web backend (WebAssembly/WASM)S - apiDesign and usabilityDesign and usability
Right now, Winit exposes window creation and modification functionality the same way on all platforms. Is that something that makes sense? On mobile, only one function in
WindowBuilder(with_multitouch) actually does anything, and only three functions inWindow(get_hidpi_factor,get_inner_size, andget_outer_size) do anything useful. A few more functions are implemented for Emscripten, but it has much more in common with mobile platforms than it does with desktop platforms.Should we expose an entirely different window structure for these platforms that better reflects the underlying capabilities? I don't have much experience with those platforms, but I've written up an example of what I think that sort of API would look like:
View.Viewexposeslist_views(&EventsLoop) -> impl Iterator<View>, which gets an iterator over all windows the OS provides.Viewexposes the following methods:set_multitouch(&self, bool): enables or disables multitouch support.get_hidpi_factor(&self) -> f32: gets the HiDPI factor.get_size(&self) -> LogicalSize: gets the window's size.mobileViewExtwith the following methods:set_valid_orientations(ValidScreenOrientations): used to set the valid screen orientations.ValidScreenOrientationsstruct, defined as followed:emscriptenViewExtwith the following methods:set_fullscreen(bool): sets if the window is fullscreen or notgrab_cursor(bool): grabs or ungrabs the cursorhide_cursor(bool): hides or shows the cursorThat design may be infeasible one way or another, so any API corrections are appreciated.
Relevant to #33
cc @francesca64 @seivan @mtak- @willglynn
EDIT: Renamed
WindowBorrowedtoViewsince that's a better name for it, and added a reference toEventsLoopinlist_views.