From b48febd568537793405bc103fb0f1eb65ef9ebdc Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 28 Jul 2014 14:56:18 +0200 Subject: 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 --- src/plugins/platforms/cocoa/qnsview.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa') 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]]; -- cgit v1.2.3