Hm... I thought that I committed this last night. What's up?
This is Nigel's modified fgSleepForEvents(), essentially. Take 2. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@435 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
4f23cc54d6
commit
5d5ba0e9e9
@ -450,31 +450,34 @@ static long fgNextTimer( void )
|
||||
*/
|
||||
static void fgSleepForEvents( void )
|
||||
{
|
||||
#if TARGET_HOST_UNIX_X11
|
||||
fd_set fdset;
|
||||
int err;
|
||||
int socket;
|
||||
struct timeval wait;
|
||||
long msec;
|
||||
|
||||
if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
|
||||
return;
|
||||
|
||||
msec = fgNextTimer( );
|
||||
if( fgHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
|
||||
msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
|
||||
|
||||
#if TARGET_HOST_UNIX_X11
|
||||
{
|
||||
fd_set fdset;
|
||||
int err;
|
||||
int socket;
|
||||
struct timeval wait;
|
||||
|
||||
socket = ConnectionNumber( fgDisplay.Display );
|
||||
FD_ZERO( &fdset );
|
||||
FD_SET( socket, &fdset );
|
||||
|
||||
msec = fgNextTimer( );
|
||||
if( fgHaveJoystick( ) )
|
||||
msec = MIN( msec, 10 );
|
||||
|
||||
wait.tv_sec = msec / 1000;
|
||||
wait.tv_usec = (msec % 1000) * 1000;
|
||||
err = select( socket+1, &fdset, NULL, NULL, &wait );
|
||||
|
||||
if( -1 == err )
|
||||
fgWarning ( "freeglut select() error: %d\n", errno );
|
||||
|
||||
}
|
||||
#elif TARGET_HOST_WIN32
|
||||
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user