From f10f6c9ad994285f6eb0a4df8f9a86d70d3b56ab Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 13 Jul 2010 02:26:50 -0400 Subject: [PATCH] Make sure we have XShape symbols before we allow a shaped window. --- src/video/x11/SDL_x11shape.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 12d4c33e1..ac58dfbef 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/src/video/x11/SDL_x11shape.c @@ -27,14 +27,18 @@ #include "SDL_x11video.h" SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) { - SDL_WindowShaper* result = malloc(sizeof(SDL_WindowShaper)); - result->window = window; - result->alphacutoff = 0; - result->usershownflag = 0; - result->driverdata = malloc(sizeof(SDL_ShapeData)); - window->shaper = result; - int resized_properly = X11_ResizeWindowShape(window); - assert(resized_properly == 0); + SDL_WindowShaper* result = NULL; + if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */ + result = malloc(sizeof(SDL_WindowShaper)); + result->window = window; + result->alphacutoff = 0; + result->usershownflag = 0; + result->driverdata = malloc(sizeof(SDL_ShapeData)); + window->shaper = result; + int resized_properly = X11_ResizeWindowShape(window); + assert(resized_properly == 0); + } + return result; }