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>
This commit is contained in:
parent
239df503ba
commit
876b2d06f7
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user