-
Notifications
You must be signed in to change notification settings - Fork 912
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discussion: mobile and web Window creation APIs #696
Comments
I completely understand the motivation for this, and I'll provide more feedback on this issue once I've cobbled together an EventLoop2.0 implementation for iOS. Some early feedback: |
@mtak- Yeah, that's my biggest concern with this. Something we could do is have |
@Osspial I'm 100% on board with platform-specific extension traits. By analogy: If I get annoyed having to carry around Sometime later, hmm, I guess this needs to work on Windows too. Okay, |
@willglynn Thanks for the feedback! Also, you seem to have a decent amount of experience with how Emscripten works, from the Event Loop 2.0 discussion thread - does that backend align with how this API works? The impression I've gotten from skimming the source code/Emscripten documentation is that the web browser creates a canvas and then Emscripten users request access to that canvas to draw on, which seems to be pretty similar to how mobile platforms work. If that's the case it would make sense to expose mobile and web canvases through the same API, but I'm not experienced enough with either to be 100% certain that that's how stuff works. |
I left some feedback related to EventLoop2.0 here. Some additional feedback:
What about having a |
@mtak- I don't think Should Hmm, so maybe My issue with implementing this as |
//! - applicationDidBecomeActive is WindowEvent::Focused(true)
//! - applicationWillResignActive is WindowEvent::Focused(false)
//! - applicationDidEnterBackground is Suspended(true)
//! - applicationWillEnterForeground is Suspended(false) Looking at our other shipped (c++) games, we actually don't use
iOS supports multiple I think I'm leaning towards wanting |
@mtak- On iOS, what happens if you do have multiple The main reason I can see for a mobile application to create a separate window is to have a picture-in-picture window. Is there any other reason I'm missing? If there is, fully adopting this API in its current form may not be the best move. |
@Osspial Having some sort of Alert window is also a good use case. In our other games we'll sometimes call out to apis to have users pick a custom backdrop, which I imagine is another Here's a photo of winit with two windows. One on the apple tv and one, not fullscreen window, on the phone. It's definitely not a common use case, but not something we should make impossible. In the topright corner theres a screenshot of both windows on the same Monitor (i.e. the phone itself). EDIT: the brown square is one window, the pink background thingy with the servo logo is another. |
@mtak- Thanks! So there are three windows in that picture (The Apple TV one, the brown box, and the pink background with the servo logo)? How does multi-monitor work on iOS? Does the Window on the Apple TV share the same window coordinate space as the ones on the iPhone screen, or do they have different coordinate spaces? We should also look into how Android handles multi-window applications/multiple displays, as that may also align more closely with how desktop windows work than may be immediately apparent. |
@Osspial I could have explained that image better. There's two images merged into one (I thought it'd look less spammy that way). One is a photo, and one is a screenshot (top right). Screenshot (topright corner):
Photo:
The monitors have different coordinate spaces and AFAICT there's no way to convert between them. Actually, there is a way, it just gives back |
I don't mean to revive an old thread, but I'm currently working on #589 again now that eventloop 2.0 is in a more ready state. I would agree that a View API would probably make sense, because a lot of the existing Window APIs don't translate well to the web. |
So, this issue is several years old, and not really actionable any more, so I'm going to close it. Multiple windows should be possible on both iOS and the web, on Android each window is run in its own process, and as such not really possible for Winit to support (CC #3505). We might want to add some sort of subsurface / view support, if you want that feel free to open a new issue, though honestly, I think it can and should be kept out of Winit. |
Not at all, anything related to the same app (services, multiple This is actually an open issue, where certain Android system interactions can cause it (the Android system) to launch another It is however unlikely to have multiple windows open at the same time, bar tricks with multiple task stacks, split-window, popout windows and perhaps desktop mode. |
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
.View
exposeslist_views(&EventsLoop) -> impl Iterator<View>
, which gets an iterator over all windows the OS provides.View
exposes 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.mobile
ViewExt
with the following methods:set_valid_orientations(ValidScreenOrientations)
: used to set the valid screen orientations.ValidScreenOrientations
struct, defined as followed:emscripten
ViewExt
with 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
WindowBorrowed
toView
since that's a better name for it, and added a reference toEventsLoop
inlist_views
.The text was updated successfully, but these errors were encountered: