On Web, fix async Window::set_fullscreen#2751
Merged
daxpedda merged 1 commit intorust-windowing:masterfrom May 31, 2023
Merged
Conversation
Window::set_fullscreenWindow::set_fullscreen
22dc402 to
2352a8f
Compare
Member
Author
|
I decided to go ahead and implement properly handling the return value of I had to pull in |
daxpedda
commented
Mar 28, 2023
2352a8f to
6969e94
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently the behavior of
Window::set_fullscreen()on Web queues the request to the current or next keyboard or mouse event. This doesn't work ifWindow::set_fullscreen()is called asynchronously outside the event loop.This was probably done to satisfy the transient activation requirement for
requestFullscreen(). But transient activation doesn't run out during the event loop, it's time based, usually one second.This PR adjusts
Window::set_fullscreen()to immediately callrequestFullscreen(), only on failure a request is queued. This required some custom imports because the API was changed in the spec to return aPromiseandweb-sysdoesn't reflect that change. Additionally Safari doesn't reflect that change before 16.4 (which came out today (2023-03-28)) too. So both APIs are now supported.Additionally I noticed that the behavior of
Window::set_fullscreen()on Web was undocumented, so I added some.