emscripten: Override emscripten's fullscreen button with SDL's implementation.
Fixes #6798. Fixes #7913. Fixes #9044.
This commit is contained in:
@@ -273,6 +273,11 @@ static void Emscripten_PumpEvents(SDL_VideoDevice *_this)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EMSCRIPTEN_KEEPALIVE void requestFullscreenThroughSDL(SDL_Window *window)
|
||||||
|
{
|
||||||
|
SDL_SetWindowFullscreen(window, true);
|
||||||
|
}
|
||||||
|
|
||||||
static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
|
static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
|
||||||
{
|
{
|
||||||
SDL_WindowData *wdata;
|
SDL_WindowData *wdata;
|
||||||
@@ -336,6 +341,13 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window,
|
|||||||
|
|
||||||
Emscripten_RegisterEventHandlers(wdata);
|
Emscripten_RegisterEventHandlers(wdata);
|
||||||
|
|
||||||
|
// disable the emscripten "fullscreen" button.
|
||||||
|
MAIN_THREAD_EM_ASM({
|
||||||
|
Module['requestFullscreen'] = function(lockPointer, resizeCanvas) {
|
||||||
|
_requestFullscreenThroughSDL($0);
|
||||||
|
};
|
||||||
|
}, window);
|
||||||
|
|
||||||
// Window has been successfully created
|
// Window has been successfully created
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -387,6 +399,9 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|||||||
SDL_free(window->internal);
|
SDL_free(window->internal);
|
||||||
window->internal = NULL;
|
window->internal = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// just ignore clicks on the fullscreen button while there's no SDL window.
|
||||||
|
MAIN_THREAD_EM_ASM({ Module['requestFullscreen'] = function(lockPointer, resizeCanvas) {}; });
|
||||||
}
|
}
|
||||||
|
|
||||||
static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_VideoDisplay *display, SDL_FullscreenOp fullscreen)
|
||||||
|
|||||||
Reference in New Issue
Block a user