Subtracting two values seems to be a far simpler way of calculating a delta.
This fixes the jumping strip on the I3 devices, at least for the vertical
one. Horizontal one untested for lack of device.

Signed-off-by: Peter Hutterer <[email protected]>
---
tbh, I did not figure out what the old code was supposed to do, but the data
my I3 gives me suggests a range of 0...4096 in bit-wise increments (i.e. 0,
1,2 4, 8, 16, etc.). I guess this is where this code comes from, but since
we only care about value > 0 or < 0, this was a rather roundabout way.

 src/wcmCommon.c |   25 ++-----------------------
 1 files changed, 2 insertions(+), 23 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index bd1a198..8d138af 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -429,18 +429,7 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        /* emulate events for left strip */
        if ( ds->stripx != priv->oldStripX )
        {
-               int temp = 0, n, i;
-               for (i=1; i<14; i++)
-               {
-                       n = 1 << (i-1);
-                       if ( ds->stripx & n )
-                               temp = i;
-                       if ( priv->oldStripX & n )
-                               value = i;
-                       if ( temp & value) break;
-               }
-
-               value -= temp;
+               value = ds->stripx - priv->oldStripX;
 
                fakeButton = (value > 0) ? priv->striplup : priv->stripldn;
                *fakeKey = (value > 0) ? priv->strip_keys[0] : 
priv->strip_keys[1];
@@ -449,18 +438,8 @@ static int getWheelButton(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
        /* emulate events for right strip */
        if ( ds->stripy != priv->oldStripY )
        {
-               int temp = 0, n, i;
-               for (i=1; i<14; i++)
-               {
-                       n = 1 << (i-1);
-                       if ( ds->stripy & n )
-                               temp = i;
-                       if ( priv->oldStripY & n )
-                               value = i;
-                       if ( temp & value) break;
-               }
+               value = ds->stripy - priv->oldStripY;
 
-               value -= temp;
                fakeButton = (value > 0) ? priv->striprup : priv->striprdn;
                *fakeKey = (value > 0) ? priv->strip_keys[2] : 
priv->strip_keys[2];
        }
-- 
1.7.3.4


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to