Stripped out tabs and end-of-line whitespace
[freeglut] / src / freeglut_gamemode.c
index 7c9b7eb..703005d 100644 (file)
@@ -29,7 +29,7 @@
 #include "config.h"
 #endif
 
-#include "../include/GL/freeglut.h"
+#include <GL/freeglut.h>
 #include "freeglut_internal.h"
 
 /*
@@ -89,7 +89,7 @@ void fghRememberState( void )
     /*
      * Query the current display settings:
      */
-    fgDisplay.DisplayModeValid = 
+    fgDisplay.DisplayModeValid =
       XF86VidModeGetModeLine(
         fgDisplay.Display,
         fgDisplay.Screen,
@@ -101,13 +101,16 @@ void fghRememberState( void )
             fgWarning( "Runtime use of XF86VidModeGetModeLine failed.\n" );
 
 #   else
-#       warning fghRememberState: missing XFree86 video mode extensions, game mode will not change screen resolution when activated
+    /*
+     * XXX warning fghRememberState: missing XFree86 video mode extensions,
+     * XXX game mode will not change screen resolution when activated
+     */
 #   endif
 
 #elif TARGET_HOST_WIN32
 
 /*    DEVMODE devMode; */
-    
+
     /*
      * Grab the current desktop settings...
      */
@@ -195,7 +198,10 @@ void fghRestoreState( void )
     }
 
 #   else
-#       warning fghRestoreState: missing XFree86 video mode extensions, game mode will not change screen resolution when activated
+    /*
+     * XXX warning fghRestoreState: missing XFree86 video mode extensions,
+     * XXX game mode will not change screen resolution when activated
+     */
 #   endif
 
 #elif TARGET_HOST_WIN32
@@ -282,7 +288,10 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
     return GL_FALSE;
 
 #   else
-#       warning fghChangeDisplayMode: missing XFree86 video mode extensions, game mode will not change screen resolution when activated
+    /*
+     * XXX warning fghChangeDisplayMode: missing XFree86 video mode extensions,
+     * XXX game mode will not change screen resolution when activated
+     */
 #   endif
 
 #elif TARGET_HOST_WIN32
@@ -413,7 +422,7 @@ void FGAPIENTRY glutGameModeString( const char* string )
 int FGAPIENTRY glutEnterGameMode( void )
 {
     if( fgStructure.GameMode )
-        fgAddToWindowDestroyList( fgStructure.GameMode, GL_TRUE );
+        fgAddToWindowDestroyList( fgStructure.GameMode );
     else
         fghRememberState( );
 
@@ -423,11 +432,13 @@ int FGAPIENTRY glutEnterGameMode( void )
         return FALSE;
     }
 
-    fgStructure.GameMode = fgCreateWindow( 
+    fgStructure.GameMode = fgCreateWindow(
         NULL, "FREEGLUT", 0, 0,
         fgState.GameModeSize.X, fgState.GameModeSize.Y, GL_TRUE, GL_FALSE
     );
 
+    fgStructure.GameMode->State.IsGameMode = GL_TRUE;
+
 #if TARGET_HOST_UNIX_X11
 
     /* Move the window up to the topleft corner */
@@ -442,7 +453,7 @@ int FGAPIENTRY glutEnterGameMode( void )
     /* Move the Pointer to the middle of the fullscreen window */
     XWarpPointer(
         fgDisplay.Display,
-        None, 
+        None,
         fgDisplay.RootWindow,
         0, 0, 0, 0,
         fgState.GameModeSize.X/2, fgState.GameModeSize.Y/2
@@ -465,7 +476,7 @@ int FGAPIENTRY glutEnterGameMode( void )
                GrabModeAsync, GrabModeAsync,
                fgStructure.GameMode->Window.Handle, None, CurrentTime) )
         usleep( 100 );
-    
+
     /*
      * Change input focus to the new window. This will exit the application
      * if the new window is not viewable yet, see the XGrabPointer loop above.
@@ -534,7 +545,9 @@ void FGAPIENTRY glutLeaveGameMode( void )
 {
     freeglut_return_if_fail( fgStructure.GameMode );
 
-    fgAddToWindowDestroyList( fgStructure.GameMode, GL_TRUE );
+    fgStructure.GameMode->State.IsGameMode = GL_FALSE;
+
+    fgAddToWindowDestroyList( fgStructure.GameMode );
 
 #if TARGET_HOST_UNIX_X11