fix up focus

This commit is contained in:
Glenn Maynard
2003-01-24 01:32:04 +00:00
parent 689ea9cfe8
commit ce153ecccb
+12 -3
View File
@@ -488,14 +488,23 @@ static void GameLoop()
DISPLAY->ResolutionChanged(event.resize.w, event.resize.h); DISPLAY->ResolutionChanged(event.resize.w, event.resize.h);
break; break;
case SDL_ACTIVEEVENT: 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(); BoostAppPri();
else else
RestoreAppPri(); RestoreAppPri();
} }
}
} }
/* /*