Changed flags and positioning (for the fake-hiding) as Andreas recommended.
--- a/src/video/SDL_shape.c Sat Aug 14 20:29:51 2010 -0400
+++ b/src/video/SDL_shape.c Sun Aug 15 18:52:57 2010 -0400
@@ -32,11 +32,12 @@
SDL_Window*
SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
- SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
+ SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_RESIZABLE);
if(result != NULL) {
result->shaper = result->display->device->shape_driver.CreateShaper(result);
if(result->shaper != NULL) {
- result->shaper->usershownflag = flags & SDL_WINDOW_SHOWN;
+ result->shaper->userx = x;
+ result->shaper->usery = y;
result->shaper->mode.mode = ShapeModeDefault;
result->shaper->mode.parameters.binarizationCutoff = 1;
result->shaper->hasshape = SDL_FALSE;
@@ -239,9 +240,10 @@
window->shaper->mode = *shape_mode;
result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
window->shaper->hasshape = SDL_TRUE;
- if((window->shaper->usershownflag & SDL_WINDOW_SHOWN) == SDL_WINDOW_SHOWN) {
- SDL_ShowWindow(window);
- window->shaper->usershownflag &= !SDL_WINDOW_SHOWN;
+ if(window->shaper->userx == 0 && window->shaper->usery == 0) {
+ SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
+ window->shaper->userx = 0;
+ window->shaper->usery = 0;
}
return result;
}
--- a/src/video/SDL_sysvideo.h Sat Aug 14 20:29:51 2010 -0400
+++ b/src/video/SDL_sysvideo.h Sun Aug 15 18:52:57 2010 -0400
@@ -141,8 +141,8 @@
/* The window associated with the shaper */
SDL_Window *window;
- /* The user's specified SDL_WINDOW_SHOWN flag, for use once the user gives the window a shape. */
- Uint32 usershownflag;
+ /* The user's specified coordinates for the window, for once we give it a shape. */
+ Uint32 userx,usery;
/* The parameters for shape calculation. */
SDL_WindowShapeMode mode;
--- a/src/video/win32/SDL_win32shape.c Sat Aug 14 20:29:51 2010 -0400
+++ b/src/video/win32/SDL_win32shape.c Sun Aug 15 18:52:57 2010 -0400
@@ -32,7 +32,7 @@
result->window = window;
result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1;
- result->usershownflag = 0;
+ result->userx = result->usery = 0;
result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData));
((SDL_ShapeData*)result->driverdata)->mask_tree = NULL;
//Put some driver-data here.
@@ -101,7 +101,9 @@
if(data->mask_tree != NULL)
SDL_FreeShapeTree(&data->mask_tree);
- window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
+ SDL_SetWindowPosition(window,-1000,-1000);
return 0;
}
--- a/src/video/x11/SDL_x11shape.c Sat Aug 14 20:29:51 2010 -0400
+++ b/src/video/x11/SDL_x11shape.c Sun Aug 15 18:52:57 2010 -0400
@@ -40,7 +40,7 @@
result->window = window;
result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1;
- result->usershownflag = 0;
+ result->userx = result->usery = 0;
SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
result->driverdata = data;
data->bitmapsize = 0;
@@ -75,7 +75,9 @@
}
memset(data->bitmap,0,data->bitmapsize);
- window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
+ window->shaper->userx = window->x;
+ window->shaper->usery = window->y;
+ SDL_SetWindowPosition(window,-1000,-1000);
return 0;
}