changeset 4268:d48035d857d3 SDL-1.2

Make SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL) work with GLX_SGI_swap_control. Fixes Bugzilla #697.
author Ryan C. Gordon <icculus@icculus.org>
date Tue, 29 Sep 2009 13:50:33 +0000
parents 27f972dd5aff
children 60db3d01cb3a
files src/video/x11/SDL_x11gl.c src/video/x11/SDL_x11gl_c.h src/video/x11/SDL_x11video.c
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;
 		}
--- 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 */
 };
 
--- 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;