Check configure-defined macro before doing _anything_ with XShape.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 13 Jul 2010 02:43:49 -0400
changeset 4794e562160a873f
parent 4793 cb31d2fdbe61
child 4795 6f0bc179771c
Check configure-defined macro before doing _anything_ with XShape.
src/video/x11/SDL_x11shape.c
src/video/x11/SDL_x11sym.h
src/video/x11/SDL_x11video.h
     1.1 --- a/src/video/x11/SDL_x11shape.c	Tue Jul 13 02:43:10 2010 -0400
     1.2 +++ b/src/video/x11/SDL_x11shape.c	Tue Jul 13 02:43:49 2010 -0400
     1.3 @@ -21,13 +21,14 @@
     1.4  */
     1.5  
     1.6  #include <assert.h>
     1.7 -#include <X11/extensions/shape.h>
     1.8 +#include "SDL_x11video.h"
     1.9  #include "SDL_x11shape.h"
    1.10  #include "SDL_x11window.h"
    1.11 -#include "SDL_x11video.h"
    1.12  
    1.13  SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) {
    1.14  	SDL_WindowShaper* result = NULL;
    1.15 +
    1.16 +#if SDL_VIDEO_DRIVER_X11_XSHAPE
    1.17  	if (SDL_X11_HAVE_XSHAPE) {  /* Make sure X server supports it. */
    1.18  		result = malloc(sizeof(SDL_WindowShaper));
    1.19  		result->window = window;
    1.20 @@ -38,6 +39,7 @@
    1.21  		int resized_properly = X11_ResizeWindowShape(window);
    1.22  		assert(resized_properly == 0);
    1.23  	}
    1.24 +#endif
    1.25  
    1.26  	return result;
    1.27  }
    1.28 @@ -69,6 +71,8 @@
    1.29  int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode) {
    1.30  	if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
    1.31  		return -1;
    1.32 +
    1.33 +#if SDL_VIDEO_DRIVER_X11_XSHAPE
    1.34  	if(!SDL_ISPIXELFORMAT_ALPHA(SDL_MasksToPixelFormatEnum(shape->format->BitsPerPixel,shape->format->Rmask,shape->format->Gmask,shape->format->Bmask,shape->format->Amask)))
    1.35  		return -2;
    1.36  	if(shape->w != shaper->window->w || shape->h != shaper->window->h)
    1.37 @@ -85,6 +89,7 @@
    1.38  	XSync(windowdata->videodata->display,False);
    1.39  
    1.40  	XFreePixmap(windowdata->videodata->display,shapemask);
    1.41 -	
    1.42 +#endif
    1.43 +
    1.44  	return 0;
    1.45  }
     2.1 --- a/src/video/x11/SDL_x11sym.h	Tue Jul 13 02:43:10 2010 -0400
     2.2 +++ b/src/video/x11/SDL_x11sym.h	Tue Jul 13 02:43:49 2010 -0400
     2.3 @@ -233,7 +233,7 @@
     2.4  SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return)
     2.5  #endif
     2.6  
     2.7 -#if 1 /* !!! FIXME: SDL_VIDEO_DRIVER_X11_XSHAPE */
     2.8 +#if SDL_VIDEO_DRIVER_X11_XSHAPE
     2.9  SDL_X11_MODULE(XSHAPE)
    2.10  SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),)
    2.11  #endif
     3.1 --- a/src/video/x11/SDL_x11video.h	Tue Jul 13 02:43:10 2010 -0400
     3.2 +++ b/src/video/x11/SDL_x11video.h	Tue Jul 13 02:43:49 2010 -0400
     3.3 @@ -45,6 +45,9 @@
     3.4  #if SDL_VIDEO_DRIVER_X11_SCRNSAVER
     3.5  #include <X11/extensions/scrnsaver.h>
     3.6  #endif
     3.7 +#if SDL_VIDEO_DRIVER_X11_XSHAPE
     3.8 +#include <X11/extensions/shape.h>
     3.9 +#endif
    3.10  
    3.11  #include "SDL_x11dyn.h"
    3.12