split out FocusChanged

This commit is contained in:
Glenn Maynard
2004-06-14 02:13:44 +00:00
parent a69428d17b
commit bd9494fd43
+16 -12
View File
@@ -1478,6 +1478,21 @@ static void HandleInputEvents(float fDeltaTime)
}
}
void FocusChanged( bool bHasFocus )
{
g_bHasFocus = bHasFocus;
LOG->Trace( "App %s focus", g_bHasFocus? "has":"doesn't have" );
/* If we lose focus, we may lose input events, especially key releases. */
INPUTFILTER->Reset();
if(g_bHasFocus)
BoostAppPri();
else
RestoreAppPri();
}
static void HandleSDLEvents()
{
// process all queued events
@@ -1498,18 +1513,7 @@ static void HandleSDLEvents()
break;
uint8_t 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 we lose focus, we may lose input events, especially key releases. */
INPUTFILTER->Reset();
if(g_bHasFocus)
BoostAppPri();
else
RestoreAppPri();
FocusChanged( i&SDL_APPINPUTFOCUS && i&SDL_APPACTIVE );
}
}
}