[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32590] trunk/blender/intern/ghost/intern/ GHOST_WindowWin32.cpp: Fix [#20277] Bug with Continuous Grab on Windows

Nathan Letwory nathan at letworyinteractive.com
Tue Oct 19 11:38:56 CEST 2010


Revision: 32590
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32590
Author:   jesterking
Date:     2010-10-19 11:38:56 +0200 (Tue, 19 Oct 2010)

Log Message:
-----------
Fix [#20277] Bug with Continuous Grab on Windows
Reported by Alex Glawion

When we have a maximized window we need to take into account
that there are no borders.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2010-10-19 09:28:38 UTC (rev 32589)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2010-10-19 09:38:56 UTC (rev 32590)
@@ -373,15 +373,24 @@
 void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
 {
 	RECT rect;
-
+	GHOST_TWindowState state= this->getState();
 	LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
+	int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
 	::GetWindowRect(m_hWnd, &rect);
 
 	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;
+		if(state==GHOST_kWindowStateMaximized) {
+			// in maximized state we don't have borders on the window
+			bounds.m_b = rect.bottom-GetSystemMetrics(SM_CYCAPTION)- sm_cysizeframe*2;
+			bounds.m_l = rect.left + sm_cysizeframe;
+			bounds.m_r = rect.right - sm_cysizeframe;
+			bounds.m_t = rect.top;
+		} 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 {
 		::GetWindowRect(m_hWnd, &rect);
 		bounds.m_b = rect.bottom;





More information about the Bf-blender-cvs mailing list