X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_init_x11.c;h=d2907c9edf967641e44e3df1675503d2deb6340c;hb=2c12c9eb8d63cabac2d4113b4f54fdf53da8368c;hp=49aefe6c036c55595f3d5ff0ddff9de2b34ec544;hpb=425c4ee7334fde9602f8257922d270e9389b1744;p=freeglut diff --git a/src/x11/fg_init_x11.c b/src/x11/fg_init_x11.c index 49aefe6..d2907c9 100644 --- a/src/x11/fg_init_x11.c +++ b/src/x11/fg_init_x11.c @@ -1,5 +1,5 @@ /* - * freeglut_init_x11.c + * fg_init_x11.c * * Various freeglut initialization functions. * @@ -176,12 +176,23 @@ void fgPlatformInitialize( const char* displayName ) if( fgDisplay.pDisplay.Display == NULL ) fgError( "failed to open display '%s'", XDisplayName( displayName ) ); + if ( fgState.XSyncSwitch ) + XSynchronize(fgDisplay.pDisplay.Display, True); + #ifdef EGL_VERSION_1_0 fghPlatformInitializeEGL(); #else if( !glXQueryExtension( fgDisplay.pDisplay.Display, NULL, NULL ) ) fgError( "OpenGL GLX extension not supported by display '%s'", XDisplayName( displayName ) ); + + /* This forces AMD Catalyst drivers to initialize and register a shutdown + * function, which must be done before our own call to atexit to prevent + * a crash if glutMainLoop is not called or is not exited cleanly. + * (see bug #206) + */ + glXQueryExtensionsString( fgDisplay.pDisplay.Display, + DefaultScreen( fgDisplay.pDisplay.Display )); #endif fgDisplay.pDisplay.Screen = DefaultScreen( fgDisplay.pDisplay.Display );