aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-01-23 00:24:56 +0000
committertma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea>2006-01-23 00:24:56 +0000
commit0ee37ad243114aae8243e4bb45c1f8aedd8e18d5 (patch)
tree545a24e31b8da0ac4d39c57620f85fd0573df452
parentce7defce3338a0493211e5f1c697b6c5f26a7e00 (diff)
downloadioquake3-aero-0ee37ad243114aae8243e4bb45c1f8aedd8e18d5.tar.gz
ioquake3-aero-0ee37ad243114aae8243e4bb45c1f8aedd8e18d5.zip
* Added code to sleep a bit when q3 has no focus and sleep a lot when it's
minimised (SDL only) git-svn-id: svn://svn.icculus.org/quake3/trunk@519 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/unix/unix_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index 7b3a85e..e0afa7a 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