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 )
|
static void fgSleepForEvents( void )
|
||||||
{
|
{
|
||||||
#if TARGET_HOST_UNIX_X11
|
|
||||||
fd_set fdset;
|
|
||||||
int err;
|
|
||||||
int socket;
|
|
||||||
struct timeval wait;
|
|
||||||
long msec;
|
long msec;
|
||||||
|
|
||||||
if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
|
if( fgState.IdleCallback || fgHavePendingRedisplays( ) )
|
||||||
return;
|
return;
|
||||||
socket = ConnectionNumber( fgDisplay.Display );
|
|
||||||
FD_ZERO( &fdset );
|
|
||||||
FD_SET( socket, &fdset );
|
|
||||||
|
|
||||||
msec = fgNextTimer( );
|
msec = fgNextTimer( );
|
||||||
if( fgHaveJoystick( ) )
|
if( fgHaveJoystick( ) ) /* XXX Use GLUT timers for joysticks... */
|
||||||
msec = MIN( msec, 10 );
|
msec = MIN( msec, 10 ); /* XXX Dumb; forces granularity to .01sec */
|
||||||
|
|
||||||
wait.tv_sec = msec / 1000;
|
#if TARGET_HOST_UNIX_X11
|
||||||
wait.tv_usec = (msec % 1000) * 1000;
|
{
|
||||||
err = select( socket+1, &fdset, NULL, NULL, &wait );
|
fd_set fdset;
|
||||||
|
int err;
|
||||||
|
int socket;
|
||||||
|
struct timeval wait;
|
||||||
|
|
||||||
if( -1 == err )
|
socket = ConnectionNumber( fgDisplay.Display );
|
||||||
fgWarning ( "freeglut select() error: %d\n", errno );
|
FD_ZERO( &fdset );
|
||||||
|
FD_SET( socket, &fdset );
|
||||||
|
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
|
#elif TARGET_HOST_WIN32
|
||||||
|
MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLEVENTS );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user