gamemode-x11: fixed the conditions checking for XR&R >= 1.1, as it where they would...
[freeglut] / src / fg_main.c
index 24de119..c3bccdc 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;
 
@@ -104,6 +105,12 @@ void fghRedrawWindow ( SFG_Window *window )
     SFG_Window *current_window = fgStructure.CurrentWindow;
 
     freeglut_return_if_fail( window );
+
+    if( window->State.NeedToInitContext ) {
+        INVOKE_WCB( *window, InitContext, ());
+        window->State.NeedToInitContext = GL_FALSE;
+    }
+
     freeglut_return_if_fail( FETCH_WCB ( *window, Display ) );
 
     window->State.Redisplay = GL_FALSE;
@@ -114,13 +121,17 @@ void fghRedrawWindow ( SFG_Window *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;
     }
 
     INVOKE_WCB( *window, Display, ( ) );