From e99740b20102be39ffeb175f702bb90df0ad0ad5 Mon Sep 17 00:00:00 2001 From: Sergii Pylypenko Date: Tue, 21 Dec 2021 02:39:35 +0200 Subject: [PATCH] Emscripten: the ultimate final fix for the screen resolution at start --- src/video/sdl2_v.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp index 48192fa335..2aa704d8e0 100644 --- a/src/video/sdl2_v.cpp +++ b/src/video/sdl2_v.cpp @@ -230,6 +230,11 @@ bool VideoDriver_SDL_Base::CreateMainSurface(uint w, uint h, bool resize) Debug(driver, 1, "SDL2: using mode {}x{}", w, h); if (!this->CreateMainWindow(w, h)) return false; +#ifdef __EMSCRIPTEN__ + int cur_w = w, cur_h = h; + SDL_GetWindowSize(this->sdl_window, &cur_w, &cur_h); + if (cur_w != (int)w || cur_h != (int)h) resize = true; +#endif if (resize) SDL_SetWindowSize(this->sdl_window, w, h); this->ClientSizeChanged(w, h, true);