summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-07-28 14:56:18 +0200
committerShawn Rutledge <shawn.rutledge@digia.com>2014-07-31 12:21:19 +0200
commitb48febd568537793405bc103fb0f1eb65ef9ebdc (patch)
tree67ed46ef919830ad37a548c9c3b4d2dace20c478
parent9a096cba223936c81c2c3392265681c78e63617e (diff)
OS X: correct tablet stylus rotation to range -180..180 degrees
When the user holds the Wacom Art Pen straight, rotation is zero; when turning it counter-clockwise, it should have a negative angle, whereas the driver sends a positive angle; when turning it clockwise it should have a positive angle up to 180, whereas the driver sends 360 going downwards towards 180. These corrections make the angle reading consistent between Linux, Windows and OS X. Task-number: QTBUG-39570 Change-Id: I7a57cc1fb56d4f7128ca1add10aff2597f29c507 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index 2b437240df..011a9ba71a 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -1006,7 +1006,9 @@ Q_GLOBAL_STATIC(QCocoaTabletDeviceDataHash, tabletDeviceDataHash)
if (deviceData.capabilityMask & 0x0800)
tangentialPressure = ([theEvent tangentialPressure] * 2.0) - 1.0;
- rotation = [theEvent rotation];
+ rotation = 360.0 - [theEvent rotation];
+ if (rotation > 180.0)
+ rotation -= 360.0;
Qt::KeyboardModifiers keyboardModifiers = [QNSView convertKeyModifiers:[theEvent modifierFlags]];