Fixing game mode in X11 so that it doesn't override unspecified settings per e-mail...
authorJohn F. Fay <johnffay@nettally.com>
Sun, 13 Mar 2011 21:11:18 +0000 (21:11 +0000)
committerJohn F. Fay <johnffay@nettally.com>
Sun, 13 Mar 2011 21:11:18 +0000 (21:11 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@893 7f0cb862-5218-0410-a997-914c9d46530a

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;
 }