Windows patches (Eero Pajarre)
authorBrian Paul <brianp@vmware.com>
Fri, 20 Jun 2003 14:39:16 +0000 (14:39 +0000)
committerBrian Paul <brianp@vmware.com>
Fri, 20 Jun 2003 14:39:16 +0000 (14:39 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@89 7f0cb862-5218-0410-a997-914c9d46530a

freeglut-1.3/freeglut_gamemode.c
freeglut-1.3/freeglut_state.c

index 5b4eff3..e9e9276 100644 (file)
@@ -255,6 +255,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
 
     /*
      * Enumerate the available display modes
+     * Try to get a complete match
      */
     while( EnumDisplaySettings( NULL, displayModes, &devMode ) == TRUE )
     {
@@ -262,7 +263,7 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
          * Does the enumerated display mode match the user's preferences?
          */
         if( fghCheckDisplayMode( devMode.dmPelsWidth,  devMode.dmPelsHeight,
-                                 devMode.dmBitsPerPel, fgState.GameModeRefresh ) )
+                                 devMode.dmBitsPerPel, devMode.dmDisplayFrequency ) )
         {
             /*
              * OKi, we've found a matching display mode, remember its number and break
@@ -277,6 +278,35 @@ GLboolean fghChangeDisplayMode( GLboolean haveToTest )
         displayModes++;
     }
 
+    if( mode == 0xffffffff )
+    {
+      /* then try without Display Frequency */
+      displayModes=0;
+
+      /*
+       * Enumerate the available display modes
+       */
+      while( EnumDisplaySettings( NULL, displayModes, &devMode ) == TRUE )
+       {
+         /* then try without Display Frequency */
+       
+         if( fghCheckDisplayMode( devMode.dmPelsWidth,  devMode.dmPelsHeight,
+                                  devMode.dmBitsPerPel, fgState.GameModeRefresh))
+           {
+             /*
+              * OKi, we've found a matching display mode, remember its number and break
+              */
+             mode = displayModes;
+             break;
+           }
+       
+         /*
+          * Switch to the next display mode, if any
+          */
+         displayModes++;
+       }
+    }
+
     /*
      * Did we find a matching display mode?
      */
index 6a13db4..cb40f05 100644 (file)
@@ -364,7 +364,8 @@ int FGAPIENTRY glutGet( GLenum eWhat )
         /*
          * ...then we've got to correct the results we've just received...
          */
-        if ( fgStructure.Window->Parent == NULL )
+        if (fgStructure.GameMode != fgStructure.Window &&
+           fgStructure.Window->Parent == NULL )
         {
           winRect.left   += GetSystemMetrics( SM_CXSIZEFRAME );
           winRect.right  -= GetSystemMetrics( SM_CXSIZEFRAME );