Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control. SDL-1.2
authorRyan C. Gordon
Tue, 29 Sep 2009 13:50:33 +0000
branchSDL-1.2
changeset 4268d48035d857d3
parent 4267 27f972dd5aff
child 4269 60db3d01cb3a
Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control.

Fixes Bugzilla #697.
src/video/x11/SDL_x11gl.c
src/video/x11/SDL_x11gl_c.h
src/video/x11/SDL_x11video.c
     1.1 --- a/src/video/x11/SDL_x11gl.c	Tue Sep 29 13:42:33 2009 +0000
     1.2 +++ b/src/video/x11/SDL_x11gl.c	Tue Sep 29 13:50:33 2009 +0000
     1.3 @@ -289,7 +289,9 @@
     1.4  		if ( this->gl_data->glXSwapIntervalMESA ) {
     1.5  			this->gl_data->glXSwapIntervalMESA(this->gl_config.swap_control);
     1.6  		} else if ( this->gl_data->glXSwapIntervalSGI ) {
     1.7 -			this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control);
     1.8 +			if (this->gl_data->glXSwapIntervalSGI(this->gl_config.swap_control) != 0) {
     1.9 +				this->gl_data->sgi_swap_interval = this->gl_config.swap_control;
    1.10 +			}
    1.11  		}
    1.12  	}
    1.13  #else
    1.14 @@ -412,7 +414,10 @@
    1.15  	    case SDL_GL_SWAP_CONTROL:
    1.16  		if ( this->gl_data->glXGetSwapIntervalMESA ) {
    1.17  			*value = this->gl_data->glXGetSwapIntervalMESA();
    1.18 -			return(0);
    1.19 +			return 0;
    1.20 +		} else if ( this->gl_data->glXSwapIntervalSGI ) {
    1.21 +			*value = this->gl_data->sgi_swap_interval;
    1.22 +			return 0;
    1.23  		} else {
    1.24  			unsupported = 1;
    1.25  		}
     2.1 --- a/src/video/x11/SDL_x11gl_c.h	Tue Sep 29 13:42:33 2009 +0000
     2.2 +++ b/src/video/x11/SDL_x11gl_c.h	Tue Sep 29 13:50:33 2009 +0000
     2.3 @@ -75,6 +75,7 @@
     2.4      GLint (*glXSwapIntervalMESA) ( unsigned interval );
     2.5      GLint (*glXGetSwapIntervalMESA) ( void );
     2.6  
     2.7 +    int sgi_swap_interval;
     2.8  #endif /* SDL_VIDEO_OPENGL_GLX */
     2.9  };
    2.10  
     3.1 --- a/src/video/x11/SDL_x11video.c	Tue Sep 29 13:42:33 2009 +0000
     3.2 +++ b/src/video/x11/SDL_x11video.c	Tue Sep 29 13:50:33 2009 +0000
     3.3 @@ -121,6 +121,8 @@
     3.4  		SDL_memset(device->hidden, 0, (sizeof *device->hidden));
     3.5  		SDL_memset(device->gl_data, 0, (sizeof *device->gl_data));
     3.6  
     3.7 +		device->gl_data->sgi_swap_interval = 1;
     3.8 +
     3.9  		/* Set the driver flags */
    3.10  		device->handles_any_size = 1;
    3.11