# HG changeset patch # User Ryan C. Gordon # Date 1254232233 0 # Node ID d48035d857d32c52b30eab45791ffc4a99306fb0 # Parent 27f972dd5affba4e2f1425d0efbb8680bab1be1d Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control. Fixes Bugzilla #697. diff -r 27f972dd5aff -r d48035d857d3 src/video/x11/SDL_x11gl.c --- a/src/video/x11/SDL_x11gl.c Tue Sep 29 13:42:33 2009 +0000 +++ b/src/video/x11/SDL_x11gl.c Tue Sep 29 13:50:33 2009 +0000 @@ -289,7 +289,9 @@ if ( this->gl_data->glXSwapIntervalMESA ) { this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control); } else if ( this->gl_data->glXSwapIntervalSGI ) { - this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control); + if (this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control) != 0) { + this->gl_data->sgi_swap_interval = this->gl_config.swap_control; + } } } #else @@ -412,7 +414,10 @@ case SDL_GL_SWAP_CONTROL: if ( this->gl_data->glXGetSwapIntervalMESA ) { *value = this->gl_data->glXGetSwapIntervalMESA(); - return(0); + return 0; + } else if ( this->gl_data->glXSwapIntervalSGI ) { + *value = this->gl_data->sgi_swap_interval; + return 0; } else { unsupported = 1; } diff -r 27f972dd5aff -r d48035d857d3 src/video/x11/SDL_x11gl_c.h --- a/src/video/x11/SDL_x11gl_c.h Tue Sep 29 13:42:33 2009 +0000 +++ b/src/video/x11/SDL_x11gl_c.h Tue Sep 29 13:50:33 2009 +0000 @@ -75,6 +75,7 @@ GLint (*glXSwapIntervalMESA) ( unsigned interval ); GLint (*glXGetSwapIntervalMESA) ( void ); + int sgi_swap_interval; #endif /* SDL_VIDEO_OPENGL_GLX */ }; diff -r 27f972dd5aff -r d48035d857d3 src/video/x11/SDL_x11video.c --- a/src/video/x11/SDL_x11video.c Tue Sep 29 13:42:33 2009 +0000 +++ b/src/video/x11/SDL_x11video.c Tue Sep 29 13:50:33 2009 +0000 @@ -121,6 +121,8 @@ SDL_memset(device->hidden, 0, (sizeof *device->hidden)); SDL_memset(device->gl_data, 0, (sizeof *device->gl_data)); + device->gl_data->sgi_swap_interval = 1; + /* Set the driver flags */ device->handles_any_size = 1;