From 83da1c5b548d9205cfd4f93eecb3a3a4856fedcb Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 6 Aug 2013 22:55:55 -0700 Subject: [PATCH] Fixed bug 1848 - SDL_SetWindowSize cannot set sizes larger than desktop resolution in Windows --- src/video/windows/SDL_windowswindow.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/video/windows/SDL_windowswindow.c b/src/video/windows/SDL_windowswindow.c index f40323ea6..156d0f445 100644 --- a/src/video/windows/SDL_windowswindow.c +++ b/src/video/windows/SDL_windowswindow.c @@ -131,8 +131,15 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) { RECT rect; if (GetClientRect(hwnd, &rect)) { - window->w = rect.right; - window->h = rect.bottom; + int w = rect.right; + int h = rect.bottom; + 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! + SetWindowPos(hwnd, NULL, 0, 0, window->w, window->h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + } else { + window->w = w; + window->h = h; + } } } {