r519 - trunk/code/unix

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Jan 22 19:24:56 EST 2006


Author: tma
Date: 2006-01-22 19:24:56 -0500 (Sun, 22 Jan 2006)
New Revision: 519

Modified:
   trunk/code/unix/unix_main.c
Log:
* Added code to sleep a bit when q3 has no focus and sleep a lot when it's
  minimised (SDL only)


Modified: trunk/code/unix/unix_main.c
===================================================================
--- trunk/code/unix/unix_main.c	2006-01-22 21:09:55 UTC (rev 518)
+++ trunk/code/unix/unix_main.c	2006-01-23 00:24:56 UTC (rev 519)
@@ -1400,6 +1400,18 @@
 
   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




More information about the quake3-commits mailing list