summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMorten Johan Sorvig <morten.sorvig@nokia.com>2011-12-12 10:55:37 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-14 09:27:04 +0100
commit876b2d06f7ef999d5266dba1097ab06b7a035799 (patch)
treeb23466cbc199ff0b47c38dc11b514b7aebde0c41 /src/plugins
parent239df503ba7d6c0d2e458fbe6ece0a549772a6fd (diff)
Cocoa: Use new 10.7 mouse wheel API.
Silence "deprecated" warnings. Use the old API on 10.6. Change-Id: I0cfa3a083108618023b491589a85ddfc268f990b Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index a0a5a2e5cf..82b4e54deb 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -337,9 +337,20 @@ static QTouchDevice *touchDevice = 0;
// It looks like 1/4 degrees per pixel behaves most native.
// (NB: Qt expects the unit for delta to be 8 per degree):
const int pixelsToDegrees = 2; // 8 * 1/4
- deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
- deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
- deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
+
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+ if ([theEvent respondsToSelector:@selector(scrollingDeltaX)]) {
+ deltaX = [theEvent scrollingDeltaX] * pixelsToDegrees;
+ deltaY = [theEvent scrollingDeltaY] * pixelsToDegrees;
+ // scrollingDeltaZ API is missing.
+ } else
+#endif
+ {
+ deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
+ deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
+ deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
+ }
+
} else {
// carbonEventKind == kEventMouseWheelMoved
// Remove acceleration, and use either -120 or 120 as delta: