Moving the platform-specific window state fields into their own substructure
[freeglut] / src / Common / freeglut_main.c
index 980159d..66281ea 100644 (file)
@@ -72,6 +72,7 @@ struct GXKeyList gxKeyList;
 \r
 extern void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height );\r
 extern void fgPlatformDisplayWindow ( SFG_Window *window );\r
+extern unsigned long fgPlatformSystemTime ( void );\r
 extern void fgPlatformSleepForEvents( long msec );\r
 extern void fgPlatformProcessSingleEvent ( void );\r
 extern void fgPlatformMainLoopPreliminaryWork ( void );\r
@@ -174,6 +175,16 @@ void fgPlatformDisplayWindow ( SFG_Window *window )
 {\r
         fghRedrawWindow ( window ) ;\r
 }\r
+\r
+\r
+unsigned long fgPlatformSystemTime ( void )\r
+{\r
+#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY\r
+    struct timeval now;\r
+    gettimeofday( &now, NULL );\r
+    return now.tv_usec/1000 + now.tv_sec*1000;\r
+#endif\r
+}\r
 #endif\r
 \r
 static void fghcbDisplayWindow( SFG_Window *window,\r
@@ -262,18 +273,9 @@ static void fghCheckTimers( void )
  * when subtracting an initial start time, unless the total time exceeds\r
  * 32-bit, where the GLUT API return value is also overflowed.\r
  */  \r
-unsigned long fgSystemTime(void) {\r
-#if TARGET_HOST_SOLARIS || HAVE_GETTIMEOFDAY\r
-    struct timeval now;\r
-    gettimeofday( &now, NULL );\r
-    return now.tv_usec/1000 + now.tv_sec*1000;\r
-#elif TARGET_HOST_MS_WINDOWS\r
-#    if defined(_WIN32_WCE)\r
-    return GetTickCount();\r
-#    else\r
-    return timeGetTime();\r
-#    endif\r
-#endif\r
+unsigned long fgSystemTime(void)\r
+{\r
+       return fgPlatformSystemTime ();\r
 }\r
   \r
 /*\r
@@ -999,13 +1001,13 @@ void fgPlatformProcessSingleEvent ( void )
                     height = event.xconfigure.height;\r
                 }\r
 \r
-                if( ( width != window->State.OldWidth ) ||\r
-                    ( height != window->State.OldHeight ) )\r
+                if( ( width != window->State.pWState.OldWidth ) ||\r
+                    ( height != window->State.pWState.OldHeight ) )\r
                 {\r
                     SFG_Window *current_window = fgStructure.CurrentWindow;\r
 \r
-                    window->State.OldWidth = width;\r
-                    window->State.OldHeight = height;\r
+                    window->State.pWState.OldWidth = width;\r
+                    window->State.pWState.OldHeight = height;\r
                     if( FETCH_WCB( *window, Reshape ) )\r
                         INVOKE_WCB( *window, Reshape, ( width, height ) );\r
                     else\r