changeset 4092:2b32a416d202 SDL-1.2

Set an error message when SDL_GL_SetAttribute() fails because we can't support the attribute on X11.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 06 Aug 2007 18:36:46 +0000
parents 98b219f9ff17
children 7ea10b80eda3
files src/video/x11/SDL_x11gl.c
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11gl.c	Sun Aug 05 03:21:18 2007 +0000
+++ b/src/video/x11/SDL_x11gl.c	Mon Aug 06 18:36:46 2007 +0000
@@ -338,7 +338,8 @@
 /* Get attribute data from glX. */
 int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
 {
-	int retval;
+	int retval = -1;
+	int unsupported = 0;
 	int glx_attrib = None;
 
 	switch( attrib ) {
@@ -398,7 +399,7 @@
 			}
 			return retval;
 		} else {
-			return(-1);
+			unsupported = 1;
 		}
 		break;
 	    case SDL_GL_SWAP_CONTROL:
@@ -406,15 +407,19 @@
 			*value = this->gl_data->glXGetSwapIntervalMESA();
 			return(0);
 		} else {
-			return(-1);
+			unsupported = 1;
 		}
 		break;
 	    default:
-		return(-1);
+			unsupported = 1;
+			break;
 	}
 
-	retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
-
+	if (unsupported) {
+		SDL_SetError("OpenGL attribute is unsupported on this system");
+	} else {
+		retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
+	}
 	return retval;
 }