Scroll to navigation

SDL_SetWindowFillDocument(3) SDL3 FUNCTIONS SDL_SetWindowFillDocument(3)

NAME

SDL_SetWindowFillDocument - Set the window to fill the current document space (Emscripten only).

SYNOPSIS

#include <SDL3/SDL_video.h>
bool SDL_SetWindowFillDocument(SDL_Window *window, bool fill);

DESCRIPTION

This will add or remove the window's SDL_WINDOW_FILL_DOCUMENT flag.

Currently this flag only applies to the Emscripten target.

When enabled, the canvas element fills the entire document. Resize events will be generated as the browser window is resized, as that will adjust the canvas size as well. The canvas will cover anything else on the page, including any controls provided by Emscripten in its generated HTML file (in fact, any elements on the page that aren't the canvas will be moved into a hidden div element).

Often times this is desirable for a browser-based game, but it means several things that we expect of an SDL window on other platforms might not work as expected, such as minimum window sizes and aspect ratios.

FUNCTION PARAMETERS

the window of which to change the fill-document state.
true to set the window to fill the document, false to disable.

RETURN VALUE

Returns true on success or false on failure; call SDL_GetError() for more information.

THREAD SAFETY

This function should only be called on the main thread.

AVAILABILITY

This function is available since SDL 3.4.0.

SEE ALSO

SDL_GetWindowFlags(3)

SDL 3.3.4 Simple Directmedia Layer