[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53376] trunk/blender/intern/ghost/intern: Reversion of previous fix for Mac OS X scrollwheel,

Ton Roosendaal ton at blender.org
Fri Dec 28 17:11:07 CET 2012


Revision: 53376
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53376
Author:   ton
Date:     2012-12-28 16:11:04 +0000 (Fri, 28 Dec 2012)
Log Message:
-----------
Reversion of previous fix for Mac OS X scrollwheel,
it appears I used 10.7+ options, fails for 10.6.

Back to drawing board!

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2012-12-28 14:46:43 UTC (rev 53375)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2012-12-28 16:11:04 UTC (rev 53376)
@@ -293,6 +293,9 @@
 	 */
 	GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y;
 	
+	/** Multitouch trackpad availability */
+	bool m_hasMultiTouchTrackpad;
+	
 };
 
 #endif // __GHOST_SYSTEMCOCOA_H__

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2012-12-28 14:46:43 UTC (rev 53375)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2012-12-28 16:11:04 UTC (rev 53376)
@@ -548,6 +548,7 @@
 	int mib[2];
 	struct timeval boottime;
 	size_t len;
+	char *rstring = NULL;
 	
 	m_modifierMask =0;
 	m_cursorDelta_x=0;
@@ -565,7 +566,25 @@
 	
 	sysctl(mib, 2, &boottime, &len, NULL, 0);
 	m_start_time = ((boottime.tv_sec*1000)+(boottime.tv_usec/1000));
-		
+	
+	//Detect multitouch trackpad
+	mib[0] = CTL_HW;
+	mib[1] = HW_MODEL;
+	sysctl( mib, 2, NULL, &len, NULL, 0 );
+	rstring = (char*)malloc( len );
+	sysctl( mib, 2, rstring, &len, NULL, 0 );
+	
+	//Hack on MacBook revision, as multitouch avail. function missing
+	//MacbookAir or MacBook version >= 5 (retina is MacBookPro10,1)
+	if (strstr(rstring,"MacBookAir") ||
+		(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-3]>='5') && (rstring[strlen(rstring)-3]<='9')) ||
+		(strstr(rstring,"MacBook") && (rstring[strlen(rstring)-4]>='1') && (rstring[strlen(rstring)-4]<='9')))
+		m_hasMultiTouchTrackpad = true;
+	else m_hasMultiTouchTrackpad = false;
+	
+	free( rstring );
+	rstring = NULL;
+	
 	m_ignoreWindowSizedMessages = false;
 }
 
@@ -1560,9 +1579,7 @@
 			
 		case NSScrollWheel:
 			{
-				
-				/* proper detection of trackpad or mouse scrollwheel */
-				if ([event momentumPhase] == NSEventPhaseNone && [event phase] == NSEventPhaseNone) {
+				if (!m_hasMultiTouchTrackpad) {
 					GHOST_TInt32 delta;
 					
 					double deltaF = [event deltaY];




More information about the Bf-blender-cvs mailing list