Windows: 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 multiplied by 10;
when turning it clockwise it should have a positive angle up to 180,
whereas the driver sends 360 * 10 going downwards towards 180 * 10.
These corrections make the angle reading the same between Linux and
Windows.

Task-number: QTBUG-39570
Change-Id: I9f18ef6629bffa849c8d65cba02d42b21469cebc
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
bb10
Shawn Rutledge 2014-07-28 14:14:38 +02:00
parent a5578d216a
commit 67410cd644
1 changed files with 3 additions and 1 deletions

View File

@ -465,7 +465,9 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
const double degY = atan(cos(radAzim) / tanAlt);
tiltX = int(degX * (180 / M_PI));
tiltY = int(-degY * (180 / M_PI));
rotation = packet.pkOrientation.orTwist;
rotation = 360.0 - (packet.pkOrientation.orTwist / 10.0);
if (rotation > 180.0)
rotation -= 360.0;
}
if (QWindowsContext::verbose > 1) {