All changes are from John, except for:
[freeglut] / src / freeglut_window.c
index 907696d..f268eb3 100644 (file)
@@ -265,7 +265,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
      * XXX With a little thought, we should be able to greatly
      * XXX simplify this.
      */
-    if ( !fgState.BuildingAMenu )
+    if ( !window->IsMenu )
       window->Window.VisualInfo = fgChooseVisual();
     else if ( fgStructure.MenuContext )
         window->Window.VisualInfo = fgChooseVisual();
@@ -327,7 +327,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
 
     mask = CWBackPixmap | CWBorderPixel | CWColormap | CWEventMask;
 
-    if ( fgState.BuildingAMenu )
+    if ( window->IsMenu )
     {
         winAttr.override_redirect = True;
         mask |= CWOverrideRedirect;
@@ -347,7 +347,7 @@ void fgOpenWindow( SFG_Window* window, const char* title,
      * The GLX context creation, possibly trying the direct context rendering
      *  or else use the current context if the user has so specified
      */
-    if ( fgState.BuildingAMenu )
+    if ( window->IsMenu )
     {
         /*
          * If there isn't already an OpenGL rendering context for menu
@@ -573,7 +573,8 @@ void fgCloseWindow( SFG_Window* window )
 int FGAPIENTRY glutCreateWindow( const char* title )
 {
     return fgCreateWindow( NULL, title, fgState.Position.X, fgState.Position.Y,
-                           fgState.Size.X, fgState.Size.Y, GL_FALSE )->ID;
+                           fgState.Size.X, fgState.Size.Y, GL_FALSE,
+                           GL_FALSE )->ID;
 }
 
 /*
@@ -587,7 +588,7 @@ int FGAPIENTRY glutCreateSubWindow( int parentID, int x, int y, int w, int h )
     freeglut_assert_ready;
     parent = fgWindowByID( parentID );
     freeglut_return_val_if_fail( parent != NULL, 0 );
-    window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE );
+    window = fgCreateWindow( parent, "", x, y, w, h, GL_FALSE, GL_FALSE );
     return window->ID;
 }
 
@@ -792,68 +793,9 @@ void FGAPIENTRY glutReshapeWindow( int width, int height )
     freeglut_assert_ready;
     freeglut_assert_window;
 
-#if TARGET_HOST_UNIX_X11
-
-    XResizeWindow( fgDisplay.Display, fgStructure.Window->Window.Handle,
-                   width, height );
-    XFlush( fgDisplay.Display ); /* XXX Shouldn't need this */
-    /*
-     * XXX REALLY shouldn't be done.  GLUT docs state that this
-     * XXX isn't even processed immediately, but rather waits
-     * XXX for return to the mainloop.  "This allows multiple
-     * XXX glutReshapeWindow, glutPositionWindow, and glutFullScreen
-     * XXX requests to the same window to be coalesced."  (This is
-     * XXX having some deleterious effect on a sample program of mine.)
-     * XXX Not only does GLUT not flush at this point, GLUT doesn't even
-     * XXX *do* the reshape at this point!  We should probably rip this
-     * XXX out and do what GLUT promises.  It would be more efficient, and
-     * XXX might be more compatible.
-     */
-
-#elif TARGET_HOST_WIN32
-
-    {
-        RECT winRect;
-        int x, y;
-
-        GetWindowRect( fgStructure.Window->Window.Handle, &winRect );
-        x = winRect.left;
-        y = winRect.top;
-
-        if ( fgStructure.Window->Parent == NULL )
-        {
-            /*
-             * Adjust the size of the window to allow for the size of the
-             * frame, if we are not a menu
-             */
-            if ( ! fgStructure.Window->IsMenu )
-            {
-                width += GetSystemMetrics( SM_CXSIZEFRAME ) * 2;
-                height += GetSystemMetrics( SM_CYSIZEFRAME ) * 2 +
-                    GetSystemMetrics( SM_CYCAPTION );
-            }
-        }
-        else
-        {
-            GetWindowRect( fgStructure.Window->Parent->Window.Handle,
-                           &winRect );
-            x -= winRect.left + GetSystemMetrics( SM_CXSIZEFRAME );
-            y -= winRect.top + GetSystemMetrics( SM_CYSIZEFRAME ) +
-                GetSystemMetrics( SM_CYCAPTION );
-        }
-
-        MoveWindow(
-            fgStructure.Window->Window.Handle,
-            x,
-            y,
-            width,
-            height,
-            TRUE
-        );
-    }
-
-#endif
-
+    fgStructure.Window->State.NeedToResize = GL_TRUE;
+    fgStructure.Window->State.Width  = width ;
+    fgStructure.Window->State.Height = height;
 }
 
 /*