[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26508] trunk/blender/intern/ghost/intern/ GHOST_WindowCocoa.mm: Cocoa : fix mouse cursor hang when RMB-dragging in a not frontmost window

Damien Plisson damien.plisson at yahoo.fr
Mon Feb 1 12:20:03 CET 2010


Revision: 26508
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26508
Author:   damien78
Date:     2010-02-01 12:20:01 +0100 (Mon, 01 Feb 2010)

Log Message:
-----------
Cocoa : fix mouse cursor hang when RMB-dragging in a not frontmost window

With continuous grab on, in 2+ window setup, when RMB-dragging an object in a 3D view of a not active (not frontmost) window, mouse cursor was stuck, with no escape.
Cursor grab must be done by the window that is key (able to receive mouse move events).

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-02-01 11:13:55 UTC (rev 26507)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2010-02-01 11:20:01 UTC (rev 26508)
@@ -1100,6 +1100,7 @@
 		//No need to perform grab without warp as it is always on in OS X
 		if(mode != GHOST_kGrabNormal) {
 			GHOST_TInt32 x_old,y_old;
+			NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
 			m_systemCocoa->getCursorPosition(x_old,y_old);
 			screenToClient(x_old, y_old, m_cursorGrabInitPos[0], m_cursorGrabInitPos[1]);
@@ -1110,8 +1111,13 @@
 				setWindowCursorVisibility(false);
 			}
 			
+			//Make window key if it wasn't to get the mouse move events
+			[m_window makeKeyWindow];
+			
 			//Dissociate cursor position even for warp mode, to allow mouse acceleration to work even when warping the cursor
 			err = CGAssociateMouseAndMouseCursorPosition(false) == kCGErrorSuccess ? GHOST_kSuccess : GHOST_kFailure;
+			
+			[pool drain];
 		}
 	}
 	else {





More information about the Bf-blender-cvs mailing list