Fixed forcing the window size when creating a non-resizable window on Windows.

This commit is contained in:
Sam Lantinga 2015-10-01 11:21:06 -07:00
parent 667783ba88
commit 7bc72eaf84
1 changed files with 22 additions and 3 deletions

View File

@ -165,7 +165,26 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
int h = rect.bottom; int h = rect.bottom;
if ((window->w && window->w != w) || (window->h && window->h != h)) { if ((window->w && window->w != w) || (window->h && window->h != h)) {
/* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */
WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); RECT rect;
DWORD style;
BOOL menu;
int x, y;
int w, h;
/* Figure out what the window area will be */
style = GetWindowLong(hwnd, GWL_STYLE);
rect.left = 0;
rect.top = 0;
rect.right = window->w;
rect.bottom = window->h;
menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL);
AdjustWindowRectEx(&rect, style, menu, 0);
w = (rect.right - rect.left);
h = (rect.bottom - rect.top);
x = window->x + rect.left;
y = window->y + rect.top;
SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
} else { } else {
window->w = w; window->w = w;
window->h = h; window->h = h;