From 3364c70ee6347beb6d06ab9627af539044e5009d Mon Sep 17 00:00:00 2001 From: fayjf Date: Sun, 13 Mar 2011 21:19:00 +0000 Subject: [PATCH] Fixing a bug in the game mode refresh rate specification, in the case in which an exact match is not found in the available display modes. Reference to e-mail from Diederick C. Niehorster dated 1/26/2011, 11:59 PM git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@894 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_gamemode.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/freeglut/freeglut/src/freeglut_gamemode.c b/freeglut/freeglut/src/freeglut_gamemode.c index b0194b2..01086b3 100644 --- a/freeglut/freeglut/src/freeglut_gamemode.c +++ b/freeglut/freeglut/src/freeglut_gamemode.c @@ -204,7 +204,7 @@ static void fghRestoreState( void ) #elif TARGET_HOST_MS_WINDOWS - /* Restore the previously rememebered desktop display settings */ + /* Restore the previously remembered desktop display settings */ ChangeDisplaySettingsEx( fgDisplay.DisplayName,&fgDisplay.DisplayMode, 0,0,0 ); #endif @@ -242,6 +242,15 @@ static int fghCheckDisplayModes( GLboolean exactMatch, int displayModesCount, XF displayModes[ i ]->vdisplay, fgState.GameModeDepth, ( exactMatch ? refresh : fgState.GameModeRefresh ) ) ) { + if (!exactMatch) + { + /* Update the chosen refresh rate, otherwise a + * glutGameModeGet(GLUT_GAME_MODE_REFRESH_RATE) would not + * return the right values + */ + fgState.GameModeRefresh = refresh; + } + return i; } }