diff --git a/src/sdl/window.cpp b/src/sdl/window.cpp index c426a14e0..50a8cf983 100644 --- a/src/sdl/window.cpp +++ b/src/sdl/window.cpp @@ -370,7 +370,7 @@ void Window::UpdateInput() { } break; case SDL_WINDOWEVENT: - if (event.window.event == SDL_WINDOWEVENT_RESIZED) { + if (!impl->firstFrame && event.window.event == SDL_WINDOWEVENT_RESIZED) { const int originalWidth = width_; const int originalHeight = height_; SDL_GL_GetDrawableSize(impl->sdlWindow, &width_, &height_); @@ -416,6 +416,7 @@ void Window::UpdateInput() { void Window::SwapBuffers() { SDL_GL_SwapWindow(impl->sdlWindow); + impl->firstFrame = false; } void Window::SetMouseVisible(const bool visible) { diff --git a/src/sdl/windowimpl.hpp b/src/sdl/windowimpl.hpp index 2cf6d253a..5398e95a0 100644 --- a/src/sdl/windowimpl.hpp +++ b/src/sdl/windowimpl.hpp @@ -42,6 +42,10 @@ class WindowImpl { /// For Retina screens on macOS SDL does its own scaling of mouse coordinates, etc. :( float hidpiScaleFactor; + + /// On UWP there's a bug that sometimes there are "wrong" resize events at startup (maybe due to + /// fullscreen mode?). Just skipping them until the first frame is drawn is a workaround. + bool firstFrame = true; }; } // namespace jngl