comparison src/video/SDL_shape.c @ 4851:5624fb0190b5

Changed flags and positioning (for the fake-hiding) as Andreas recommended.
author Eli Gottlieb <eligottlieb@gmail.com>
date Sun, 15 Aug 2010 18:52:57 -0400
parents 14870d46ee2d
children c19c729eb201
comparison
equal deleted inserted replaced
4850:14870d46ee2d 4851:5624fb0190b5
30 #include "SDL_shape.h" 30 #include "SDL_shape.h"
31 #include "SDL_shape_internals.h" 31 #include "SDL_shape_internals.h"
32 32
33 SDL_Window* 33 SDL_Window*
34 SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { 34 SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) {
35 SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_SHOWN); 35 SDL_Window *result = SDL_CreateWindow(title,x,y,w,h,flags | SDL_WINDOW_BORDERLESS & !SDL_WINDOW_FULLSCREEN & !SDL_WINDOW_RESIZABLE);
36 if(result != NULL) { 36 if(result != NULL) {
37 result->shaper = result->display->device->shape_driver.CreateShaper(result); 37 result->shaper = result->display->device->shape_driver.CreateShaper(result);
38 if(result->shaper != NULL) { 38 if(result->shaper != NULL) {
39 result->shaper->usershownflag = flags & SDL_WINDOW_SHOWN; 39 result->shaper->userx = x;
40 result->shaper->usery = y;
40 result->shaper->mode.mode = ShapeModeDefault; 41 result->shaper->mode.mode = ShapeModeDefault;
41 result->shaper->mode.parameters.binarizationCutoff = 1; 42 result->shaper->mode.parameters.binarizationCutoff = 1;
42 result->shaper->hasshape = SDL_FALSE; 43 result->shaper->hasshape = SDL_FALSE;
43 return result; 44 return result;
44 } 45 }
237 238
238 if(shape_mode != NULL) 239 if(shape_mode != NULL)
239 window->shaper->mode = *shape_mode; 240 window->shaper->mode = *shape_mode;
240 result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode); 241 result = window->display->device->shape_driver.SetWindowShape(window->shaper,shape,shape_mode);
241 window->shaper->hasshape = SDL_TRUE; 242 window->shaper->hasshape = SDL_TRUE;
242 if((window->shaper->usershownflag & SDL_WINDOW_SHOWN) == SDL_WINDOW_SHOWN) { 243 if(window->shaper->userx == 0 && window->shaper->usery == 0) {
243 SDL_ShowWindow(window); 244 SDL_SetWindowPosition(window,window->shaper->userx,window->shaper->usery);
244 window->shaper->usershownflag &= !SDL_WINDOW_SHOWN; 245 window->shaper->userx = 0;
246 window->shaper->usery = 0;
245 } 247 }
246 return result; 248 return result;
247 } 249 }
248 250
249 SDL_bool 251 SDL_bool