[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13065] branches/blender2.5/blender: * revert my change to windowmanager move/size handling.

Nathan Letwory jesterking at letwory.net
Sun Dec 30 23:52:00 CET 2007


Revision: 13065
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13065
Author:   jesterking
Date:     2007-12-30 23:52:00 +0100 (Sun, 30 Dec 2007)

Log Message:
-----------
* 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.

Modified Paths:
--------------
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2007-12-30 21:10:08 UTC (rev 13064)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2007-12-30 22:52:00 UTC (rev 13065)
@@ -750,8 +750,7 @@
 					 * message without calling DefWindowProc.
 					 */
 					event = processWindowEvent(GHOST_kEventWindowSize, window);
-                    ::ValidateRect(hwnd, NULL);
-                    break;
+					break;
 				case WM_CAPTURECHANGED:
 					window->lostMouseCapture();
 					break;
@@ -775,8 +774,7 @@
 					 * 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 

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp	2007-12-30 21:10:08 UTC (rev 13064)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp	2007-12-30 22:52:00 UTC (rev 13065)
@@ -255,8 +255,8 @@
 {
 	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;

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2007-12-30 21:10:08 UTC (rev 13064)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2007-12-30 22:52:00 UTC (rev 13065)
@@ -145,7 +145,7 @@
 	}
 	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::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 @@
 				//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: 

Modified: branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c	2007-12-30 21:10:08 UTC (rev 13064)
+++ branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c	2007-12-30 22:52:00 UTC (rev 13065)
@@ -368,23 +368,20 @@
 			}
 			case GHOST_kEventWindowSize:
 			case GHOST_kEventWindowMove: {
-				GHOST_RectangleHandle client_rect, window_rect;
+				GHOST_RectangleHandle client_rect;
 				int l, t, r, b, scr_w, scr_h;
                 int wl, wt, wr, wb;
 				
-                window_rect = GHOST_GetWindowBounds(win->ghostwin);
 				client_rect= GHOST_GetClientBounds(win->ghostwin);
 				GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
-                GHOST_GetRectangle(window_rect, &wl, &wt, &wr, &wb);
 				
 				GHOST_DisposeRectangle(client_rect);
-                GHOST_DisposeRectangle(window_rect);
 				
 				wm_get_screensize(&scr_w, &scr_h);
 				win->sizex= r-l;
 				win->sizey= b-t;
-				win->posx= wl;
-				win->posy= scr_h - wt - win->sizey;
+				win->posx= l;
+				win->posy= scr_h - t - win->sizey;
 
 				if(type!=GHOST_kEventWindowSize)
 					printf("win move event pos %d %d size %d %d\n", win->posx, win->posy, win->sizex, win->sizey);





More information about the Bf-blender-cvs mailing list