ref: bb4aba830bc467f578a42ac373a82c5d9bd1b610
parent: 3e8764aef1a7d8b9a107b272c3bf83cbf75a01da
author: cinap_lenrek <[email protected]>
date: Wed Dec 25 11:52:55 EST 2013
devmouse: exclude sroll-wheel buttons from differential button handling preventing wheel buttons 4 and 5 fron getting stuck with multiple input devices.
--- a/sys/src/9/port/devmouse.c
+++ b/sys/src/9/port/devmouse.c
@@ -374,7 +374,7 @@
Cmdbuf *cb;
Cmdtab *ct;
char buf[64];
- int b, msec;
+ int b, z, msec;
Mousestate *m;
p = va;
@@ -456,6 +456,11 @@
msec = strtol(p, &p, 0);
if(msec == 0)
msec = TK2MS(MACHP(0)->ticks);
+
+ /* exclude wheel */
+ z = b & (8|16);
+ b ^= z;
+
m = (Mousestate*)c->aux;
m->xy = pt;
m->msec = msec;
@@ -463,6 +468,11 @@
m->buttons ^= b;
mouseinbuttons = (m->buttons & b) | (mouseinbuttons & ~b);
b = mouse.buttons & ~b;
+
+ /* include wheel */
+ b &= ~(8|16);
+ b ^= z;
+
if(buf[0] == 'A')
absmousetrack(pt.x, pt.y, b, msec);
else