Revert revision 59985, 59986, 60046 and 60067. These were fixes to improve save
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 6 Oct 2013 14:32:53 +0000 (14:32 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Sun, 6 Oct 2013 14:32:53 +0000 (14:32 +0000)
and restore of window setups with multiple monitors, but they are also causing
regressions, in particular issues with Blender overlapping the taskbar and the
user preferences opening wrong. We decided to revert to the old behavior for
the release.

See bug #36707 for the full explanation.

intern/ghost/intern/GHOST_WindowWin32.cpp
source/blender/windowmanager/intern/wm_window.c

index a409f5c357a55fb7fd8949030b8e90fa79b97b32..8290f4ee2050acd9bb488794cd11992f88260ca9 100644 (file)
@@ -176,44 +176,58 @@ GHOST_WindowWin32::GHOST_WindowWin32(
        }
 
        if (state != GHOST_kWindowStateFullScreen) {
-               RECT rect, desktop;
-               int wintype = WS_OVERLAPPEDWINDOW;
+               RECT rect;
+               MONITORINFO monitor;
+               GHOST_TUns32 tw, th; 
 
-               if (m_parentWindowHwnd != 0) {
-                       wintype = WS_CHILD;
-                       /* check against parent window if given */
-                       GetWindowRect((HWND)m_parentWindowHwnd, &rect);
-               }
-               else {
-                       int framex = GetSystemMetrics(SM_CXSIZEFRAME);
-                       int framey = GetSystemMetrics(SM_CYSIZEFRAME);
-                       int caption = GetSystemMetrics(SM_CYCAPTION);
-
-                       /* set up total window rect, taking in account window decorations. */
-                       rect.left = left - framex;
-                       rect.right = rect.left + width + framex*2;
-                       rect.top = top - (caption + framey);
-                       rect.bottom = rect.top + height + (caption + framey * 2);
-               }
+               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
+               GetMonitorInfo(MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST), &monitor);
 
-               /* ask how large virtual screen is */
-               desktop.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
-               desktop.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
-               desktop.right = GetSystemMetrics(SM_CXVIRTUALSCREEN);
-               desktop.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN);
+               th = monitor.rcWork.bottom - monitor.rcWork.top;
+               tw = monitor.rcWork.right - monitor.rcWork.left;
 
-               /* virtual screen (desktop) bound checks */
-               if (rect.left < desktop.left) rect.left = desktop.left;
-               if (rect.top < desktop.top) rect.top = desktop.top;
-               if (rect.bottom > desktop.bottom) rect.bottom = desktop.bottom;
-               if (rect.right > desktop.right) rect.right = desktop.right;
+               if (tw < width)
+               {
+                       width = tw;
+                       left = monitor.rcWork.left;
+               }
+               else if (monitor.rcWork.right < left + (int)width)
+                       left = monitor.rcWork.right - width;
+               else if (left < monitor.rcWork.left)
+                       left = monitor.rcWork.left;
 
-               /* dimension vars to use in window creation */
-               left = rect.left;
-               top = rect.top;
-               width = rect.right - rect.left;
-               height = rect.bottom - rect.top;
+               if (th < height)
+               {
+                       height = th;
+                       top = monitor.rcWork.top;
+               }
+               else if (monitor.rcWork.bottom < top + (int)height)
+                       top = monitor.rcWork.bottom - height;
+               else if (top < monitor.rcWork.top)
+                       top = monitor.rcWork.top;
 
+               int wintype = WS_OVERLAPPEDWINDOW;
+               if (m_parentWindowHwnd != 0)
+               {
+                       wintype = WS_CHILD;
+                       GetWindowRect((HWND)m_parentWindowHwnd, &rect);
+                       left = 0;
+                       top = 0;
+                       width = rect.right - rect.left;
+                       height = rect.bottom - rect.top;
+               }
+               
                wchar_t *title_16 = alloc_utf16_from_8((char *)(const char *)title, 0);
                m_hWnd = ::CreateWindowW(
                    s_windowClassName,          // pointer to registered class name
index 84ffd7ae3a58a8029677934a170959c1682ae930..9e89c17e02400b634601a77b427b41f83d58e4c9 100644 (file)
@@ -131,7 +131,7 @@ static void wm_window_check_position(rcti *rect)
 {
        int width, height, d;
        
-       wm_get_desktopsize(&width, &height);
+       wm_get_screensize(&width, &height);
        
 #if defined(__APPLE__) && !defined(GHOST_COCOA)
        height -= 70;
@@ -359,7 +359,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win)
        if (multisamples == -1)
                multisamples = U.ogl_multisamples;
        
-       wm_get_desktopsize(&scr_w, &scr_h);
+       wm_get_screensize(&scr_w, &scr_h);
        posy = (scr_h - win->posy - win->sizey);
        
        ghostwin = GHOST_CreateWindow(g_system, title,