Skip to content

Commit c4650d2

Browse files
committed
emscripten: Move fill-document from hint/property to a window flag.
Fixes #14617.
1 parent 7773157 commit c4650d2

File tree

10 files changed

+87
-77
lines changed

10 files changed

+87
-77
lines changed

WhatsNew.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Linux:
8585
* Added SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER so you can query the wl_output associated with a display
8686

8787
Emscripten:
88-
* Added SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT for applications that don't want to be fullscreen, but would like to fill the window
88+
* Added SDL_WINDOW_FILL_DOCUMENT flag for SDL_Windows to take up the whole browser window.
8989
* Added SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING to allow setting the SDL canvas ID, and SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING to query it on existing windows
9090
* Added SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN to indicate that the window should fill the document, and SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN to query it on existing windows
9191
* Added SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING to specify where keyboard input is bound, and SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING to query it on existing windows

include/SDL3/SDL_hints.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -787,32 +787,6 @@ extern "C" {
787787
*/
788788
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
789789

790-
/**
791-
* Dictate that windows on Emscripten will fill the whole browser window.
792-
*
793-
* When enabled, the canvas element fills the entire document. Resize events
794-
* will be generated as the browser window is resized, as that will adjust the
795-
* canvas size as well. The canvas will cover anything else on the page,
796-
* including any controls provided by Emscripten in its generated HTML file
797-
* (in fact, any elements on the page that aren't the canvas will be moved
798-
* into a hidden `div` element).
799-
*
800-
* Often times this is desirable for a browser-based game, but it means
801-
* several things that we expect of an SDL window on other platforms might not
802-
* work as expected, such as minimum window sizes and aspect ratios.
803-
*
804-
* This hint overrides SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN
805-
* properties when creating an SDL window.
806-
*
807-
* This hint only applies to the Emscripten platform.
808-
*
809-
* This hint can be set at any time (before creating the window, or to toggle
810-
* its state later). Only one window can fill the document at a time.
811-
*
812-
* \since This hint is available since SDL 3.4.0.
813-
*/
814-
#define SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT "SDL_EMSCRIPTEN_FILL_DOCUMENT"
815-
816790
/**
817791
* A variable that controls whether the on-screen keyboard should be shown
818792
* when text input is active.

include/SDL3/SDL_video.h

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ typedef Uint64 SDL_WindowFlags;
215215
#define SDL_WINDOW_TOOLTIP SDL_UINT64_C(0x0000000000040000) /**< window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent window */
216216
#define SDL_WINDOW_POPUP_MENU SDL_UINT64_C(0x0000000000080000) /**< window should be treated as a popup menu, requires a parent window */
217217
#define SDL_WINDOW_KEYBOARD_GRABBED SDL_UINT64_C(0x0000000000100000) /**< window has grabbed keyboard input */
218+
#define SDL_WINDOW_FILL_DOCUMENT SDL_UINT64_C(0x0000000000200000) /**< window is in fill-document mode (Emscripten only), since SDL 3.4.0 */
218219
#define SDL_WINDOW_VULKAN SDL_UINT64_C(0x0000000010000000) /**< window usable for Vulkan surface */
219220
#define SDL_WINDOW_METAL SDL_UINT64_C(0x0000000020000000) /**< window usable for Metal view */
220221
#define SDL_WINDOW_TRANSPARENT SDL_UINT64_C(0x0000000040000000) /**< window with transparent buffer */
@@ -1370,15 +1371,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreatePopupWindow(SDL_Window *paren
13701371
*
13711372
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING`: the id given to the
13721373
* canvas element. This should start with a '#' sign
1373-
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN`: true to make
1374-
* the canvas element fill the entire document. Resize events will be
1375-
* generated as the browser window is resized, as that will adjust the
1376-
* canvas size as well. The canvas will cover anything else on the page,
1377-
* including any controls provided by Emscripten in its generated HTML file.
1378-
* Often times this is desirable for a browser-based game, but it means
1379-
* several things that we expect of an SDL window on other platforms might
1380-
* not work as expected, such as minimum window sizes and aspect ratios.
1381-
* Default false.
13821374
* - `SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`: override the
13831375
* binding element for keyboard inputs for this canvas. The variable can be
13841376
* one of:
@@ -1453,7 +1445,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_CreateWindowWithProperties(SDL_Prop
14531445
#define SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER "SDL.window.create.win32.pixel_format_hwnd"
14541446
#define SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER "SDL.window.create.x11.window"
14551447
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING "SDL.window.create.emscripten.canvas_id"
1456-
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN "SDL.window.create.emscripten.fill_document"
14571448
#define SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING "SDL.window.create.emscripten.keyboard_element"
14581449

14591450
/**
@@ -1623,9 +1614,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window)
16231614
*
16241615
* - `SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING`: the id the canvas element
16251616
* will have
1626-
* - `SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN`: true if the canvas is
1627-
* set to consume the entire browser window, bypassing some SDL window
1628-
* functionality.
16291617
* - `SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING`: the keyboard
16301618
* element that associates keyboard events to this window
16311619
*
@@ -1675,7 +1663,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window
16751663
#define SDL_PROP_WINDOW_X11_SCREEN_NUMBER "SDL.window.x11.screen"
16761664
#define SDL_PROP_WINDOW_X11_WINDOW_NUMBER "SDL.window.x11.window"
16771665
#define SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING "SDL.window.emscripten.canvas_id"
1678-
#define SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN "SDL.window.emscripten.fill_document"
16791666
#define SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING "SDL.window.emscripten.keyboard_element"
16801667

16811668
/**
@@ -1694,6 +1681,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window
16941681
* \sa SDL_MinimizeWindow
16951682
* \sa SDL_SetWindowFullscreen
16961683
* \sa SDL_SetWindowMouseGrab
1684+
* \sa SDL_SetWindowFillDocument
16971685
* \sa SDL_ShowWindow
16981686
*/
16991687
extern SDL_DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *window);
@@ -2163,6 +2151,37 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, bool
21632151
*/
21642152
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top);
21652153

2154+
/**
2155+
* Set the window to fill the current document space (Emscripten only).
2156+
*
2157+
* This will add or remove the window's `SDL_WINDOW_FILL_DOCUMENT` flag.
2158+
*
2159+
* Currently this flag only applies to the Emscripten target.
2160+
*
2161+
* When enabled, the canvas element fills the entire document. Resize events
2162+
* will be generated as the browser window is resized, as that will adjust the
2163+
* canvas size as well. The canvas will cover anything else on the page,
2164+
* including any controls provided by Emscripten in its generated HTML file
2165+
* (in fact, any elements on the page that aren't the canvas will be moved
2166+
* into a hidden `div` element).
2167+
*
2168+
* Often times this is desirable for a browser-based game, but it means
2169+
* several things that we expect of an SDL window on other platforms might not
2170+
* work as expected, such as minimum window sizes and aspect ratios.
2171+
*
2172+
* \param window the window of which to change the fill-document state.
2173+
* \param fill true to set the window to fill the document, false to disable.
2174+
* \returns true on success or false on failure; call SDL_GetError() for more
2175+
* information.
2176+
*
2177+
* \threadsafety This function should only be called on the main thread.
2178+
*
2179+
* \since This function is available since SDL 3.4.0.
2180+
*
2181+
* \sa SDL_GetWindowFlags
2182+
*/
2183+
extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFillDocument(SDL_Window *window, bool fill);
2184+
21662185
/**
21672186
* Show a window.
21682187
*

src/dynapi/SDL_dynapi.sym

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,7 @@ SDL3_0.0.0 {
12701270
SDL_RotateSurface;
12711271
SDL_LoadSurface_IO;
12721272
SDL_LoadSurface;
1273+
SDL_SetWindowFillDocument;
12731274
# extra symbols go here (don't modify this line)
12741275
local: *;
12751276
};

src/dynapi/SDL_dynapi_overrides.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,3 +1296,4 @@
12961296
#define SDL_RotateSurface SDL_RotateSurface_REAL
12971297
#define SDL_LoadSurface_IO SDL_LoadSurface_IO_REAL
12981298
#define SDL_LoadSurface SDL_LoadSurface_REAL
1299+
#define SDL_SetWindowFillDocument SDL_SetWindowFillDocument_REAL

src/dynapi/SDL_dynapi_procs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,3 +1304,4 @@ SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateAnimatedCursor,(SDL_CursorFrameInfo *a,int
13041304
SDL_DYNAPI_PROC(SDL_Surface*,SDL_RotateSurface,(SDL_Surface *a,float b),(a,b),return)
13051305
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadSurface_IO,(SDL_IOStream *a,bool b),(a,b),return)
13061306
SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadSurface,(const char *a),(a),return)
1307+
SDL_DYNAPI_PROC(bool,SDL_SetWindowFillDocument,(SDL_Window *a,bool b),(a,b),return)

src/test/SDL_test_common.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2497,6 +2497,15 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
24972497
}
24982498
}
24992499
break;
2500+
case SDLK_D:
2501+
if (withControl) {
2502+
/* Ctrl-D toggle fill-document */
2503+
SDL_Window *window = SDL_GetWindowFromEvent(event);
2504+
if (window) {
2505+
SDL_SetWindowFillDocument(window, !((SDL_GetWindowFlags(window) & SDL_WINDOW_FILL_DOCUMENT) != 0));
2506+
}
2507+
}
2508+
break;
25002509
case SDLK_P:
25012510
if (withAlt) {
25022511
/* Alt-P cycle through progress states */

src/video/SDL_sysvideo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ struct SDL_VideoDevice
312312
bool (*FlashWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_FlashOperation operation);
313313
bool (*ApplyWindowProgress)(SDL_VideoDevice *_this, SDL_Window *window);
314314
bool (*SetWindowFocusable)(SDL_VideoDevice *_this, SDL_Window *window, bool focusable);
315+
bool (*SetWindowFillDocument)(SDL_VideoDevice *_this, SDL_Window *window, bool fill);
315316
bool (*SyncWindow)(SDL_VideoDevice *_this, SDL_Window *window);
316317
bool (*ReconfigureWindow)(SDL_VideoDevice *_this, SDL_Window *window, SDL_WindowFlags flags);
317318

src/video/SDL_video.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,7 @@ SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window *window)
21992199
}
22002200

