Fix for windows size on win32

This commit is contained in:
Alexander Kuznetsov
2013-02-22 15:57:50 +00:00
parent 2c2a42a4e8
commit 7ae17e9ed4

View File

@@ -470,38 +470,22 @@ void GHOST_WindowWin32::getWindowBounds(GHOST_Rect& bounds) const
void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
{ {
RECT rect; RECT rect;
GHOST_TWindowState state = this->getState(); POINT coord;
LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE); ::GetClientRect(m_hWnd, &rect);
int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
::GetWindowRect(m_hWnd, &rect);
if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) { coord.x = rect.left;
if (state == GHOST_kWindowStateMaximized) { coord.y = rect.top;
// in maximized state we don't have borders on the window ::ClientToScreen(m_hWnd, &coord);
bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
bounds.m_l = rect.left + sm_cysizeframe; bounds.m_l = coord.x;
bounds.m_r = rect.right - sm_cysizeframe; bounds.m_t = coord.y;
bounds.m_t = rect.top;
} coord.x = rect.right;
else if (state == GHOST_kWindowStateEmbedded) { coord.y = rect.bottom;
bounds.m_b = rect.bottom; ::ClientToScreen(m_hWnd, &coord);
bounds.m_l = rect.left;
bounds.m_r = rect.right; bounds.m_r = coord.x;
bounds.m_t = rect.top; bounds.m_b = coord.y;
}
else {
bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
bounds.m_l = rect.left;
bounds.m_r = rect.right - 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;
}
} }