Changing a bunch of platform-specific "fgDisplay" fields to "fgDisplay.pDisplay"...
[freeglut] / src / Common / freeglut_state.c
index 20221bb..8962df3 100644 (file)
@@ -45,6 +45,12 @@ extern int fgPlatformGlutGet ( GLenum eWhat );
 extern int fgPlatformGlutDeviceGet ( GLenum eWhat );\r
 extern int fgPlatformGlutLayerGet ( GLenum eWhat );\r
 \r
+/* A helper function to check if a display mode is possible to use */\r
+#if TARGET_HOST_POSIX_X11\r
+GLXFBConfig* fgChooseFBConfig( int* numcfgs );\r
+#endif\r
+\r
+\r
 /* -- LOCAL DEFINITIONS ---------------------------------------------------- */\r
 \r
 /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */\r
@@ -59,15 +65,15 @@ static int fghGetConfig( int attribute )
   int result;  /*  Not checked  */\r
 \r
   if( fgStructure.CurrentWindow )\r
-      result = glXGetFBConfigAttrib( fgDisplay.Display,\r
-                                     *(fgStructure.CurrentWindow->Window.FBConfig),\r
+      result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display,\r
+                                     *(fgStructure.CurrentWindow->Window.pContext.FBConfig),\r
                                      attribute,\r
                                      &returnValue );\r
 \r
   return returnValue;\r
 }\r
 \r
-static int fgPlatformGlutGet ( GLenum eWhat )\r
+int fgPlatformGlutGet ( GLenum eWhat )\r
 {\r
     int nsamples = 0;\r
 \r
@@ -119,10 +125,10 @@ static int fgPlatformGlutGet ( GLenum eWhat )
         else\r
         {\r
           const GLXFBConfig * fbconfig =\r
-                fgStructure.CurrentWindow->Window.FBConfig;\r
+                fgStructure.CurrentWindow->Window.pContext.FBConfig;\r
 \r
           XVisualInfo * visualInfo =\r
-                glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig );\r
+                glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, *fbconfig );\r
 \r
           const int result = visualInfo->visual->map_entries;\r
 \r
@@ -147,7 +153,7 @@ static int fgPlatformGlutGet ( GLenum eWhat )
             return 0;\r
 \r
         XTranslateCoordinates(\r
-            fgDisplay.Display,\r
+            fgDisplay.pDisplay.Display,\r
             fgStructure.CurrentWindow->Window.Handle,\r
             fgDisplay.RootWindow,\r
             0, 0, &x, &y, &w);\r
@@ -161,7 +167,7 @@ static int fgPlatformGlutGet ( GLenum eWhat )
         if ( w == 0 )\r
             return 0;\r
         XTranslateCoordinates(\r
-            fgDisplay.Display,\r
+            fgDisplay.pDisplay.Display,\r
             fgStructure.CurrentWindow->Window.Handle,\r
             w, 0, 0, &x, &y, &w);\r
 \r
@@ -180,7 +186,7 @@ static int fgPlatformGlutGet ( GLenum eWhat )
         if( fgStructure.CurrentWindow == NULL )\r
             return 0;\r
         XGetWindowAttributes(\r
-            fgDisplay.Display,\r
+            fgDisplay.pDisplay.Display,\r
             fgStructure.CurrentWindow->Window.Handle,\r
             &winAttributes\r
         );\r
@@ -227,7 +233,7 @@ static int fgPlatformGlutGet ( GLenum eWhat )
 }\r
 \r
 \r
-static int fgPlatformGlutDeviceGet ( GLenum eWhat )\r
+int fgPlatformGlutDeviceGet ( GLenum eWhat )\r
 {\r
     switch( eWhat )\r
     {\r
@@ -253,7 +259,7 @@ static int fgPlatformGlutDeviceGet ( GLenum eWhat )
          */\r
         {\r
             unsigned char map;\r
-            int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0);\r
+            int nbuttons = XGetPointerMapping(fgDisplay.pDisplay.Display, &map,0);\r
             return nbuttons;\r
         }\r
 \r
@@ -627,8 +633,8 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
           break;\r
         }\r
 \r
-      fbconfigArray = glXChooseFBConfig(fgDisplay.Display,\r
-                                        fgDisplay.Screen,\r
+      fbconfigArray = glXChooseFBConfig(fgDisplay.pDisplay.Display,\r
+                                        fgDisplay.pDisplay.Screen,\r
                                         attributes,\r
                                         &fbconfigArraySize);\r
 \r
@@ -646,7 +652,7 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size)
             {\r
               int value;\r
 \r
-              result = glXGetFBConfigAttrib(fgDisplay.Display,\r
+              result = glXGetFBConfigAttrib(fgDisplay.pDisplay.Display,\r
                                             fbconfigArray[i],\r
                                             attribute_name,\r
                                             &value);\r