Cleaned up the comments a bit in the callbacks.c file (mostly removed some
[freeglut] / src / freeglut_window.c
index 4cc38aa..14733e2 100644 (file)
@@ -306,6 +306,8 @@ GLboolean fgSetupPixelFormat( SFG_Window* window, GLboolean checkOnly, unsigned
 void fgSetWindow ( SFG_Window *window )
 {
 #if TARGET_HOST_UNIX_X11
+  if ( window )
+  {
     /*
         * Make the selected window's GLX context the current one
      */
@@ -314,7 +316,7 @@ void fgSetWindow ( SFG_Window *window )
         window->Window.Handle,
         window->Window.Context
     );
-
+  }
 #elif TARGET_HOST_WIN32
        /*
         * Release the previous' context's device context
@@ -395,6 +397,10 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
          */
         fgState.DisplayMode |= GLUT_DOUBLE ;
         window->Window.VisualInfo = fgChooseVisual();
+       /* OK, we got a double-buffered window, but we only wanted
+        * single-buffered.  Clear the double-buffer flag now.
+        */
+       fgState.DisplayMode &= ~GLUT_DOUBLE ;
       }
 
       /*
@@ -565,37 +571,6 @@ void fgOpenWindow( SFG_Window* window, const char* title, int x, int y, int w, i
      */
     XMapWindow( fgDisplay.Display, window->Window.Handle );
 
-    /*
-     * In game mode, move the viewport a bit to hide the decorations.
-     * This code depends on the XFree86 video mode extensions.
-     */
-    if( gameMode == TRUE )
-    {
-        /*
-         * This somehow fixes the glutGet() GLUT_WINDOW_X and GLUT_WINDOW_Y problem...
-         */
-        XMoveWindow( fgDisplay.Display, window->Window.Handle, x, y );
-
-#       ifdef X_XF86VidModeSetViewPort
-
-        /*
-         * Set the newly created window as the current one...
-         */
-        fgSetWindow( window );
-
-        /*
-         * Move the viewport a bit down and right from top-left corner to hide the decorations
-         */
-        XF86VidModeSetViewPort(
-            fgDisplay.Display,
-            fgDisplay.Screen,
-            glutGet( GLUT_WINDOW_X ),
-            glutGet( GLUT_WINDOW_Y )
-        );
-
-#       endif
-    }
-
 #elif TARGET_HOST_WIN32
 
        WNDCLASS wc;