[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13058] branches/blender2.5/blender: Windowmanager, ghost side:

Ton Roosendaal ton at blender.org
Sun Dec 30 14:30:31 CET 2007


Revision: 13058
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13058
Author:   ton
Date:     2007-12-30 14:30:31 +0100 (Sun, 30 Dec 2007)

Log Message:
-----------
Windowmanager, ghost side:

- Added GHOST_kEventWindowMove event, for sending event that the
  window has moved
- Fixed GHOST_GetClientBounds() for OSX (get window rect)

Todos:
- add same event for X11 and Windows
- solve why ghost doesn't call client event-proc while scaling window
  (at least, not in osx)

Modified Paths:
--------------
    branches/blender2.5/blender/intern/ghost/GHOST_Types.h
    branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c

Modified: branches/blender2.5/blender/intern/ghost/GHOST_Types.h
===================================================================
--- branches/blender2.5/blender/intern/ghost/GHOST_Types.h	2007-12-30 12:08:28 UTC (rev 13057)
+++ branches/blender2.5/blender/intern/ghost/GHOST_Types.h	2007-12-30 13:30:31 UTC (rev 13058)
@@ -144,6 +144,7 @@
 	GHOST_kEventWindowDeactivate,
 	GHOST_kEventWindowUpdate,
 	GHOST_kEventWindowSize,
+	GHOST_kEventWindowMove,
 
 	GHOST_kNumEventTypes
 } GHOST_TEventType;

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2007-12-30 12:08:28 UTC (rev 13057)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2007-12-30 13:30:31 UTC (rev 13058)
@@ -936,10 +936,16 @@
 			 * events. By setting m_ignoreWindowSizedMessages these are suppressed.
 			 * @see GHOST_SystemCarbon::handleWindowEvent(EventRef event)
 			 */
+			/* even worse: scale window also generates a load of events, and nothing 
+			   is handled (read: client's event proc called) until you release mouse (ton) */
+			
 			GHOST_ASSERT(validWindow(ghostWindow), "GHOST_SystemCarbon::handleMouseDown: invalid window");
 			m_ignoreWindowSizedMessages = true;
 			::DragWindow(window, mousePos, &GetQDGlobalsScreenBits(&screenBits)->bounds);
 			m_ignoreWindowSizedMessages = false;
+			
+			pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowMove, ghostWindow) );
+
 			break;
 		
 		case inContent:

Modified: branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp
===================================================================
--- branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp	2007-12-30 12:08:28 UTC (rev 13057)
+++ branches/blender2.5/blender/intern/ghost/intern/GHOST_WindowCarbon.cpp	2007-12-30 13:30:31 UTC (rev 13058)
@@ -255,7 +255,9 @@
 {
 	Rect rect;
 	GHOST_ASSERT(getValid(), "GHOST_WindowCarbon::getClientBounds(): window invalid")
-	::GetPortBounds(m_grafPtr, &rect);
+//	::GetPortBounds(m_grafPtr, &rect);
+	::GetWindowBounds(m_windowRef, kWindowContentRgn, &rect);
+
 	bounds.m_b = rect.bottom;
 	bounds.m_l = rect.left;
 	bounds.m_r = rect.right;

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 12:08:28 UTC (rev 13057)
+++ branches/blender2.5/blender/source/blender/windowmanager/intern/wm_window.c	2007-12-30 13:30:31 UTC (rev 13058)
@@ -369,12 +369,12 @@
 //				window_handle(win, REDRAW, 1);
 				break;
 			}
-			case GHOST_kEventWindowSize: {
+			case GHOST_kEventWindowSize:
+			case GHOST_kEventWindowMove: {
 				GHOST_RectangleHandle client_rect;
 				int l, t, r, b, scr_w, scr_h;
 				
-				/* was GetClientBounds, doesnt work (at least osx) */
-				client_rect= GHOST_GetWindowBounds(win->ghostwin);
+				client_rect= GHOST_GetClientBounds(win->ghostwin);
 				GHOST_GetRectangle(client_rect, &l, &t, &r, &b);
 				
 				GHOST_DisposeRectangle(client_rect);
@@ -384,9 +384,9 @@
 				win->sizey= b-t;
 				win->posx= l;
 				win->posy= scr_h - t - win->sizey;
-#ifdef __APPLE__
-				win->posy-= 24;	/* gutter... see ghost, bad stuff */
-#endif
+
+				if(type!=GHOST_kEventWindowSize)
+					printf("win move event pos %d %d size %d %d\n", win->posx, win->posy, win->sizex, win->sizey);
 				
 //				window_handle(win, RESHAPE, 1);
 				break;





More information about the Bf-blender-cvs mailing list