[EMAIL PROTECTED] wrote:
> On 9/14/06, *Antoine Labour* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Well, this one is critical. As written before the patch is
>     applied, the
>     WacomFilterState structure is copied before the filtering happens,
>     and
>     never copied back into the WacomChannel structure. Actually in -O2
>     build, a good portion of the code is optimized out (because, in
>     fact, it
>     does nothing).
>
>  
> Ok, I'll aplly this one.
>
>     > or wrong (ABS(dsOrig->rotation - dsNew->rotation) > suppress and
>     (1800
>     > - ABS(dsNew->rotation - dsOrig->rotation)) > suppress can never be
>     > true the same time).  So, I don't see a reason to apply them.
>     Oh, they can be true at the same time. Take for example the case
>     dsOrig->rotation==0, dsNew->rotation==20 (and suppress==10).
>     Actually at
>     least one of them is always true if suppress<900, so as the code is
>     written right now, it always exits at this point (without
>     suppressing).
>     The first condition is for the general case, but gives false positives
>     when close to the origin, that the second condition removes.
>
>  
> What do you think of the following:
>  
> int diff = ABS(dsOrig->rotation - dsNew->rotation) - 900 ?  
> (1800 - ABS(dsNew->rotation - dsOrig->rotation)) : ABS(dsNew->rotation
> - dsOrig->rotation));
>  
> if (diff > suppress) return 0;
>  
> The may reason we have 1800-ABS(...) is to deal with the case that the
> device rotated from a value just less than 899 (greater than -900) to
> an value larger than -900 (or less than 899).  That's why I said both
> were wrong.
>  
> Ping
I don't think the code you suggest will do what you want... maybe you
wanted to write the following :

int diff = ABS(dsOrig->rotation - dsNew->rotation) > 900 ?  
(1800 - ABS(dsNew->rotation - dsOrig->rotation)) : ABS(dsNew->rotation -
dsOrig->rotation));
 if (diff > suppress) return 0;


I believe that will do it, but so will do the original proposition
(unless you allow the suppress value to go over 900).
A sample is no proof, but just to get the idea of why it works. Take
suppress=10.

Simple cases:
- dsOrig->rotation=50, dsNew->rotation=55
ABS(dsOrig->rotation - dsNew->rotation) == 5, so ABS(dsOrig->rotation -
dsNew->rotation) > suppress is false, ignore the event.

- dsOrig->rotation=-75, dsNew->rotation=-90
ABS(dsOrig->rotation - dsNew->rotation) == 15, so ABS(dsOrig->rotation -
dsNew->rotation) > suppress is true.
(1800 - ABS(dsNew->rotation - dsOrig->rotation)) == 1785, so (1800 -
ABS(dsNew->rotation - dsOrig->rotation)) > suppress is true as well.
Don't ignore the event.

"Complex" cases, going over the origin:
- dsOrig->rotation=-897, dsNew->rotation=899
ABS(dsOrig->rotation - dsNew->rotation) == 1796 so ABS(dsOrig->rotation
- dsNew->rotation) > suppress is true.
(1800 - ABS(dsNew->rotation - dsOrig->rotation)) == 4, so 1800 -
ABS(dsNew->rotation - dsOrig->rotation)) > suppress is false, ignore the
event.

- dsOrig->rotation=-890, dsNew->rotation=895
ABS(dsOrig->rotation - dsNew->rotation) == 1785 so ABS(dsOrig->rotation
- dsNew->rotation) > suppress is true.
(1800 - ABS(dsNew->rotation - dsOrig->rotation)) == 15, o 1800 -
ABS(dsNew->rotation - dsOrig->rotation)) > suppress is also true, don't
ignore the event.


Hope that clarifies things...

Antoine

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Linuxwacom-discuss mailing list
Linuxwacom-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-discuss

Reply via email to