Make sure we have XShape symbols before we allow a shaped window.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 13 Jul 2010 02:26:50 -0400
changeset 4791e07cd9e86d7a
parent 4790 f0b0bdc07916
child 4792 aece2b6fb985
Make sure we have XShape symbols before we allow a shaped window.
src/video/x11/SDL_x11shape.c
     1.1 --- a/src/video/x11/SDL_x11shape.c	Tue Jul 13 02:12:14 2010 -0400
     1.2 +++ b/src/video/x11/SDL_x11shape.c	Tue Jul 13 02:26:50 2010 -0400
     1.3 @@ -27,14 +27,18 @@
     1.4  #include "SDL_x11video.h"
     1.5  
     1.6  SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
     1.7 -	SDL_WindowShaper* result = malloc(sizeof(SDL_WindowShaper));
     1.8 -	result->window = window;
     1.9 -	result->alphacutoff = 0;
    1.10 -	result->usershownflag = 0;
    1.11 -	result->driverdata = malloc(sizeof(SDL_ShapeData));
    1.12 -	window->shaper = result;
    1.13 -	int resized_properly = X11_ResizeWindowShape(window);
    1.14 -	assert(resized_properly == 0);
    1.15 +	SDL_WindowShaper* result = NULL;
    1.16 +	if (SDL_X11_HAVE_XSHAPE) {  /* Make sure X server supports it. */
    1.17 +		result = malloc(sizeof(SDL_WindowShaper));
    1.18 +		result->window = window;
    1.19 +		result->alphacutoff = 0;
    1.20 +		result->usershownflag = 0;
    1.21 +		result->driverdata = malloc(sizeof(SDL_ShapeData));
    1.22 +		window->shaper = result;
    1.23 +		int resized_properly = X11_ResizeWindowShape(window);
    1.24 +		assert(resized_properly == 0);
    1.25 +	}
    1.26 +
    1.27  	return result;
    1.28  }
    1.29