ref: 58668339bcdf71112b08ccc120609dbf7be478dd
parent: 678be8399090b9eb90f983b1b4105495893f57f1
author: cinap_lenrek <[email protected]>
date: Wed Mar 20 21:27:28 EDT 2019
nusb/kb: fix continuous scrollwheel delta not being reported (thanks sam-d)
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -761,7 +761,7 @@
continue;
/* combine all the slots */
- abs = x = y = b = 0;
+ abs = x = y = z = b = 0;
for(i=0; i<p.ns; *l = *s, i++){
s = &p.s[i];
@@ -773,7 +773,7 @@
*l = *s;
/* convet absolute z to relative */
- z = s->z;
+ z += s->z;
if(s->abs & 4)
z -= l->z;
@@ -783,10 +783,10 @@
i, s->id, s->b, s->m,
(uint)s->x / 2147483648.0,
(uint)s->y / 2147483648.0,
- z);
+ s->z);
else
fprint(2, "ptr[%d]: id=%x b=%x m=%x x=%d y=%d z=%d\n",
- i, s->id, s->b, s->m, s->x, s->y, z);
+ i, s->id, s->b, s->m, s->x, s->y, s->z);
}
/* map to mouse buttons */
@@ -795,8 +795,6 @@
b |= 2;
if(s->b & 2)
b |= 4;
- if(z != 0)
- b |= z > 0 ? 8 : 16;
/* X/Y are absolute? */
if((s->abs & 3) == 3){
@@ -814,8 +812,11 @@
y += s->y;
}
}
+
+ if(z != 0)
+ b |= z > 0 ? 8 : 16;
- if(abs || x != 0 || y != 0 || b != lastb){
+ if(abs || x != 0 || y != 0 || z != 0 || b != lastb){
lastb = b;
if(f->minfd < 0){