From b20ee01837e8fb11027c3fa8834c8803dec93d87 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 6 Aug 2007 18:36:46 +0000 Subject: [PATCH] Set an error message when SDL_GL_SetAttribute() fails because we can't support the attribute on X11. --- src/video/x11/SDL_x11gl.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/video/x11/SDL_x11gl.c b/src/video/x11/SDL_x11gl.c index dcf808097..65fe09a84 100644 --- a/src/video/x11/SDL_x11gl.c +++ b/src/video/x11/SDL_x11gl.c @@ -338,7 +338,8 @@ int X11_GL_MakeCurrent(_THIS) /* 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 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) } return retval; } else { - return(-1); + unsupported = 1; } break; case SDL_GL_SWAP_CONTROL: @@ -406,15 +407,19 @@ int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value) *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; }