X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=src%2FCommon%2Ffreeglut_state.c;h=8962df33764308b3de3fe6a599c392070fa4a336;hb=6c3c78f5fe46f0126e26dcae456ebdec502913f5;hp=20221bb636c37dcd72d9f6d7876a96b8e1d3ae40;hpb=903e153b05350714b64556913c241f56d641a282;p=freeglut diff --git a/src/Common/freeglut_state.c b/src/Common/freeglut_state.c index 20221bb..8962df3 100644 --- a/src/Common/freeglut_state.c +++ b/src/Common/freeglut_state.c @@ -45,6 +45,12 @@ extern int fgPlatformGlutGet ( GLenum eWhat ); extern int fgPlatformGlutDeviceGet ( GLenum eWhat ); extern int fgPlatformGlutLayerGet ( GLenum eWhat ); +/* A helper function to check if a display mode is possible to use */ +#if TARGET_HOST_POSIX_X11 +GLXFBConfig* fgChooseFBConfig( int* numcfgs ); +#endif + + /* -- LOCAL DEFINITIONS ---------------------------------------------------- */ /* -- PRIVATE FUNCTIONS ---------------------------------------------------- */ @@ -59,15 +65,15 @@ static int fghGetConfig( int attribute ) int result; /* Not checked */ if( fgStructure.CurrentWindow ) - result = glXGetFBConfigAttrib( fgDisplay.Display, - *(fgStructure.CurrentWindow->Window.FBConfig), + result = glXGetFBConfigAttrib( fgDisplay.pDisplay.Display, + *(fgStructure.CurrentWindow->Window.pContext.FBConfig), attribute, &returnValue ); return returnValue; } -static int fgPlatformGlutGet ( GLenum eWhat ) +int fgPlatformGlutGet ( GLenum eWhat ) { int nsamples = 0; @@ -119,10 +125,10 @@ static int fgPlatformGlutGet ( GLenum eWhat ) else { const GLXFBConfig * fbconfig = - fgStructure.CurrentWindow->Window.FBConfig; + fgStructure.CurrentWindow->Window.pContext.FBConfig; XVisualInfo * visualInfo = - glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig ); + glXGetVisualFromFBConfig( fgDisplay.pDisplay.Display, *fbconfig ); const int result = visualInfo->visual->map_entries; @@ -147,7 +153,7 @@ static int fgPlatformGlutGet ( GLenum eWhat ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, fgDisplay.RootWindow, 0, 0, &x, &y, &w); @@ -161,7 +167,7 @@ static int fgPlatformGlutGet ( GLenum eWhat ) if ( w == 0 ) return 0; XTranslateCoordinates( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, w, 0, 0, &x, &y, &w); @@ -180,7 +186,7 @@ static int fgPlatformGlutGet ( GLenum eWhat ) if( fgStructure.CurrentWindow == NULL ) return 0; XGetWindowAttributes( - fgDisplay.Display, + fgDisplay.pDisplay.Display, fgStructure.CurrentWindow->Window.Handle, &winAttributes ); @@ -227,7 +233,7 @@ static int fgPlatformGlutGet ( GLenum eWhat ) } -static int fgPlatformGlutDeviceGet ( GLenum eWhat ) +int fgPlatformGlutDeviceGet ( GLenum eWhat ) { switch( eWhat ) { @@ -253,7 +259,7 @@ static int fgPlatformGlutDeviceGet ( GLenum eWhat ) */ { unsigned char map; - int nbuttons = XGetPointerMapping(fgDisplay.Display, &map,0); + int nbuttons = XGetPointerMapping(fgDisplay.pDisplay.Display, &map,0); return nbuttons; } @@ -627,8 +633,8 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) break; } - fbconfigArray = glXChooseFBConfig(fgDisplay.Display, - fgDisplay.Screen, + fbconfigArray = glXChooseFBConfig(fgDisplay.pDisplay.Display, + fgDisplay.pDisplay.Screen, attributes, &fbconfigArraySize); @@ -646,7 +652,7 @@ int * FGAPIENTRY glutGetModeValues(GLenum eWhat, int * size) { int value; - result = glXGetFBConfigAttrib(fgDisplay.Display, + result = glXGetFBConfigAttrib(fgDisplay.pDisplay.Display, fbconfigArray[i], attribute_name, &value);