X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2FCommon%2Ffreeglut_main.c;h=66281ea71812108a55b42aa5fa0f0a7f2648e8c6;hb=0cd6817079c9f545bbff65d6ac86d9fac6b92db9;hp=980159def4327e33ab674f483facf2ed25ff483e;hpb=83a7f1444d1388983a7b756dde26b0cc74101b13;p=freeglut diff --git a/src/Common/freeglut_main.c b/src/Common/freeglut_main.c index 980159d..66281ea 100644 --- a/src/Common/freeglut_main.c +++ b/src/Common/freeglut_main.c @@ -72,6 +72,7 @@ struct GXKeyList gxKeyList; extern void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height ); extern void fgPlatformDisplayWindow ( SFG_Window *window ); +extern unsigned long fgPlatformSystemTime ( void ); extern void fgPlatformSleepForEvents( long msec ); extern void fgPlatformProcessSingleEvent ( void ); extern void fgPlatformMainLoopPreliminaryWork ( void ); @@ -174,6 +175,16 @@ void fgPlatformDisplayWindow ( SFG_Window *window ) { fghRedrawWindow ( window ) ; } + + +unsigned long fgPlatformSystemTime ( void ) +{ +#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY + struct timeval now; + gettimeofday( &now, NULL ); + return now.tv_usec/1000 + now.tv_sec*1000; +#endif +} #endif static void fghcbDisplayWindow( SFG_Window *window, @@ -262,18 +273,9 @@ static void fghCheckTimers( void ) * when subtracting an initial start time, unless the total time exceeds * 32-bit, where the GLUT API return value is also overflowed. */ -unsigned long fgSystemTime(void) { -#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY - struct timeval now; - gettimeofday( &now, NULL ); - return now.tv_usec/1000 + now.tv_sec*1000; -#elif TARGET_HOST_MS_WINDOWS -# if defined(_WIN32_WCE) - return GetTickCount(); -# else - return timeGetTime(); -# endif -#endif +unsigned long fgSystemTime(void) +{ + return fgPlatformSystemTime (); } /* @@ -999,13 +1001,13 @@ void fgPlatformProcessSingleEvent ( void ) height = event.xconfigure.height; } - if( ( width != window->State.OldWidth ) || - ( height != window->State.OldHeight ) ) + if( ( width != window->State.pWState.OldWidth ) || + ( height != window->State.pWState.OldHeight ) ) { SFG_Window *current_window = fgStructure.CurrentWindow; - window->State.OldWidth = width; - window->State.OldHeight = height; + window->State.pWState.OldWidth = width; + window->State.pWState.OldHeight = height; if( FETCH_WCB( *window, Reshape ) ) INVOKE_WCB( *window, Reshape, ( width, height ) ); else