From 75f155be33dcae185e995e7baa6c18b680233fdc Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Wed, 26 Jan 2011 12:19:19 +0000 Subject: Apply multimonitor fix part of patch [#25612] Submitted by Alexander Kuznetsov Fixes [#23630] Negative OS screen coords not stored/used Reported by Mort (mnme) --- intern/ghost/intern/GHOST_WindowWin32.cpp | 32 ++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 3512f9c4aeb..36f5c5d1fba 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -141,31 +141,45 @@ GHOST_WindowWin32::GHOST_WindowWin32( { if (state != GHOST_kWindowStateFullScreen) { RECT rect; + MONITORINFO monitor; GHOST_TUns32 tw, th; width += GetSystemMetrics(SM_CXSIZEFRAME)*2; height += GetSystemMetrics(SM_CYSIZEFRAME)*2 + GetSystemMetrics(SM_CYCAPTION); + rect.left = left; + rect.right = left + width; + rect.top = top; + rect.bottom = top + height; + + monitor.cbSize=sizeof(monitor); + monitor.dwFlags=0; + // take taskbar into account - SystemParametersInfo(SPI_GETWORKAREA,0,&rect,0); - th = rect.bottom - rect.top; - tw = rect.right - rect.left; + GetMonitorInfo(MonitorFromRect(&rect,MONITOR_DEFAULTTONEAREST),&monitor); + + th = monitor.rcWork.bottom - monitor.rcWork.top; + tw = monitor.rcWork.right - monitor.rcWork.left; if(tw < width) { width = tw; - left = rect.left; + left = monitor.rcWork.left; } - else if(left < rect.left) - left = rect.left; + else if(monitor.rcWork.right < left + (int)width) + left = monitor.rcWork.right - width; + else if(left < monitor.rcWork.left) + left = monitor.rcWork.left; if(th < height) { height = th; - top = rect.top; + top = monitor.rcWork.top; } - else if(top < rect.top) - top = rect.top; + else if(monitor.rcWork.bottom < top + (int)height) + top = monitor.rcWork.bottom - height; + else if(top < monitor.rcWork.top) + top = monitor.rcWork.top; m_hWnd = ::CreateWindow( s_windowClassName, // pointer to registered class name -- cgit v1.2.3