nusb/kb: *really* only send to mousein when mouse state actually changes (zero detlas, same buttons)
This commit is contained in:
parent
2012ba4d03
commit
bfe852b3a2
1 changed files with 6 additions and 1 deletions
|
@ -459,7 +459,7 @@ ptrwork(void* a)
|
|||
{
|
||||
char err[ERRMAX];
|
||||
char mbuf[80];
|
||||
int c, b, nerrs;
|
||||
int c, b, nerrs, lastb;
|
||||
KDev* f = a;
|
||||
Ptr p;
|
||||
|
||||
|
@ -467,6 +467,7 @@ ptrwork(void* a)
|
|||
sethipri();
|
||||
|
||||
memset(&p, 0, sizeof(p));
|
||||
lastb = 0;
|
||||
|
||||
nerrs = 0;
|
||||
for(;;){
|
||||
|
@ -508,6 +509,10 @@ ptrwork(void* a)
|
|||
if(p.z != 0)
|
||||
b |= (p.z > 0) ? 8 : 16;
|
||||
|
||||
if(p.x == 0 && p.y == 0 && p.z == 0 && b == lastb)
|
||||
continue;
|
||||
lastb = b;
|
||||
|
||||
seprint(mbuf, mbuf+sizeof(mbuf), "m%11d %11d %11d", p.x, p.y, b);
|
||||
if(write(f->infd, mbuf, strlen(mbuf)) < 0)
|
||||
kbfatal(f, "mousein i/o");
|
||||
|
|
Loading…
Reference in a new issue