Fixing game mode in X11 so that it doesn't override unspecified settings per e-mail...
[freeglut] / src / freeglut_gamemode.c
index 24a8be1..b0194b2 100644 (file)
@@ -419,10 +419,10 @@ void FGAPIENTRY glutGameModeString( const char* string )
                                 );
 
     /* Hopefully it worked, and if not, we still have the default values */
-    fgState.GameModeSize.X  = width;
-    fgState.GameModeSize.Y  = height;
-    fgState.GameModeDepth   = depth;
-    fgState.GameModeRefresh = refresh;
+    if ( width   > 0 ) fgState.GameModeSize.X  = width;
+    if ( height  > 0 ) fgState.GameModeSize.Y  = height;
+    if ( depth   > 0 ) fgState.GameModeDepth   = depth;
+    if ( refresh > 0 ) fgState.GameModeRefresh = refresh;
 }