22012201
#define CREATE_FLAGS \
2202-
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT | SDL_WINDOW_NOT_FOCUSABLE)
2202+
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN | SDL_WINDOW_MINIMIZED | SDL_WINDOW_METAL | SDL_WINDOW_TRANSPARENT | SDL_WINDOW_NOT_FOCUSABLE | SDL_WINDOW_FILL_DOCUMENT)
22032203

22042204
static SDL_INLINE bool IsAcceptingDragAndDrop(void)
22052205
{
@@ -2557,6 +2557,10 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
25572557
window->external_graphics_context = external_graphics_context;
25582558
window->constrain_popup = SDL_GetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN, true);
25592559

2560+
if (!_this->SetWindowFillDocument) {
2561+
window->flags &= ~SDL_WINDOW_FILL_DOCUMENT; // not an error, just unsupported here, so remove the flag.
2562+
}
2563+
25602564
if (_this->windows) {
25612565
_this->windows->prev = window;
25622566
}
@@ -3914,6 +3918,25 @@ bool SDL_SetWindowFocusable(SDL_Window *window, bool focusable)
39143918
return true;
39153919
}
39163920

3921+
bool SDL_SetWindowFillDocument(SDL_Window *window, bool fill)
3922+
{
3923+
CHECK_WINDOW_MAGIC(window, false);
3924+
3925+
const bool want = (fill != false); // normalize the flag.
3926+
const bool have = ((window->flags & SDL_WINDOW_FILL_DOCUMENT) != 0);
3927+
if ((want != have) && (_this->SetWindowFillDocument)) {
3928+
if (!_this->SetWindowFillDocument(_this, window, want)) {
3929+
return false;
3930+
} else if (want) {
3931+
window->flags |= SDL_WINDOW_FILL_DOCUMENT;
3932+
} else {
3933+
window->flags &= ~SDL_WINDOW_FILL_DOCUMENT;
3934+
}
3935+
}
3936+
3937+
return true;
3938+
}
3939+
39173940
void SDL_UpdateWindowGrab(SDL_Window *window)
39183941
{
39193942
bool keyboard_grabbed, mouse_grabbed;

src/video/emscripten/SDL_emscriptenvideo.c

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static SDL_FullscreenResult Emscripten_SetWindowFullscreen(SDL_VideoDevice *_thi
5050
static void Emscripten_PumpEvents(SDL_VideoDevice *_this);
5151
static void Emscripten_SetWindowTitle(SDL_VideoDevice *_this, SDL_Window *window);
5252
static bool Emscripten_SetWindowIcon(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surface *icon);
53+
static bool Emscripten_SetWindowFillDocument(SDL_VideoDevice *_this, SDL_Window *window, bool fill);
5354

5455
SDL_Window *Emscripten_fill_document_window = NULL;
5556

@@ -58,11 +59,8 @@ static int pending_swap_interval = -1;
5859

5960
// Emscripten driver bootstrap functions
6061

61-
static void SDLCALL Emscripten_FillDocHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint);
62-
6362
static void Emscripten_DeleteDevice(SDL_VideoDevice *device)
6463
{
65-
SDL_RemoveHintCallback(SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT, Emscripten_FillDocHintChanged, device);
6664
SDL_free(device);
6765
}
6866

@@ -177,6 +175,7 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void)
177175
device->GetWindowSizeInPixels = Emscripten_GetWindowSizeInPixels;
178176
device->DestroyWindow = Emscripten_DestroyWindow;
179177
device->SetWindowFullscreen = Emscripten_SetWindowFullscreen;
178+
device->SetWindowFillDocument = Emscripten_SetWindowFillDocument;
180179

