Commit 2ce1c6b4 fixed a bug where X would crash after remapping
strips or wheels. It made all the "keys" arrays one-indexed so that
wcmUpdateButtonKeys would not write beyond the end of the arrays.

This patch syncs the action lookup code with the use of one-indexed
arrays so that the proper action is returned.

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

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 736a53c..39ae983 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -333,7 +333,7 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        {
                value = ds->relwheel;
                fakeButton = (value > 0) ? priv->relup : priv->reldn;
-               *fakeKey = (value > 0) ? priv->wheel_keys[0] : 
priv->wheel_keys[1];
+               *fakeKey = (value > 0) ? priv->wheel_keys[0+1] : 
priv->wheel_keys[1+1];
        }
 
        /* emulate events for absolute wheel when it is a touch ring (on pad) */
@@ -358,7 +358,7 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
                        value = wrap_delta;
 
                fakeButton = (value > 0) ? priv->wheelup : priv->wheeldn;
-               *fakeKey = (value > 0) ? priv->wheel_keys[2] : 
priv->wheel_keys[3];
+               *fakeKey = (value > 0) ? priv->wheel_keys[2+1] : 
priv->wheel_keys[3+1];
        }
 
        /* emulate events for left strip */
@@ -367,7 +367,7 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
                value = ds->stripx - priv->oldStripX;
 
                fakeButton = (value > 0) ? priv->striplup : priv->stripldn;
-               *fakeKey = (value > 0) ? priv->strip_keys[0] : 
priv->strip_keys[1];
+               *fakeKey = (value > 0) ? priv->strip_keys[0+1] : 
priv->strip_keys[1+1];
        }
 
        /* emulate events for right strip */
@@ -376,7 +376,7 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
                value = ds->stripy - priv->oldStripY;
 
                fakeButton = (value > 0) ? priv->striprup : priv->striprdn;
-               *fakeKey = (value > 0) ? priv->strip_keys[2] : 
priv->strip_keys[3];
+               *fakeKey = (value > 0) ? priv->strip_keys[2+1] : 
priv->strip_keys[3+1];
        }
 
        DBG(10, priv, "send fakeButton %x with value = %d \n",
-- 
1.7.4.1


------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to