Updating last edit time and FreeGLUT version for API document
[freeglut] / src / fg_main.c
index 99040af..b664fa3 100644 (file)
@@ -88,6 +88,7 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
      * the already-drawn part does not get drawn again and things look funny.
      * But without this we get this bad behaviour whenever we resize the
      * window.
+     * DN: Hmm.. the above sounds like a concern only in single buffered mode...
      */
     window->State.Redisplay = GL_TRUE;
 
@@ -102,8 +103,10 @@ static void fghReshapeWindow ( SFG_Window *window, int width, int height )
 void fghRedrawWindow ( SFG_Window *window )
 {
     SFG_Window *current_window = fgStructure.CurrentWindow;
+    printf("fghRedrawWindow\n");
 
     freeglut_return_if_fail( window );
+    printf("got window\n");
 
     if( window->State.NeedToInitContext ) {
         INVOKE_WCB( *window, InitContext, ());
@@ -111,24 +114,31 @@ void fghRedrawWindow ( SFG_Window *window )
     }
 
     freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );
+    printf("got displayCB\n");
 
     window->State.Redisplay = GL_FALSE;
 
     freeglut_return_if_fail( window->State.Visible );
+    printf("we're visible\n");
 
     fgSetWindow( window );
 
     if( window->State.NeedToResize )
     {
+        /* Set need to resize to false before calling fghReshapeWindow, otherwise
+           in the case the user's reshape callback calls glutReshapeWindow,
+           his request would get canceled after fghReshapeWindow gets called.
+         */
+        window->State.NeedToResize = GL_FALSE;
+
         fghReshapeWindow(
             window,
             window->State.Width,
             window->State.Height
         );
-
-        window->State.NeedToResize = GL_FALSE;
     }
 
+    printf("invoking displayCB\n");
     INVOKE_WCB( *window, Display, ( ) );
 
     fgSetWindow( current_window );
@@ -138,10 +148,12 @@ void fghRedrawWindow ( SFG_Window *window )
 static void fghcbDisplayWindow( SFG_Window *window,
                                 SFG_Enumerator *enumerator )
 {
+    printf("window %p, %i\n",window,window->State.Redisplay);
     if( window->State.Redisplay &&
         window->State.Visible )
     {
         window->State.Redisplay = GL_FALSE;
+        printf("redisplaying...\n");
                fgPlatformDisplayWindow ( window );
     }