comparison src/video/x11/SDL_x11shape.c @ 4817:c68e7490e4cf

Fixed a couple of bugs in the general and X11 shape code, and fixed a bug in testshape that was keeping it from recognizing surfaces without alpha. Thanks to Andreas's bit-bashing tip, X11 shaped windows now work entirely, AFAICT.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 01 Aug 2010 21:10:42 -0400
parents 329708ffe2a7
children 0c82f20327ec 1f9915666afd
comparison
equal deleted inserted replaced
4816:eb433f0d2ac5 4817:c68e7490e4cf
68 if(data->bitmap == NULL) { 68 if(data->bitmap == NULL) {
69 SDL_SetError("Could not allocate memory for shaped-window bitmap."); 69 SDL_SetError("Could not allocate memory for shaped-window bitmap.");
70 return -1; 70 return -1;
71 } 71 }
72 } 72 }
73 else 73 memset(data->bitmap,0,data->bitmapsize);
74 memset(data->bitmap,0,data->bitmapsize);
75 74
76 window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN; 75 window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
77 76
78 return 0; 77 return 0;
79 } 78 }
88 if(shape->w != shaper->window->w || shape->h != shaper->window->h) 87 if(shape->w != shaper->window->w || shape->h != shaper->window->h)
89 return -3; 88 return -3;
90 SDL_ShapeData *data = shaper->driverdata; 89 SDL_ShapeData *data = shaper->driverdata;
91 90
92 /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */ 91 /* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
93 SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8,1); 92 SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
94 93
95 SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata); 94 SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
96 Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h); 95 Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
97 96
98 XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet); 97 XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);