diff options
Diffstat (limited to 'code/sys')
-rw-r--r-- | code/sys/sys_main.c | 44 | ||||
-rw-r--r-- | code/sys/sys_unix.c | 3 | ||||
-rw-r--r-- | code/sys/sys_win32.c | 3 |
3 files changed, 13 insertions, 37 deletions
diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c index a1a57b4..dc846dd 100644 --- a/code/sys/sys_main.c +++ b/code/sys/sys_main.c @@ -441,42 +441,6 @@ void *Sys_LoadDll( const char *name, char *fqpath , /* ================= -Sys_Idle -================= -*/ -static void Sys_Idle( void ) -{ -#ifndef DEDICATED - int appState = SDL_GetAppState( ); - int sleep = 0; - - // If we have no input focus at all, sleep a bit - if( !( appState & ( SDL_APPMOUSEFOCUS | SDL_APPINPUTFOCUS ) ) ) - { - Cvar_SetValue( "com_unfocused", 1 ); - sleep += 16; - } - else - Cvar_SetValue( "com_unfocused", 0 ); - - // If we're minimised, sleep a bit more - if( !( appState & SDL_APPACTIVE ) ) - { - Cvar_SetValue( "com_minimized", 1 ); - sleep += 32; - } - else - Cvar_SetValue( "com_minimized", 0 ); - - if( !com_dedicated->integer && sleep ) - SDL_Delay( sleep ); -#else - // Dedicated server idles via NET_Sleep -#endif -} - -/* -================= Sys_ParseArgs ================= */ @@ -602,7 +566,13 @@ int main( int argc, char **argv ) while( 1 ) { - Sys_Idle( ); +#ifndef DEDICATED + int appState = SDL_GetAppState( ); + + Cvar_SetValue( "com_unfocused", !( appState & SDL_APPINPUTFOCUS ) ); + Cvar_SetValue( "com_minimized", !( appState & SDL_APPACTIVE ) ); +#endif + IN_Frame( ); Com_Frame( ); } diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index 9d9d5aa..40479b9 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -463,6 +463,9 @@ void Sys_Sleep( int msec ) { fd_set fdset; + if( msec == 0 ) + return; + FD_ZERO(&fdset); FD_SET(fileno(stdin), &fdset); if( msec < 0 ) diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index 18724b3..fb924e6 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -519,6 +519,9 @@ Block execution for msec or until input is recieved. */ void Sys_Sleep( int msec ) { + if( msec == 0 ) + return; + if( msec < 0 ) WaitForSingleObject( GetStdHandle( STD_INPUT_HANDLE ), INFINITE ); else |