[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57026] trunk/blender: Live resize on Windows.

Alexander Kuznetsov kuzsasha at gmail.com
Sat May 25 23:59:34 CEST 2013


Revision: 57026
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57026
Author:   alexk
Date:     2013-05-25 21:59:34 +0000 (Sat, 25 May 2013)
Log Message:
-----------
Live resize on Windows. Based on Ton's patch for mac.
Removing old resize stuff. 
Windows has resize lag, which creates black gap with openGL. Still looking to fix it.

Modified Paths:
--------------
    trunk/blender/intern/ghost/CMakeLists.txt
    trunk/blender/intern/ghost/SConscript
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.h
    trunk/blender/source/blender/windowmanager/intern/wm_window.c

Removed Paths:
-------------
    trunk/blender/intern/ghost/intern/GHOST_SizerWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SizerWin32.h

Modified: trunk/blender/intern/ghost/CMakeLists.txt
===================================================================
--- trunk/blender/intern/ghost/CMakeLists.txt	2013-05-25 21:24:09 UTC (rev 57025)
+++ trunk/blender/intern/ghost/CMakeLists.txt	2013-05-25 21:59:34 UTC (rev 57026)
@@ -296,7 +296,6 @@
 		intern/GHOST_SystemPathsWin32.cpp
 		intern/GHOST_WindowWin32.cpp
 		intern/GHOST_DropTargetWin32.cpp
-		intern/GHOST_SizerWin32.cpp
 
 		intern/GHOST_DisplayManagerWin32.h
 		intern/GHOST_DropTargetWin32.h
@@ -304,7 +303,6 @@
 		intern/GHOST_SystemPathsWin32.h
 		intern/GHOST_WindowWin32.h
 		intern/GHOST_TaskbarWin32.h
-		intern/GHOST_SizerWin32.h
 	)
 
 	if(WITH_INPUT_NDOF)

Modified: trunk/blender/intern/ghost/SConscript
===================================================================
--- trunk/blender/intern/ghost/SConscript	2013-05-25 21:24:09 UTC (rev 57025)
+++ trunk/blender/intern/ghost/SConscript	2013-05-25 21:59:34 UTC (rev 57026)
@@ -37,7 +37,7 @@
     sources += env.Glob('intern/*.mm')
 
 
-pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager', 'GHOST_Sizer']
+pf = ['GHOST_DisplayManager', 'GHOST_System', 'GHOST_SystemPaths', 'GHOST_Window', 'GHOST_DropTarget', 'GHOST_NDOFManager']
 defs=['_USE_MATH_DEFINES']
 
 incs = [

Deleted: trunk/blender/intern/ghost/intern/GHOST_SizerWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SizerWin32.cpp	2013-05-25 21:24:09 UTC (rev 57025)
+++ trunk/blender/intern/ghost/intern/GHOST_SizerWin32.cpp	2013-05-25 21:59:34 UTC (rev 57026)
@@ -1,202 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): Alexandr Kuznetsov
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SizerWin32.cpp
- *  \ingroup GHOST
- */
-
-#ifndef __GHOST_SIZERWIN32_CPP__
-#define __GHOST_SIZERWIN32_CPP__
-
-
-#include "GHOST_SizerWin32.h"
-#include <windowsx.h>
-
-#define T_NONE (0)
-#define T_SIZE (1)
-#define T_MOVE (2)
-#define T_MOVESIZE (3)
-
-
-static void RectCopyH(RECT * t, RECT * f)
-{
-	t->left = f->left;
-	t->right = f->right;
-}
-
-static void RectCopyV(RECT * t, RECT * f)
-{
-	t->top = f->top;
-	t->bottom = f->bottom;
-}
-
-static void RectCopy(RECT * t, RECT * f)
-{
-	RectCopyH(t,f);
-	RectCopyV(t,f);
-}
-
-
-GHOST_SizerWin32::GHOST_SizerWin32(void)
-{
-	hortransf = vertransf = 0;
-	minsize[0] = minsize[1] = 0;
-	hwnd = 0;
-}
-
-GHOST_SizerWin32::~GHOST_SizerWin32(void)
-{
-	if(isWinChanges())
-		cancel();
-}
-
-void GHOST_SizerWin32::setMinSize(int minx, int miny)
-{
-	minsize[0] = minx;
-	minsize[1] = miny;
-
-
-}
-
-bool GHOST_SizerWin32::isWinChanges(void)
-{
-	return hortransf||vertransf;
-}
-
-
-void GHOST_SizerWin32::startSizing(unsigned short type)
-{
-	//SetCapture(hwnd);
-	POINT coord;
-
-	switch(type & 0xf)
-	{
-
-	case WMSZ_LEFT:			hortransf = T_MOVESIZE;
-							vertransf = T_NONE; break;
-	case WMSZ_RIGHT:		hortransf = T_SIZE;
-							vertransf = T_NONE; break;		
-	case WMSZ_TOP:			hortransf = T_NONE;
-							vertransf = T_MOVESIZE; break;
-	case WMSZ_TOPLEFT:		hortransf = T_MOVESIZE;
-							vertransf = T_MOVESIZE; break;
-	case WMSZ_TOPRIGHT:		hortransf = T_SIZE;
-							vertransf = T_MOVESIZE; break;
-	case WMSZ_BOTTOM:		hortransf = T_NONE;
-							vertransf = T_SIZE; break;
-	case WMSZ_BOTTOMLEFT:	hortransf = T_MOVESIZE;
-							vertransf = T_SIZE; break;
-	case WMSZ_BOTTOMRIGHT:	hortransf = T_SIZE;
-							vertransf = T_SIZE; break;
-
-	}
-
-
-
-	POINT mp;
-	GetCursorPos(&mp);
-	startpos[0]=mp.x;
-	startpos[1]=mp.y;
-
-	GetWindowRect(hwnd, &initrect);
-	initrect.bottom-=initrect.top;
-	initrect.right-=initrect.left;
-	RectCopy(&goodrect,&initrect);
-
-}
-
-void GHOST_SizerWin32::setHWND(HWND hWnd)
-{
-	this->hwnd = hWnd;
-}
-
-
-void GHOST_SizerWin32::updateWindowSize(void)
-{
-	if(!isWinChanges())
-		return;
-	if(hortransf||vertransf){
-		POINT mp;
-		GetCursorPos(&mp);
-		int hordelta = mp.x-startpos[0];
-		int verdelta = mp.y-startpos[1];
-
-		RECT newrect;
-		RectCopy(&newrect, &initrect);
-
-		switch(hortransf)
-		{
-			case T_SIZE: 
-				newrect.right+=hordelta;
-				break;
-				case T_MOVESIZE:
-				newrect.right-=hordelta;
-				case T_MOVE:
-				newrect.left+=hordelta;
-				break;
-		}
-
-		switch(vertransf)
-		{
-			case T_SIZE: 
-				newrect.bottom+=verdelta;
-				break;
-				case T_MOVESIZE:
-				newrect.bottom-=verdelta;
-				case T_MOVE:
-				newrect.top+=verdelta;
-				break;
-		}
-
-				
-		if(newrect.right<minsize[0])
-			RectCopyH(&newrect,&goodrect);
-		if(newrect.bottom<minsize[1])
-			RectCopyV(&newrect,&goodrect);
-
-	SetWindowPos(hwnd,0,newrect.left, newrect.top, 
-		newrect.right, newrect.bottom,
-		0);
-
-	RectCopy(&goodrect, &newrect);
-
-
-}
-}
-
-void GHOST_SizerWin32::cancel(void)
-{
-	accept();
-	SetWindowPos(hwnd,0,initrect.left, initrect.top, 
-		initrect.right, initrect.bottom, 0);
-}
-
-void GHOST_SizerWin32::accept(void)
-{
-	hortransf=vertransf=0;
-}
-
-
-#endif /* __GHOST_SIZERWIN32_CPP__*/
\ No newline at end of file

