summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-01-25 09:36:54 +0100
committerGitHub <noreply@github.com>2019-01-25 09:36:54 +0100
commita7525b5c132910bf2e212cb845057429f5f4587c (patch)
treedc6c54960f3151a1466ed73f7b85ffb1568ef824 /platform
parent6ad4f16b1dcbd3f3397a7e9c2a635ccc920c5647 (diff)
parent6939a032558f3e53146f0447ce74bfd78d5ed677 (diff)
Merge pull request #25302 from eska014/html5-startupfs
Allow requesting full screen during start-up in HTML5 platform
Diffstat (limited to 'platform')
-rw-r--r--platform/javascript/os_javascript.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b92634c8d6..d7ba454051 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -861,8 +861,21 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
video_driver_index = p_video_driver;
video_mode = p_desired;
- // Can't fulfill fullscreen request during start-up due to browser security.
+ // fullscreen_change_callback will correct this if the request is successful.
video_mode.fullscreen = false;
+ // Emscripten only attempts fullscreen requests if the user input callback
+ // was registered through one its own functions, so request manually for
+ // start-up fullscreen.
+ if (p_desired.fullscreen) {
+ /* clang-format off */
+ EM_ASM({
+ (canvas.requestFullscreen || canvas.msRequestFullscreen ||
+ canvas.mozRequestFullScreen || canvas.mozRequestFullscreen ||
+ canvas.webkitRequestFullscreen
+ ).call(canvas);
+ });
+ /* clang-format on */
+ }
/* clang-format off */
if (EM_ASM_INT_V({ return Module.resizeCanvasOnStart })) {
/* clang-format on */