[rcore] Fix fullscreen known issue 1 for PLATFORM_WEB#3642
Conversation
Owner
|
@ubkp Wow! Thank you very much for the review and the detailed report about the fix and multiple fullscreen switch possibilities! You really analyzed probably all switch cases! Amazing work! |
Author
|
@raysan5 Thank you! Glad to help. :) |
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.
Context
SetWindowState(FLAG_FULLSCREEN_MODE)will activate the "standard fullscreen" only when:SetWindowState(FLAG_BORDERLESS_WINDOWED_MODE)will activate the "borderless windowed fullscreen" only when:ClearWindowState(FLAG_FULLSCREEN_MODE)will only leave "fullscreen" if "standard fullscreen" (either ours or external, aka, called by a button) is active.ClearWindowState(FLAG_BORDERLESS_WINDOWED_MODE)will only leave "fullscreen" if "borderless windowed fullscreen" (either ours or external, aka, called by a button) is active.Changes
Fixes [rcore] Add
ToggleFullscreen()implementation forPLATFORM_WEB#3634 e. Known issues 1 (i, ii, iii, iv).Does that by implemented the behavior described on the Context section in the following way:
For
SetWindowState(FLAG_FULLSCREEN_MODE):ToggleFullscreen()(R348).FLAG_BORDERLESS_WINDOWED_MODEor if it's an "external" "borderless windowed fullscreen" (that is done by check if thescreenWidthis equal to thecanvasWidth). If it's some kind of "borderless windowed fullscreen", it will thenToggleFullscreen()("hot swap") (R344-R346).For
SetWindowState(FLAG_BORDERLESS_WINDOWED_MODE):ToggleBorderlessWindowed()(R334).FLAG_FULLSCREEN_MODEor if it's an "external" "standard fullscreen" (that is done by check if thecanvasStyleWidthis larger than thecanvasWidth). If it's some kind of "standard fullscreen", it will thenToggleBorderlessWindowed()("hot swap") (R330-R332).For
ClearWindowState(FLAG_FULLSCREEN_MODE):FLAG_FULLSCREEN_MODEor if it's an "external" "standard fullscreen" (that is done by check if thecanvasStyleWidthis larger than thecanvasWidth). If it's some kind of "standard fullscreen", it will then leave "fullscreen" (R466-R468).For
ClearWindowState(FLAG_BORDERLESS_WINDOWED_MODE):FLAG_BORDERLESS_WINDOWED_MODEor if it's an "external" "borderless windowed fullscreen" (that is done by check if thescreenWidthis equal to thecanvasWidth). If it's some kind of "borderless windowed fullscreen", it will then leave "fullscreen" (R452-R454).Adjusts the
ToggleFullscreen()implementation by:FLAG_BORDERLESS_WINDOWED_MODE("hot swap") (R151).canvasStyleWidthis larger than thecanvasWidth(R154-R157).Adjusts the
ToggleBorderlessWindowed()implementation by:FLAG_FULLSCREEN_MODE("hot swap") (R258).screenWidthis equal to thecanvasWidth(R261-R264).References
[rcore] Add
ToggleFullscreen()implementation forPLATFORM_WEB#3634e. Known issues 1 (i, ii, iii, iv).
Notes
Note
Although there's a lot of mentions of Toggles "hot swap" on the PR, everything related to that is very easy to remove/revert if/when necessary.
Important
The checking for
canvasWidth,canvasStyleWidthandscreenWidthis necessary (regardless of Toggles "hot swap") because we still need to identify external "fullscreen" equivalents to ours (e.g.: like the ones issues by web page buttons).Code example
PLATFORM_WEB(requiresASYNCIFY) with:Tip
Just while testing this PR, it helps adding a second fullscreen button to
shell.htmlthat will call a "borderless windowed fullscreen". For example, by adding the following between lines L181-L182:<span><input type="button" value="BORDERLESS" onclick="Module.requestFullscreen(false, true)"></span>Environment
Linux(Ubuntu 22.04 64-bit) and tested onFirefox(115.3.1esr 64-bit) andChromium(117.0.5938.149 64-bit) for bothminshell.htmlandshell.htmlfiles.Edits