Fix Emscripten rendering after SDL3 window size change (#776)

SDL3 commit 1a27b5b838f added code that overwrites window dimensions
with CSS values when external_size is detected. This broke rendering
because the window was created with browser dimensions instead of
the requested 640x480.

Force the correct window size immediately after creation to ensure
the renderer initializes with the proper dimensions.
This commit is contained in:
Christian Semmler 2026-01-30 20:59:19 -08:00 committed by GitHub
parent 33223d1169
commit f274f1b212
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -948,6 +948,12 @@ MxResult IsleApp::SetupWindow()
#endif #endif
window = SDL_CreateWindowWithProperties(props); window = SDL_CreateWindowWithProperties(props);
#ifdef __EMSCRIPTEN__
// Force correct window size since SDL3 may have picked up CSS dimensions
SDL_SetWindowSize(window, g_targetWidth, g_targetHeight);
#endif
SDL_SetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam); SDL_SetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam);
if (m_exclusiveFullScreen && m_fullScreen) { if (m_exclusiveFullScreen && m_fullScreen) {