src/video/windows/SDL_windowswindow.c
changeset 5495 b3680e05286d
parent 5494 78b351c52f53
child 5535 96594ac5fd1a
equal deleted inserted replaced
5494:78b351c52f53 5495:b3680e05286d
   343 WIN_SetWindowPosition(_THIS, SDL_Window * window)
   343 WIN_SetWindowPosition(_THIS, SDL_Window * window)
   344 {
   344 {
   345     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   345     SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
   346     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
   346     HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd;
   347     RECT rect;
   347     RECT rect;
   348     SDL_Rect bounds;
       
   349     DWORD style;
   348     DWORD style;
   350     HWND top;
   349     HWND top;
   351     BOOL menu;
   350     BOOL menu;
   352     int x, y;
   351     int x, y;
   353     int w, h;
   352     int w, h;
   369     menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
   368     menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
   370 #endif
   369 #endif
   371     AdjustWindowRectEx(&rect, style, menu, 0);
   370     AdjustWindowRectEx(&rect, style, menu, 0);
   372     w = (rect.right - rect.left);
   371     w = (rect.right - rect.left);
   373     h = (rect.bottom - rect.top);
   372     h = (rect.bottom - rect.top);
   374 
   373     x = window->x + rect.left;
   375     WIN_GetDisplayBounds(_this, display, &bounds);
   374     y = window->y + rect.top;
   376     if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
       
   377         x = bounds.x + (bounds.w - w) / 2;
       
   378     } else {
       
   379         x = window->x + rect.left;
       
   380     }
       
   381     if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
       
   382         y = bounds.y + (bounds.h - h) / 2;
       
   383     } else {
       
   384         y = window->y + rect.top;
       
   385     }
       
   386 
   375 
   387     SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE));
   376     SetWindowPos(hwnd, top, x, y, 0, 0, (SWP_NOCOPYBITS | SWP_NOSIZE));
   388 }
   377 }
   389 
   378 
   390 void
   379 void