From 4155ca2c4aa4bac78ce35a38b5e2e69c0c77e585 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Ho=C5=A1ek?= Date: Sun, 30 May 2010 01:10:05 -0500 Subject: [PATCH] Quick fix to Lugaru's freezing at going out of focus --- Source/OpenGL_Windows.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index b68c60b..618ef47 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -1117,7 +1117,12 @@ int main(int argc, char **argv) } // game is not in focus, give CPU time to other apps by waiting for messages instead of 'peeking' - STUBBED("give up CPU but sniff the event queue"); + SDL_ActiveEvent evt; + SDL_WaitEvent((SDL_Event*)&evt); + if (evt.type == SDL_ACTIVEEVENT && evt.gain == 1) + gameFocused = true; + else if (evt.type == SDL_QUIT) + gDone = true; } } -- 2.39.2