From 5a29e8df50c7ebd2f649f18e09e533907823b4be Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 23 Jan 2006 00:24:56 +0000 Subject: [PATCH] * Added code to sleep a bit when q3 has no focus and sleep a lot when it's minimised (SDL only) --- code/unix/unix_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c index 7b3a85e6..e0afa7ad 100644 --- a/code/unix/unix_main.c +++ b/code/unix/unix_main.c @@ -1400,6 +1400,18 @@ int main ( int argc, char* argv[] ) while (1) { +#if !defined( DEDICATED ) && USE_SDL_VIDEO + int appState = SDL_GetAppState( ); + + // If we have no input focus at all, sleep a bit + if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) ) + usleep( 16000 ); + + // If we're minimised, sleep a bit more + if( !( appState & SDL_APPACTIVE ) ) + usleep( 32000 ); +#endif + #ifdef __linux__ Sys_ConfigureFPU(); #endif