[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53398] trunk/blender/intern/ghost/intern/ GHOST_SystemCocoa.mm: Mac OS X 10.7 supports new trackpad (and mighty mouse ) events with nice seamless
Ton Roosendaal
ton at blender.org
Sat Dec 29 12:00:48 CET 2012
Revision: 53398
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53398
Author: ton
Date: 2012-12-29 11:00:45 +0000 (Sat, 29 Dec 2012)
Log Message:
-----------
Mac OS X 10.7 supports new trackpad (and mighty mouse) events with nice seamless
scrolling and inertia.
Now Blender uses this - if you have 10.7. Otherwise it just falls back on the
old code.
Try it, makes a huge difference :)
Next todo: how to configure this well, so you can have trackpad (or mighty mouse)
zoom as default in 3d views.
Modified Paths:
--------------
trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2012-12-29 10:24:42 UTC (rev 53397)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2012-12-29 11:00:45 UTC (rev 53398)
@@ -1590,7 +1590,7 @@
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
momentum = [event momentumPhase];
#endif
-
+ /* standard scrollwheel case */
if (!m_hasMultiTouchTrackpad && momentum==0) {
GHOST_TInt32 delta;
@@ -1605,9 +1605,18 @@
else {
NSPoint mousePos = [cocoawindow mouseLocationOutsideOfEventStream];
GHOST_TInt32 x, y;
- double dx = [event deltaX];
- double dy = -[event deltaY];
+ double dx;
+ double dy;
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
+ /* with 10.7 nice scrolling deltas are supported */
+ dx = [event scrollingDeltaX];
+ dy = [event scrollingDeltaY];
+
+#else
+ /* trying to pretend you have nice scrolls... */
+ dx = [event deltaX];
+ dy = -[event deltaY];
const double deltaMax = 50.0;
if ((dx == 0) && (dy == 0)) break;
@@ -1624,9 +1633,10 @@
else dy += 0.5;
if (dy < -deltaMax) dy= -deltaMax;
else if (dy > deltaMax) dy= deltaMax;
-
+
+ dy = -dy;
+#endif
window->clientToScreenIntern(mousePos.x, mousePos.y, x, y);
- dy = -dy;
pushEvent(new GHOST_EventTrackpad([event timestamp] * 1000, window, GHOST_kTrackpadEventScroll, x, y, dx, dy));
}
More information about the Bf-blender-cvs
mailing list