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 <killert...@gmail.com>
---
 src/wcmCommon.c | 22 ++++++++++++++--------
 1 file 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);
        }
 }
 
-- 
1.7.12.2


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to