Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-10-06 18:32:53 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-10-06 18:32:53 +0400
commit03bb0f5c7214889674ee0662e426608bc6b2acd6 (patch)
tree226454489854b3bcc71c54c9cfb7ae341fb78e39 /intern/ghost
parent31db661e1dfeed299f194c7d3fe39a84d28e38e2 (diff)
Revert revision 59985, 59986, 60046 and 60067. These were fixes to improve save
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.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_WindowWin32.cpp80
1 files changed, 47 insertions, 33 deletions
diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp
index a409f5c357a..8290f4ee205 100644
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@ -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