summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Gerecke <killertofu@gmail.com>2012-10-18 13:06:36 -0700
committerJason Gerecke <killertofu@gmail.com>2012-10-19 17:23:58 -0700
commit637651338015563c6847028870aaa08b293f1ef1 (patch)
treec8ed48893bd967ae730c51f78f43f7a3fa37ed2e
parente81c1400b023be49afc3f62066d21281a1c2bb95 (diff)
downloadxf86-input-wacom-637651338015563c6847028870aaa08b293f1ef1.tar.gz
Correct number of actions reported by sendWheelStripEvent to sendAction
Commit 477a261e has sendWheelStripEvent use the ARRAY_SIZE macro on a pointer. This will not return a proper value, causing the wrong array length to be provided to sendAction. This can lead to only the first few actions assigned to a wheel or strip actually being performed. This patch changes the signature of sendWheelStripEvent to accept an explicit length. https://sourceforge.net/tracker/?func=detail&aid=3577713&group_id=69596&atid=52$ Signed-off-by: Jason Gerecke <killertofu@gmail.com>
-rw-r--r--src/wcmCommon.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 6799108..30b6ead 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -369,16 +369,17 @@ static int getWheelButton(int delta, int action_up, int action_dn)
*
* @param button X button number to send if no action is defined
* @param action Action to send
+ * @param nactions Length of action array
* @param pInfo
* @param first_val
* @param num_vals
* @param valuators
*/
-static void sendWheelStripEvent(unsigned int *action, InputInfoPtr pInfo,
+static void sendWheelStripEvent(unsigned int *action, int nactions, InputInfoPtr pInfo,
int first_val, int num_vals, int *valuators)
{
- sendAction(pInfo, 1, action, ARRAY_SIZE(action), first_val, num_vals, valuators);
- sendAction(pInfo, 0, action, ARRAY_SIZE(action), first_val, num_vals, valuators);
+ sendAction(pInfo, 1, action, nactions, first_val, num_vals, valuators);
+ sendAction(pInfo, 0, action, nactions, first_val, num_vals, valuators);
}
/*****************************************************************************
@@ -400,7 +401,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch strip scroll delta = %d\n", delta);
- sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, num_vals, valuators);
+ sendWheelStripEvent(priv->strip_keys[idx], ARRAY_SIZE(priv->strip_keys[idx]),
+ pInfo, first_val, num_vals, valuators);
}
/* emulate events for right strip */
@@ -409,7 +411,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Right touch strip scroll delta = %d\n", delta);
- sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, num_vals, valuators);
+ sendWheelStripEvent(priv->strip_keys[idx], ARRAY_SIZE(priv->strip_keys[idx]),
+ pInfo, first_val, num_vals, valuators);
}
/* emulate events for relative wheel */
@@ -418,7 +421,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (idx >= 0 && (IsCursor(priv) || IsPad(priv)) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Relative wheel scroll delta = %d\n", delta);
- sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, num_vals, valuators);
+ sendWheelStripEvent(priv->wheel_keys[idx], ARRAY_SIZE(priv->wheel_keys[idx]),
+ pInfo, first_val, num_vals, valuators);
}
/* emulate events for left touch ring */
@@ -427,7 +431,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch wheel scroll delta = %d\n", delta);
- sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, num_vals, valuators);
+ sendWheelStripEvent(priv->wheel_keys[idx], ARRAY_SIZE(priv->wheel_keys[idx]),
+ pInfo, first_val, num_vals, valuators);
}
/* emulate events for right touch ring */
@@ -436,7 +441,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Right touch wheel scroll delta = %d\n", delta);
- sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, num_vals, valuators);
+ sendWheelStripEvent(priv->wheel_keys[idx], ARRAY_SIZE(priv->wheel_keys[idx]),
+ pInfo, first_val, num_vals, valuators);
}
}