summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2011-10-20 16:59:44 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2011-10-21 16:43:06 +1000
commit9be9719d78af035c45ea4b191c21fab0ee54f198 (patch)
tree4d84297cd521b6547db625a3f7bede1fddc0b76b
parentfff28802c2a803525d30cb8cb27c385f3e589f8a (diff)
Only convert I4 tilt bits to rotation for the I4 mouse
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 <killertofu@gmail.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/wcmCommon.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 08b3283..dd98424 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,16 @@ 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);
+ WacomDevicePtr toolpriv = tool->device->private;
+ if (tool && tool->device && IsCursor(toolpriv))
+ {
+ /* 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 */