diff options
author | Nathan Letwory <nathan@letworyinteractive.com> | 2007-12-31 01:52:00 +0300 |
---|---|---|
committer | Nathan Letwory <nathan@letworyinteractive.com> | 2007-12-31 01:52:00 +0300 |
commit | 1fec64a40219cdd3cf4a2248cb0b68efb83f33da (patch) | |
tree | 4c3a1290d20e6170ba52ebdf422f0e26c316ee82 /intern/ghost | |
parent | f25ce8d0fff3a05c7eeb0d75fe37601f42072edc (diff) |
* revert my change to windowmanager move/size handling.
* made win32 ghost getClientBounds so that it returns area compatible with osx getClientBounds
- if a window is non-fullscreen, substract decoration, since that'll be added by GHOST_WindowWin32()
* use SetWindowLongPtr/GetWindowLongPtr (instead of SetWindowLong) as it is compatible with 64bit windows.
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 6 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowCarbon.cpp | 4 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_WindowWin32.cpp | 26 |
3 files changed, 21 insertions, 15 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 5abaf78472e..fc8774f4298 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -750,8 +750,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * message without calling DefWindowProc. */ event = processWindowEvent(GHOST_kEventWindowSize, window); - ::ValidateRect(hwnd, NULL); - break; + break; case WM_CAPTURECHANGED: window->lostMouseCapture(); break; @@ -775,8 +774,7 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, * message without calling DefWindowProc. */ event = processWindowEvent(GHOST_kEventWindowMove, window); - ::ValidateRect(hwnd, NULL); - break; + break; case WM_ERASEBKGND: /* An application sends the WM_ERASEBKGND message when the window background must be * erased (for example, when a window is resized). The message is sent to prepare an diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp index 7d6aded6f72..85f0fdb07aa 100644 --- a/intern/ghost/intern/GHOST_WindowCarbon.cpp +++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp @@ -255,8 +255,8 @@ void GHOST_WindowCarbon::getClientBounds(GHOST_Rect& bounds) const { Rect rect; GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid") - ::GetPortBounds(m_grafPtr, &rect); - //::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect); + //::GetPortBounds(m_grafPtr, &rect); + ::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect); bounds.m_b = rect.bottom; bounds.m_l = rect.left; diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 6f6e113dccd..1931f5a6d5f 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -145,7 +145,7 @@ GHOST_WindowWin32::GHOST_WindowWin32( } if (m_hWnd) { // Store a pointer to this class in the window structure - LONG result = ::SetWindowLong(m_hWnd, GWL_USERDATA, (LONG)this); + LONG result = ::SetWindowLongPtr(m_hWnd, GWL_USERDATA, (LONG)this); // Store the device context m_hDC = ::GetDC(m_hWnd); @@ -292,12 +292,20 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const { RECT rect; - ::GetClientRect(m_hWnd, &rect); - //::GetWindowRect(m_hWnd, &rect); - bounds.m_b = rect.bottom; - bounds.m_l = rect.left; - bounds.m_r = rect.right; - bounds.m_t = rect.top; + ::GetWindowRect(m_hWnd, &rect); + + LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); + if((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) { + bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)-GetSystemMetrics(SM_CYSIZEFRAME)*2; + bounds.m_l = rect.left; + bounds.m_r = rect.right-GetSystemMetrics(SM_CYSIZEFRAME)*2; + bounds.m_t = rect.top; + } else { + bounds.m_b = rect.bottom; + bounds.m_l = rect.left; + bounds.m_r = rect.right; + bounds.m_t = rect.top; + } } @@ -406,11 +414,11 @@ GHOST_TSuccess GHOST_WindowWin32::setState(GHOST_TWindowState state) //Solves redraw problems when switching from fullscreen to normal. wp.showCmd = SW_SHOWMAXIMIZED; - SetWindowLong(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); + SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_OVERLAPPEDWINDOW); break; case GHOST_kWindowStateFullScreen: wp.showCmd = SW_SHOWMAXIMIZED; - SetWindowLong(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE); + SetWindowLongPtr(m_hWnd, GWL_STYLE, WS_POPUP | WS_MAXIMIZE); break; case GHOST_kWindowStateNormal: default: |