Filter SDL_WINDOWEVENT_SHOWN after initial renderer creation

This case exists to handle the initial bringup of the renderer when
the window appears on screen. We can ignore these if we already
created a renderer, to avoid renderer re-creation if a spurious
SDL_WINDOWEVENT_SHOWN event arrives later.
This commit is contained in:
Cameron Gutman 2024-06-09 14:34:34 -05:00
parent ec7137e693
commit a0c77d0ad8

View File

@ -1948,7 +1948,8 @@ void Session::execInternal()
// We want to recreate the decoder for resizes (full-screen toggles) and the initial shown event.
// We use SDL_WINDOWEVENT_SIZE_CHANGED rather than SDL_WINDOWEVENT_RESIZED because the latter doesn't
// seem to fire when switching from windowed to full-screen on X11.
if (event.window.event != SDL_WINDOWEVENT_SIZE_CHANGED && event.window.event != SDL_WINDOWEVENT_SHOWN) {
if (event.window.event != SDL_WINDOWEVENT_SIZE_CHANGED &&
(event.window.event != SDL_WINDOWEVENT_SHOWN || m_VideoDecoder != nullptr)) {
// Check that the window display hasn't changed. If it has, we want
// to recreate the decoder to allow it to adapt to the new display.
// This will allow Pacer to pull the new display refresh rate.