Deleted: trunk/blender/intern/ghost/intern/GHOST_SizerWin32.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SizerWin32.h	2013-05-25 21:24:09 UTC (rev 57025)
+++ trunk/blender/intern/ghost/intern/GHOST_SizerWin32.h	2013-05-25 21:59:34 UTC (rev 57026)
@@ -1,63 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) 2013 Blender Foundation.
- * All rights reserved.
- *
- * Contributor(s): Alexandr Kuznetsov
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file ghost/intern/GHOST_SizerWin32.h
- *  \ingroup GHOST
- */
-#ifndef __GHOST_SIZERWIN32_H__
-#define __GHOST_SIZERWIN32_H__
-
-#define _WIN32_WINNT 0x501 // require Windows XP or newer
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-class GHOST_SizerWin32
-{
-	private:
-		HWND hwnd;
-		int startpos[2];
-		int minsize[2];
-		RECT initrect;
-		RECT goodrect;
-		unsigned char hortransf, vertransf;
-
-
-	public:
-		GHOST_SizerWin32(void);
-		~GHOST_SizerWin32(void);
-
-		bool isWinChanges(void);
-		void startSizing(unsigned short type);
-		void updateWindowSize(void);
-
-		void setHWND(HWND hWnd);
-		void setMinSize(int minx, int miny);
-
-		void cancel(void);
-		void accept(void);
-
-	
-};
-
-#endif /*#ifndef __GHOST_SIZERWIN32_H__*/

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2013-05-25 21:24:09 UTC (rev 57025)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp	2013-05-25 21:59:34 UTC (rev 57026)
@@ -984,14 +984,7 @@
 					if (wParam == SC_KEYMENU) 
 					{
 						eventHandled = true;
-					}// else
-						/* XXX Disable for now due to area resizing issue. bug# 34990 */
-					/*if((wParam&0xfff0)==SC_SIZE)
-					{
-						window->registerMouseClickEvent(0);
-						window->m_wsh.startSizing(wParam);
-						eventHandled = true;
-					}*/
+					}
 					break;
 				////////////////////////////////////////////////////////////////////////
 				// Tablet events, processed
@@ -1029,10 +1022,7 @@
 					break;
 				case WM_LBUTTONUP:
 					window->registerMouseClickEvent(1);
-					if(window->m_wsh.isWinChanges())
-						window->m_wsh.accept();
-					else
-						event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft);
+					event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskLeft);
 					break;
 				case WM_MBUTTONUP:
 					window->registerMouseClickEvent(1);
@@ -1052,10 +1042,7 @@
 					}
 					break;
 				case WM_MOUSEMOVE:
-					if(window->m_wsh.isWinChanges())
-						window->m_wsh.updateWindowSize();
-					else
-						event = processCursorEvent(GHOST_kEventCursorMove, window);
+					event = processCursorEvent(GHOST_kEventCursorMove, window);
 					break;
 				case WM_MOUSEWHEEL:
 					/* The WM_MOUSEWHEEL message is sent to the focus window 
@@ -1129,6 +1116,19 @@
 					lResult = ::DefWindowProc(hwnd, msg, wParam, lParam);
 					break;
 				}
+				case WM_ENTERSIZEMOVE:
+					/* The WM_ENTERSIZEMOVE message is sent one time to a window after it enters the moving 
+					 * or sizing modal loop. The window enters the moving or sizing modal loop when the user 
+					 * clicks the window's title bar or sizing border, or when the window passes the 
+					 * WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the 
+					 * message specifies the SC_MOVE or SC_SIZE value. The operation is complete when 
+					 * DefWindowProc returns. 
+					 */
+					window->m_inLiveResize = 1;
+					break;
+				case WM_EXITSIZEMOVE:
+					window->m_inLiveResize = 0;
+					break;
 				case WM_PAINT:
 					/* An application sends the WM_PAINT message when the system or another application 
 					 * makes a request to paint a portion of an application's window. The message is sent
@@ -1136,8 +1136,14 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list