-
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
Web support tracking issue #1072
Comments
Before proceeding, I think we need to get on the same page on how to tackle some of these last features.
How would this work? We need to keep in mind that right now canvases have a "local" scope. We could attach a Ideally, we should be able to detect if a particular canvas has been "closed". But when do we consider a canvas to be closed? When it's removed from the DOM? That wouldn't work because a user may want to reinsert the canvas and keep using it. I am not sure there is a reasonable implementation for this. I am inclined to simply state that a canvas cannot be closed, and ask our users to take care of any unload wiring themselves (the same way we ask them to insert the canvas freely).
These ones are also tricky. Anything that touches global state (i.e. I think I would simply let users handle this too. At least for now. Users will be able to make better informed decisions as they will know exactly how many canvases they will be dealing with.
I think this should be left to the users of the API, as we don't currently have a concept of "main" canvas. |
I think that closing events are a part of the event loop contract at least, so we could emit a LoopDestroyed event when the browser tab is being closed. I agree that individual canvases should have no concept of being closed.
Fullscreen support with n canvases should be fine: the browser interface doesn't give us access to monitors anyway, so we can just fullscreen the canvas whenever a window requests it. I agree that maximization is trickier, and would be very in favor of Not Bothering. Implementing a WM in the browser is not within scope (hopefully).
I'm inclined to say that we should at least try to solve this. If I create exactly one window, then applying that window's title and favicon to the entire tab makes sense. If I create two, it no longer does. I'm not sure it would be possible to special-case, though. |
Sounds good to me 👍
Is there a canvas API to achieve this? As far as I know, we will need to overlay the canvas on top of everything and fix its size to the window.
I don't think this is particularly true. One of the main use cases that I want to be able to satisfy with I guess we could create an extension trait that allows marking a window as the "main window", but that kind of API will be allowing multiple windows to be marked as main ones and cause title / favicon fighting. Overall, it can make |
There's a general purpose Fullscreen API that allows fullscreening a single Element and all its children: https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
That's a very good point, I now agree that winit should keep away from the title and favicon. |
Oh wow! That is a really neat API I had no clue about! Great news. I agree we should take care of it then! |
It seems like the only web API that we could use to do something like cursor grab (the Pointer Lock API) also inherently hides the mouse cursor by default, and only sort-of allows something like a cursor grab. Possibly we can add it as a platform-specific extension, but I think that should be after we merge the web version to master. |
There will be a little bit of book-keeping that Winit will have to do for supporting fullscreen properly, which is maintaining the size of the canvas and sending resize events. This shouldn't be too complex so I think it's still a good idea to add support for fullscreen. |
Awesome work! Is this closed by #1221? |
Yup, I've moved the checkbox for web's RedrawRequested API to the tracking issue itself. Since web support has shipped on master, we're good to close this. |
Support cursor grabSupport maximizing a canvasFinalize decision on how to handle VideoModeThe text was updated successfully, but these errors were encountered: