[Bf-blender-cvs] [88770be] master: Fix T47393: mouse wheel scroll no longer zooms with mighty mouse on OS X.
Brecht Van Lommel
noreply at git.blender.org
Sat Feb 13 16:08:30 CET 2016
Commit: 88770bed7c1125870f555978bb45ef837b70b9fb
Author: Brecht Van Lommel
Date: Sat Feb 13 13:13:59 2016 +0100
Branches: master
https://developer.blender.org/rB88770bed7c1125870f555978bb45ef837b70b9fb
Fix T47393: mouse wheel scroll no longer zooms with mighty mouse on OS X.
Hopefully this is the last fix, using the method explained here:
https://forums.developer.apple.com/thread/31536
===================================================================
M intern/ghost/intern/GHOST_SystemCocoa.h
M intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index cfddd5b..b142c2f 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -299,6 +299,8 @@ protected:
/** Temporarily ignore momentum scroll events */
bool m_ignoreMomentumScroll;
+ /** Is the scroll wheel event generated by a multitouch trackpad or mouse? */
+ bool m_multiTouchScroll;
};
#endif // __GHOST_SYSTEMCOCOA_H__
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 90f4557..73d5012 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -375,6 +375,7 @@ GHOST_SystemCocoa::GHOST_SystemCocoa()
m_ignoreWindowSizedMessages = false;
m_ignoreMomentumScroll = false;
+ m_multiTouchScroll = false;
}
GHOST_SystemCocoa::~GHOST_SystemCocoa()
@@ -1392,31 +1393,34 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
{
NSEventPhase momentumPhase = NSEventPhaseNone;
NSEventPhase phase = NSEventPhaseNone;
- bool hasMultiTouch = false;
if ([event respondsToSelector:@selector(momentumPhase)])
momentumPhase = [event momentumPhase];
if ([event respondsToSelector:@selector(phase)])
phase = [event phase];
- if ([event respondsToSelector:@selector(hasPreciseScrollingDeltas)])
- hasMultiTouch = [event hasPreciseScrollingDeltas] && [event subtype] != NSMouseEventSubtype;
/* when pressing a key while momentum scrolling continues after
* lifting fingers off the trackpad, the action can unexpectedly
* change from e.g. scrolling to zooming. this works around the
* issue by ignoring momentum scroll after a key press */
- if (momentumPhase)
- {
+ if (momentumPhase) {
if (m_ignoreMomentumScroll)
break;
}
- else
- {
+ else {
m_ignoreMomentumScroll = false;
}
+ /* we assume phases are only set for gestures from trackpad or magic
+ * mouse events. note that using tablet at the same time may not work
+ * since this is a static variable */
+ if (phase == NSEventPhaseBegan)
+ m_multiTouchScroll = true;
+ else if (phase == NSEventPhaseEnded)
+ m_multiTouchScroll = false;
+
/* standard scrollwheel case, if no swiping happened, and no momentum (kinetic scroll) works */
- if (!hasMultiTouch && momentumPhase == NSEventPhaseNone) {
+ if (!m_multiTouchScroll && momentumPhase == NSEventPhaseNone) {
GHOST_TInt32 delta;
double deltaF = [event deltaY];
More information about the Bf-blender-cvs
mailing list