Set an error message when SDL_GL_SetAttribute() fails because we can't support SDL-1.2
authorRyan C. Gordon
Mon, 06 Aug 2007 18:36:46 +0000
branchSDL-1.2
changeset 40922b32a416d202
parent 4091 98b219f9ff17
child 4093 7ea10b80eda3
Set an error message when SDL_GL_SetAttribute() fails because we can't support
the attribute on X11.
src/video/x11/SDL_x11gl.c
     1.1 --- a/src/video/x11/SDL_x11gl.c	Sun Aug 05 03:21:18 2007 +0000
     1.2 +++ b/src/video/x11/SDL_x11gl.c	Mon Aug 06 18:36:46 2007 +0000
     1.3 @@ -338,7 +338,8 @@
     1.4  /* Get attribute data from glX. */
     1.5  int X11_GL_GetAttribute(_THIS, SDL_GLattr attrib, int* value)
     1.6  {
     1.7 -	int retval;
     1.8 +	int retval = -1;
     1.9 +	int unsupported = 0;
    1.10  	int glx_attrib = None;
    1.11  
    1.12  	switch( attrib ) {
    1.13 @@ -398,7 +399,7 @@
    1.14  			}
    1.15  			return retval;
    1.16  		} else {
    1.17 -			return(-1);
    1.18 +			unsupported = 1;
    1.19  		}
    1.20  		break;
    1.21  	    case SDL_GL_SWAP_CONTROL:
    1.22 @@ -406,15 +407,19 @@
    1.23  			*value = this->gl_data->glXGetSwapIntervalMESA();
    1.24  			return(0);
    1.25  		} else {
    1.26 -			return(-1);
    1.27 +			unsupported = 1;
    1.28  		}
    1.29  		break;
    1.30  	    default:
    1.31 -		return(-1);
    1.32 +			unsupported = 1;
    1.33 +			break;
    1.34  	}
    1.35  
    1.36 -	retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
    1.37 -
    1.38 +	if (unsupported) {
    1.39 +		SDL_SetError("OpenGL attribute is unsupported on this system");
    1.40 +	} else {
    1.41 +		retval = this->gl_data->glXGetConfig(GFX_Display, glx_visualinfo, glx_attrib, value);
    1.42 +	}
    1.43  	return retval;
    1.44  }
    1.45