1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 22:13:07 +01:00

fix #2158: Video Freeze when window is maximised, minimised and then restored

This commit is contained in:
IntelOrca
2015-12-04 18:59:59 +00:00
parent 11398cf60f
commit 737baf8b78

View File

@@ -434,6 +434,20 @@ void platform_process_messages()
rct2_quit();
break;
case SDL_WINDOWEVENT:
// HACK: Fix #2158, OpenRCT2 does not draw if it does not think that the window is
// visible - due a bug in SDL2.0.3 this hack is required if the
// window is maximised, minimised and then restored again.
if (e.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) {
if (SDL_GetWindowFlags(gWindow) & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(gWindow);
SDL_MaximizeWindow(gWindow);
}
if (SDL_GetWindowFlags(gWindow) & SDL_WINDOW_FULLSCREEN_DESKTOP) {
SDL_RestoreWindow(gWindow);
SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN_DESKTOP);
}
}
if (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)
platform_resize(e.window.data1, e.window.data2);
if (gConfigSound.audio_focus && gConfigSound.sound) {