From ce153ecccb21181f936e29525aad0fa9065b88dc Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 24 Jan 2003 01:32:04 +0000 Subject: [PATCH] fix up focus --- stepmania/src/StepMania.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index ac1c7b27c7..7e7d548304 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -488,14 +488,23 @@ static void GameLoop() DISPLAY->ResolutionChanged(event.resize.w, event.resize.h); break; case SDL_ACTIVEEVENT: - g_bHasFocus = !!event.active.gain; - LOG->Trace("App %s focus", g_bHasFocus? "has":"doesn't have"); + { + /* We don't care about mouse focus. */ + if(event.active.state == SDL_APPMOUSEFOCUS) + break; - if(event.active.gain) + Uint8 i = SDL_GetAppState(); + + g_bHasFocus = i&SDL_APPINPUTFOCUS && i&SDL_APPACTIVE; + LOG->Trace("App %s focus (%i%i)", g_bHasFocus? "has":"doesn't have", + i&SDL_APPINPUTFOCUS, i&SDL_APPACTIVE); + + if(g_bHasFocus) BoostAppPri(); else RestoreAppPri(); } + } } /*