From 67410cd644b76354ba17e9541903cdefa84fc85c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 28 Jul 2014 14:14:38 +0200 Subject: 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 --- src/plugins/platforms/windows/qwindowstabletsupport.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/windows/qwindowstabletsupport.cpp') diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 8ceab02311..164fc12743 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -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) { -- cgit v1.2.3