Skip to content
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

HTML5 Godot will not detect FullScreen if entered via browser/f11 request. #90032

Open
PeterMarques opened this issue Mar 30, 2024 · 2 comments

Comments

@PeterMarques
Copy link

PeterMarques commented Mar 30, 2024

Tested versions

3.x

System information

web (Chromium)

Issue description

This behaviour mathes the one partialy described on https://stackoverflow.com/questions/27501409/exit-full-screen-using-f11-key-and-esc-key

What happen is, OS.window_fullscreen will only return True if godot itself asked for the fullscreen.

If user press f11 (when intercepted by brower, not captured inside godot), or go to hamburger menu and click fullscreen,
OS.window_fullscreen will not return true.

Indeed fullscreen godot shows ESC, and fullscreen browser shows F11;

this prevents good fullscreen behaviour management.

Steps to reproduce

Acess this and enter fullscreen via input and via browser request.

Minimal reproduction project (MRP)

A single label node with the script:

extends Label
func _process(delta):
	text = str(OS.window_fullscreen)
func _input(event):
	if !OS.window_fullscreen and event is InputEventMouseMotion == false:
		OS.window_fullscreen = true

AND.

After entering via browser request one can RE-ENTER fullscreen, and detect true.

Then, one can EXIT 2 TIMES FULLSCREEEN.
The first time via ESC, now detection goes back to false, but viewport is still fullscreen
Then, using F11, one can really exit fullscreen.
OR
Diretly pressing f11 will exit "both" fullscreen at the same time.


Well, it seens that F11 put the BROWSER on fullscreen, and the engine request put the "page?".

So, maybe its 2 classes of fullscreen available. Idk.

Needs testing and a further investigation on apis.

@hsandt
Copy link
Contributor

hsandt commented May 31, 2024

Godot 4 test

I tested on v4.2.1.stable.official [b09f793] with the equivalent DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN or DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN on itch.io (so I can click outside game and press F11 for a browser fullscreen, not in-game fullscreen) and it seems to lock DisplayServer.window_get_mode() to one value that is not fullscreen nor exclusive fullscreen (haven't debugged the exact value yet, possibly DisplayServer.WINDOW_MODE_WINDOWED). As a result both my in-game fullscreen toggle option and my keyboard shortcuts to toggle fullscreen based on current state are broken (only force setting window mode to a certain value should work).

Note: itch.io can add a custom bottom-right button on top of the HTML template to toggle "real" fullscreen (fullscreen on embedded game, not page) and this one is fully compatible with the Godot window mode change. So I'll tell users not to use browser page fullscreen for now.

hsandt added a commit to hsandt/lospec-jam-2-scaled-down-adventures that referenced this issue May 31, 2024
…he new value

instead of blindly toggling.

This should help when using an external way to toggle (debug shortcuts, web fullscreen)

Note that web page external fullscreen (not focusing Godot game) is still broken (godotengine/godot#90032), but this is compatible with web focusing game fullscreen (via keyboard shortcut or HTML fullscreen button)
@Calinou
Copy link
Member

Calinou commented Jun 1, 2024

Detecting browser fullscreen sounds difficult to detect in a 100% reliable manner, unless browsers have an API they reliably use to be able to query whether the browser has just entered/exited fullscreen. You'd expect to be able to compare the canvas size to the display size whenever the canvas size changes, but there are several complications that can arise due to multi-monitor setups (I don't know how web browsers handle this).

Also, many browsers intentionally report a false screen resolution in an attempt to thwart fingerprinting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants