mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-02-26 11:47:11 +00:00
Flush all window events after SDL_CreateRenderer()
This commit is contained in:
parent
2aa18dc88f
commit
b4548c1af2
2 changed files with 14 additions and 0 deletions
|
@ -1251,6 +1251,12 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||
SDL_SetWindowPosition(m_Window, x, y);
|
||||
}
|
||||
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Recreating renderer for window event: %d (%d %d)",
|
||||
event.window.event,
|
||||
event.window.data1,
|
||||
event.window.data2);
|
||||
|
||||
// Fall through
|
||||
case SDL_RENDER_DEVICE_RESET:
|
||||
case SDL_RENDER_TARGETS_RESET:
|
||||
|
|
|
@ -177,6 +177,14 @@ bool SdlRenderer::initialize(PDECODER_PARAMETERS params)
|
|||
return false;
|
||||
}
|
||||
|
||||
// SDL_CreateRenderer() can end up having to recreate our window (SDL_RecreateWindow())
|
||||
// to ensure it's compatible with the renderer's OpenGL context. If that happens, we
|
||||
// can get spurious SDL_WINDOWEVENT events that will cause us to (again) recreate our
|
||||
// renderer. This can lead to an infinite to renderer recreation, so discard all
|
||||
// SDL_WINDOWEVENT events after SDL_CreateRenderer().
|
||||
SDL_PumpEvents();
|
||||
SDL_FlushEvent(SDL_WINDOWEVENT);
|
||||
|
||||
// Calculate the video region size, scaling to fill the output size while
|
||||
// preserving the aspect ratio of the video stream.
|
||||
SDL_Rect src, dst;
|
||||
|
|
Loading…
Add table
Reference in a new issue