From dc409fe76cb8d9372f785b33525ad8e51bb31ca1 Mon Sep 17 00:00:00 2001 From: Henrique Santiago Date: Sun, 20 Mar 2011 20:09:27 -0300 Subject: [PATCH] win32 rect fix --- src/framework/win32platform.cpp | 45 ++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/framework/win32platform.cpp b/src/framework/win32platform.cpp index ec74ee05..bb041a54 100644 --- a/src/framework/win32platform.cpp +++ b/src/framework/win32platform.cpp @@ -111,19 +111,20 @@ bool Platform::createWindow(int x, int y, int width, int height, int minWidth, i win32.minHeight = minHeight; win32.maximized = maximized; - //AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle); - - win32.window = CreateWindowExA(dwExStyle, // Extended Style For The Window - win32.appName.c_str(), // Class Name - win32.appName.c_str(), // Window Title - dwStyle, // Required Window Style - x, // Window X Position - y, // Window Y Position - width, // Calculate Window Width - height, // Calculate Window Height - NULL, // No Parent Window - NULL, // No Menu - win32.instance, // Instance + RECT windowRect = {x, y, x + width, y + height}; + AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle); + + win32.window = CreateWindowExA(dwExStyle, // Extended Style For The Window + win32.appName.c_str(), // Class Name + win32.appName.c_str(), // Window Title + dwStyle, // Required Window Style + windowRect.left, // Window X Position + windowRect.top, // Window Y Position + windowRect.right - windowRect.left, // Calculate Window Width + windowRect.bottom - windowRect.top, // Calculate Window Height + NULL, // No Parent Window + NULL, // No Menu + win32.instance, // Instance NULL); if(!win32.window) { @@ -314,6 +315,16 @@ int Platform::getWindowHeight() return win32.height; } +int Platform::getDisplayWidth() +{ + return GetSystemMetrics(SM_CXSCREEN); +} + +int Platform::getDisplayHeight() +{ + return GetSystemMetrics(SM_CYSCREEN); +} + bool Platform::isWindowMaximized() { return win32.maximized; @@ -344,12 +355,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) minMax->ptMinTrackSize.y = win32.minHeight; break; } - case WM_MOVING: - case WM_SIZING: + case WM_MOVE: { - RECT *rect = (RECT*)lParam; - win32.x = rect->left; - win32.y = rect->top; + win32.x = LOWORD(lParam); + win32.y = HIWORD(lParam); break; } case WM_SIZE: