Changed flags and positioning (for the fake-hiding) as Andreas recommended.
authorEli Gottlieb <eligottlieb@gmail.com>
Sun, 15 Aug 2010 18:52:57 -0400
changeset 48515624fb0190b5
parent 4850 14870d46ee2d
child 4852 c19c729eb201
Changed flags and positioning (for the fake-hiding) as Andreas recommended.
src/video/SDL_shape.c
src/video/SDL_sysvideo.h
src/video/win32/SDL_win32shape.c
src/video/x11/SDL_x11shape.c
     1.1 --- a/src/video/SDL_shape.c	Sat Aug 14 20:29:51 2010 -0400
     1.2 +++ b/src/video/SDL_shape.c	Sun Aug 15 18:52:57 2010 -0400
     1.3 @@ -32,11 +32,12 @@
     1.4  
     1.5  SDL_Window*
     1.6  SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
     1.7 -    SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN);
     1.8 +    SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_RESIZABLE);
     1.9      if(result != NULL) {
    1.10          result->shaper = result->display->device->shape_driver.CreateShaper(result);
    1.11          if(result->shaper != NULL) {
    1.12 -            result->shaper->usershownflag = flags & SDL_WINDOW_SHOWN;
    1.13 +            result->shaper->userx = x;
    1.14 +            result->shaper->usery = y;
    1.15              result->shaper->mode.mode = ShapeModeDefault;
    1.16              result->shaper->mode.parameters.binarizationCutoff = 1;
    1.17              result->shaper->hasshape = SDL_FALSE;
    1.18 @@ -239,9 +240,10 @@
    1.19          window->shaper->mode = *shape_mode;
    1.20      result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
    1.21      window->shaper->hasshape = SDL_TRUE;
    1.22 -    if((window->shaper->usershownflag & SDL_WINDOW_SHOWN) == SDL_WINDOW_SHOWN) {
    1.23 -        SDL_ShowWindow(window);
    1.24 -        window->shaper->usershownflag &= !SDL_WINDOW_SHOWN;
    1.25 +    if(window->shaper->userx == 0 && window->shaper->usery == 0) {
    1.26 +        SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
    1.27 +        window->shaper->userx = 0;
    1.28 +        window->shaper->usery = 0;
    1.29      }
    1.30      return result;
    1.31  }
     2.1 --- a/src/video/SDL_sysvideo.h	Sat Aug 14 20:29:51 2010 -0400
     2.2 +++ b/src/video/SDL_sysvideo.h	Sun Aug 15 18:52:57 2010 -0400
     2.3 @@ -141,8 +141,8 @@
     2.4      /* The window associated with the shaper */
     2.5      SDL_Window *window;
     2.6      
     2.7 -    /* The user's specified SDL_WINDOW_SHOWN flag, for use once the user gives the window a shape. */
     2.8 -    Uint32 usershownflag;
     2.9 +    /* The user's specified coordinates for the window, for once we give it a shape. */
    2.10 +    Uint32 userx,usery;
    2.11      
    2.12      /* The parameters for shape calculation. */
    2.13      SDL_WindowShapeMode mode;
     3.1 --- a/src/video/win32/SDL_win32shape.c	Sat Aug 14 20:29:51 2010 -0400
     3.2 +++ b/src/video/win32/SDL_win32shape.c	Sun Aug 15 18:52:57 2010 -0400
     3.3 @@ -32,7 +32,7 @@
     3.4      result->window = window;
     3.5      result->mode.mode = ShapeModeDefault;
     3.6      result->mode.parameters.binarizationCutoff = 1;
     3.7 -    result->usershownflag = 0;
     3.8 +    result->userx = result->usery = 0;
     3.9      result->driverdata = (SDL_ShapeData*)SDL_malloc(sizeof(SDL_ShapeData));
    3.10      ((SDL_ShapeData*)result->driverdata)->mask_tree = NULL;
    3.11      //Put some driver-data here.
    3.12 @@ -101,7 +101,9 @@
    3.13      if(data->mask_tree != NULL)
    3.14          SDL_FreeShapeTree(&data->mask_tree);
    3.15      
    3.16 -    window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
    3.17 +    window->shaper->userx = window->x;
    3.18 +    window->shaper->usery = window->y;
    3.19 +    SDL_SetWindowPosition(window,-1000,-1000);
    3.20      
    3.21      return 0;
    3.22  }
     4.1 --- a/src/video/x11/SDL_x11shape.c	Sat Aug 14 20:29:51 2010 -0400
     4.2 +++ b/src/video/x11/SDL_x11shape.c	Sun Aug 15 18:52:57 2010 -0400
     4.3 @@ -40,7 +40,7 @@
     4.4          result->window = window;
     4.5          result->mode.mode = ShapeModeDefault;
     4.6          result->mode.parameters.binarizationCutoff = 1;
     4.7 -        result->usershownflag = 0;
     4.8 +        result->userx = result->usery = 0;
     4.9          SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
    4.10          result->driverdata = data;
    4.11          data->bitmapsize = 0;
    4.12 @@ -75,7 +75,9 @@
    4.13      }
    4.14      memset(data->bitmap,0,data->bitmapsize);
    4.15      
    4.16 -    window->shaper->usershownflag |= window->flags & SDL_WINDOW_SHOWN;
    4.17 +    window->shaper->userx = window->x;
    4.18 +    window->shaper->usery = window->y;
    4.19 +    SDL_SetWindowPosition(window,-1000,-1000);
    4.20      
    4.21      return 0;
    4.22  }