X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_state.c;h=07539b04d8f465e0487d04337b23316d89ed9a8f;hb=1b9a554a58e5595d9512540df60a3d681dc784a9;hp=48ff9a364d6131ff6f3323333ed53c6b7b8e9296;hpb=9452a820ee4982b4c652d8e1538d0981ad48f200;p=freeglut diff --git a/src/freeglut_state.c b/src/freeglut_state.c index 48ff9a3..07539b0 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -52,10 +52,13 @@ static int fghGetConfig( int attribute ) { int returnValue = 0; + int result; /* Not checked */ if( fgStructure.CurrentWindow ) - glXGetConfig( fgDisplay.Display, fgStructure.CurrentWindow->Window.VisualInfo, - attribute, &returnValue ); + result = glXGetFBConfigAttrib( fgDisplay.Display, + *(fgStructure.CurrentWindow->Window.FBConfig), + attribute, + &returnValue ); return returnValue; } @@ -120,7 +123,6 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) } #if TARGET_HOST_MS_WINDOWS -/* WRONG-- FIXME */ /* The following include file is available from SGI but is not standard: * #include * So we copy the necessary parts out of it to support the multisampling query @@ -160,10 +162,14 @@ int FGAPIENTRY glutGet( GLenum eWhat ) case GLUT_SCREEN_HEIGHT: return fgDisplay.ScreenHeight ; case GLUT_SCREEN_WIDTH_MM: return fgDisplay.ScreenWidthMM ; case GLUT_SCREEN_HEIGHT_MM: return fgDisplay.ScreenHeightMM; - case GLUT_INIT_WINDOW_X: return fgState.Position.X ; - case GLUT_INIT_WINDOW_Y: return fgState.Position.Y ; - case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.X ; - case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Y ; + case GLUT_INIT_WINDOW_X: return fgState.Position.Use ? + fgState.Position.X : -1 ; + case GLUT_INIT_WINDOW_Y: return fgState.Position.Use ? + fgState.Position.Y : -1 ; + case GLUT_INIT_WINDOW_WIDTH: return fgState.Size.Use ? + fgState.Size.X : -1 ; + case GLUT_INIT_WINDOW_HEIGHT: return fgState.Size.Use ? + fgState.Size.Y : -1 ; case GLUT_INIT_DISPLAY_MODE: return fgState.DisplayMode ; #if TARGET_HOST_POSIX_X11 @@ -210,7 +216,20 @@ int FGAPIENTRY glutGet( GLenum eWhat ) */ return 0; } - return fgStructure.CurrentWindow->Window.VisualInfo->visual->map_entries; + else + { + const GLXFBConfig * fbconfig = + fgStructure.CurrentWindow->Window.FBConfig; + + XVisualInfo * visualInfo = + glXGetVisualFromFBConfig( fgDisplay.Display, *fbconfig ); + + const int result = visualInfo->visual->map_entries; + + XFree(visualInfo); + + return result; + } /* * Those calls are somewhat similiar, as they use XGetWindowAttributes() @@ -275,13 +294,23 @@ int FGAPIENTRY glutGet( GLenum eWhat ) /* I do not know yet if there will be a fgChooseVisual() function for Win32 */ case GLUT_DISPLAY_MODE_POSSIBLE: { - XVisualInfo* visualInfo = fgChooseVisual(); - if ( visualInfo == NULL ) { - return 0; - } else { - XFree( visualInfo ); - return 1; + /* We should not have to call fgChooseFBConfig again here. */ + GLXFBConfig * fbconfig; + int isPossible; + + fbconfig = fgChooseFBConfig(); + + if (fbconfig == NULL) + { + isPossible = 0; } + else + { + isPossible = 1; + XFree(fbconfig); + } + + return isPossible; } /* This is system-dependant */ @@ -289,7 +318,7 @@ int FGAPIENTRY glutGet( GLenum eWhat ) if( fgStructure.CurrentWindow == NULL ) return 0; - return fgStructure.CurrentWindow->Window.VisualInfo->visualid; + return fghGetConfig( GLX_VISUAL_ID ); #elif TARGET_HOST_MS_WINDOWS @@ -503,7 +532,10 @@ int FGAPIENTRY glutDeviceGet( GLenum eWhat ) */ #if defined(_WIN32_CE) return ( GetKeyboardStatus() & KBDI_KEYBOARD_PRESENT ) ? 1 : 0; -# pragma comment (lib,"Kbdui.lib") +# if FREEGLUT_LIB_PRAGMAS +# pragma comment (lib,"Kbdui.lib") +# endif + #else return 1; #endif