From ebdee32601cc7747ea08278f00c5a11c1b8ab396 Mon Sep 17 00:00:00 2001 From: laurentgom Date: Sat, 14 Feb 2009 11:13:33 +0000 Subject: [PATCH] Fixed Window::SetSize not resizing to the requested size, on Windows git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1016 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Window/Win32/WindowImplWin32.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index 736d5e6aa..2bd9c6d4a 100644 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -355,6 +355,13 @@ void WindowImplWin32::SetPosition(int Left, int Top) //////////////////////////////////////////////////////////// void WindowImplWin32::SetSize(unsigned int Width, unsigned int Height) { + // SetWindowPos wants the total size of the window (including title bar and borders), + // so we have to compute it + RECT Rect = {0, 0, Width, Height}; + AdjustWindowRect(&Rect, GetWindowLong(myHandle, GWL_STYLE), false); + Width = Rect.right - Rect.left; + Height = Rect.bottom - Rect.top; + SetWindowPos(myHandle, NULL, 0, 0, Width, Height, SWP_NOMOVE | SWP_NOZORDER); }