src/video/windows/SDL_windowswindow.c
changeset 5382 fd9a7a0afcbf
parent 5305 75f5ff92ad08
child 5398 83816c8a2b58
equal deleted inserted replaced
5381:79e60256dbf7 5382:fd9a7a0afcbf
   192 WIN_CreateWindow(_THIS, SDL_Window * window)
   192 WIN_CreateWindow(_THIS, SDL_Window * window)
   193 {
   193 {
   194     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   194     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   195     HWND hwnd;
   195     HWND hwnd;
   196     RECT rect;
   196     RECT rect;
   197     SDL_Rect bounds;
       
   198     DWORD style = STYLE_BASIC;
   197     DWORD style = STYLE_BASIC;
   199     int x, y;
   198     int x, y;
   200     int w, h;
   199     int w, h;
   201     
   200     
   202     style |= GetWindowStyle(window);
   201     style |= GetWindowStyle(window);
   203 
   202 
   204     /* Figure out what the window area will be */
   203     /* Figure out what the window area will be */
   205     rect.left = 0;
   204     rect.left = window->x;
   206     rect.top = 0;
   205     rect.top = window->y;
   207     rect.right = window->w;
   206     rect.right = window->x + window->w;
   208     rect.bottom = window->h;
   207     rect.bottom = window->y + window->h;
   209     AdjustWindowRectEx(&rect, style, FALSE, 0);
   208     AdjustWindowRectEx(&rect, style, FALSE, 0);
       
   209     x = rect.left;
       
   210     y = rect.top;
   210     w = (rect.right - rect.left);
   211     w = (rect.right - rect.left);
   211     h = (rect.bottom - rect.top);
   212     h = (rect.bottom - rect.top);
   212 
       
   213     WIN_GetDisplayBounds(_this, display, &bounds);
       
   214     if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
       
   215         x = bounds.x + (bounds.w - w) / 2;
       
   216     } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
       
   217         if (bounds.x == 0) {
       
   218             x = CW_USEDEFAULT;
       
   219         } else {
       
   220             x = bounds.x;
       
   221         }
       
   222     } else {
       
   223         x = window->x + rect.left;
       
   224     }
       
   225     if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
       
   226         y = bounds.y + (bounds.h - h) / 2;
       
   227     } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
       
   228         if (bounds.x == 0) {
       
   229             y = CW_USEDEFAULT;
       
   230         } else {
       
   231             y = bounds.y;
       
   232         }
       
   233     } else {
       
   234         y = window->y + rect.top;
       
   235     }
       
   236 
   213 
   237     hwnd =
   214     hwnd =
   238         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
   215         CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL,
   239                      SDL_Instance, NULL);
   216                      SDL_Instance, NULL);
   240     if (!hwnd) {
   217     if (!hwnd) {