The comment claims that the conversion is to be performed for the
I4 mouse only, but doesn't actually check to see if the tool is
indeed a mouse. This patch adds in the necessary check, allowing
the I4 stylus to properly report tilt data.

Signed-off-by: Jason Gerecke <killert...@gmail.com>
---
 src/wcmCommon.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index e4ff7d9..587f351 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -59,6 +59,8 @@ static void commonDispatchDevice(WacomCommonPtr common,
                                 enum WacomSuppressMode suppress);
 static void sendAButton(InputInfoPtr pInfo, int button, int mask,
                        int first_val, int num_vals, int *valuators);
+static WacomToolPtr findTool(const WacomCommonPtr common,
+                            const WacomDeviceState *ds)
 
 /*****************************************************************************
  * Utility functions
@@ -903,11 +905,15 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel,
        if (TabletHasFeature(common, WCM_ROTATION) &&
                TabletHasFeature(common, WCM_RING)) /* I4 */
        {
-               /* convert Intuos4 mouse tilt to rotation */
-               ds.rotation = wcmTilt2R(ds.tiltx, ds.tilty,
-                                       INTUOS4_CURSOR_ROTATION_OFFSET);
-               ds.tiltx = 0;
-               ds.tilty = 0;
+               WacomToolPtr tool = findTool(common, &ds);
+               if (tool && tool->device && 
IsCursor((WacomDevicePtr)tool->device->private))
+               {
+                       /* convert Intuos4 mouse tilt to rotation */
+                       ds.rotation = wcmTilt2R(ds.tiltx, ds.tilty,
+                                               INTUOS4_CURSOR_ROTATION_OFFSET);
+                       ds.tiltx = 0;
+                       ds.tilty = 0;
+               }
        }
 
        /* Optionally filter values only while in proximity */
-- 
1.7.6


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to