Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h3
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm25
2 files changed, 24 insertions, 4 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 8598bd0862f..a1b372dac9a 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -293,6 +293,9 @@ protected:
*/
GHOST_TInt32 m_cursorDelta_x, m_cursorDelta_y;
+ /** Multitouch trackpad availability */
+ bool m_hasMultiTouchTrackpad;
+
};
#endif // __GHOST_SYSTEMCOCOA_H__
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 742bf944946..39fd038d568 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -548,6 +548,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
int mib[2];
struct timeval boottime;
size_t len;
+ char *rstring = NULL;
m_modifierMask =0;
m_cursorDelta_x=0;
@@ -565,7 +566,25 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
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 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
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];