On Thu, Jan 06, 2011 at 10:55:21AM -0800, Ping Cheng wrote:
> On Wed, Jan 5, 2011 at 11:00 PM, Peter Hutterer
> <[email protected]> wrote:
> > 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.
> 
> The idea was to get the actual scales a finger has moved over so we
> can speed up/slow down the corresponding events. Since we are not
> posting the event that way, it is fine to only check the difference.

does the strip have the resolution to make this worthwhile? I can only get a
few values on something that's hardly larger than my finger, so having
multiple scroll events depending on the finger speed seems a bit dangerous.
 
> >  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];
> 
> As you've touched in the commit comments, value = 0 should not post an
> event. We need to update the above two lines accordingly.

All three (the scroll ring as well as the two strips) are guarded by
conditions like this:
    if ( ds->stripy != priv->oldStripY )

so it's mathematically difficult to get a value of 0 :)

Cheers,
  Peter

------------------------------------------------------------------------------
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