From 31b06a0ae0a1b31a671762477fbb1daacc9de0c4 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Mon, 11 Jun 2012 14:02:25 +0200 Subject: [PATCH] Win32 window position work. --- src/win32_window.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 6b28cb1e..6a29c86f 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -1047,6 +1047,11 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, case WM_MOVE: { + RECT rect; + + GetClientRect(window->Win32.handle, &rect); + AdjustWindowRectEx(&rect, window->Win32.dwStyle, FALSE, window->Win32.dwExStyle); + // If window is in cursor capture mode, update clipping rect if (window->cursorMode == GLFW_CURSOR_CAPTURED) { @@ -1055,7 +1060,9 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, ClipCursor(&ClipWindowRect); } - _glfwInputWindowPos(window, LOWORD(lParam), HIWORD(lParam)); + _glfwInputWindowPos(window, + LOWORD(lParam) - rect.left, + HIWORD(lParam) - rect.top); return 0; } @@ -1632,7 +1639,13 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height) void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y) { - SetWindowPos(window->Win32.handle, HWND_TOP, x, y, 0, 0, + RECT rect; + + GetClientRect(window->Win32.handle, &rect); + AdjustWindowRectEx(&rect, window->Win32.dwStyle, FALSE, window->Win32.dwExStyle); + + SetWindowPos(window->Win32.handle, HWND_TOP, + x + rect.left, y + rect.top, 0, 0, SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER); }