181180
device->CreateWindowFramebuffer = Emscripten_CreateWindowFramebuffer;
182181
device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer;
@@ -197,8 +196,6 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void)
197196
Emscripten_ListenSystemTheme();
198197
device->system_theme = Emscripten_GetSystemTheme();
199198

200-
SDL_AddHintCallback(SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT, Emscripten_FillDocHintChanged, device);
201-
202199
return device;
203200
}
204201

@@ -463,14 +460,16 @@ EMSCRIPTEN_KEEPALIVE void requestFullscreenThroughSDL(SDL_Window *window)
463460
SDL_SetWindowFullscreen(window, true);
464461
}
465462

466-
static void Emscripten_SetWindowFillDocState(SDL_Window *window, bool enable)
463+
static bool Emscripten_SetWindowFillDocument(SDL_VideoDevice *_this, SDL_Window *window, bool fill)
467464
{
468465
SDL_WindowData *wdata = window->internal;
469466

470-
SDL_assert(!Emscripten_fill_document_window || !enable); // one at a time, sorry.
467+
if (fill && Emscripten_fill_document_window && (Emscripten_fill_document_window != window)) {
468+
return SDL_SetError("Only one fill-document window allowed at a time.");
469+
}
471470

472471
// fill_document takes up the entire page and resizes as the browser window resizes.
473-
if (enable) {
472+
if (fill) {
474473
Emscripten_fill_document_window = window;
475474

476475
const int w = MAIN_THREAD_EM_ASM_INT({ return window.innerWidth; });
@@ -558,20 +557,8 @@ static void Emscripten_SetWindowFillDocState(SDL_Window *window, bool enable)
558557
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, wdata->non_fill_document_width, wdata->non_fill_document_height);
559558
}
560559
}
561-
}
562560

