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>
This commit is contained in:
Shawn Rutledge 2014-07-28 14:56:18 +02:00
parent 9a096cba22
commit b48febd568

View File

@ -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]];