563-
static void SDLCALL Emscripten_FillDocHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
564-
{
565-
const bool enabled = SDL_GetStringBoolean(hint, false);
566-
if (Emscripten_fill_document_window && !enabled) {
567-
Emscripten_SetWindowFillDocState(Emscripten_fill_document_window, false);
568-
} else if (!Emscripten_fill_document_window && enabled) {
569-
/// there's currently only ever one canvas, but if this changes later, we can choose the one with keyboard focus or something.
570-
SDL_VideoDevice *device = (SDL_VideoDevice *) userdata;
571-
if (device && device->windows) { // take first window in the list for now.
572-
Emscripten_SetWindowFillDocState(device->windows, true);
573-
}
574-
}
561+
return true;
575562
}
576563

577564
static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
@@ -580,6 +567,12 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window,
580567
double css_w, css_h;
581568
const char *selector;
582569

570+
bool fill_document = ((window->flags & SDL_WINDOW_FILL_DOCUMENT) != 0);
571+
if (fill_document && Emscripten_fill_document_window) {
572+
fill_document = false; // only one allowed at a time.
573+
window->flags &= ~SDL_WINDOW_FILL_DOCUMENT; // !!! FIXME: should this fail instead?
574+
}
575+
583576
// Allocate window internal data
584577
wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData));
585578
if (!wdata) {
@@ -598,15 +591,6 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window,
598591
}
599592
wdata->keyboard_element = SDL_strdup(selector);
600593

601-
bool fill_document;
602-
if (Emscripten_fill_document_window) {
603-
fill_document = false; // only one allowed at a time.
604-
} else if (SDL_GetHint(SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT)) {
605-
fill_document = SDL_GetHintBoolean(SDL_HINT_EMSCRIPTEN_FILL_DOCUMENT, false);
606-
} else {
607-
fill_document = SDL_GetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN, false);
608-
}
609-
610594
if (window->flags & SDL_WINDOW_HIGH_PIXEL_DENSITY) {
611595
wdata->pixel_ratio = emscripten_get_device_pixel_ratio();
612596
} else {
@@ -629,7 +613,7 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window,
629613

630614
wdata->non_fill_document_width = window->w;
631615
wdata->non_fill_document_height = window->h;
632-
Emscripten_SetWindowFillDocState(window, fill_document);
616+
Emscripten_SetWindowFillDocument(_this, window, fill_document);
633617

634618
// One window, it always has focus
635619
SDL_SetMouseFocus(window);
@@ -647,7 +631,6 @@ static bool Emscripten_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window,
647631
// Ensure various things are added to the window's properties
648632
SDL_SetStringProperty(window->props, SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING, wdata->canvas_id);
649633
SDL_SetStringProperty(window->props, SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING, wdata->keyboard_element);
650-
SDL_SetBooleanProperty(window->props, SDL_PROP_WINDOW_EMSCRIPTEN_FILL_DOCUMENT_BOOLEAN, fill_document);
651634

652635
// Window has been successfully created
653636
return true;
@@ -695,9 +678,7 @@ static void Emscripten_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
695678
{
696679
SDL_WindowData *data;
697680

698-
if (Emscripten_fill_document_window == window) {
699-
Emscripten_SetWindowFillDocState(window, false);
700-
}
681+
Emscripten_SetWindowFillDocument(_this, window, false);
701682

702683
if (window->internal) {
703684
data = window->internal;

0 commit comments

Comments
 (0)