From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16284 invoked from network); 8 Dec 2020 08:44:31 -0000 Received: from ewsd.inri.net (107.191.116.128) by inbox.vuxu.org with ESMTPUTF8; 8 Dec 2020 08:44:31 -0000 Received: from asquith.prosimetrum.com ([125.236.209.157]) by ewsd; Tue Dec 8 03:43:08 -0500 2020 Message-ID: Date: Tue, 08 Dec 2020 21:44:00 +1300 From: umbraticus@prosimetrum.com To: 9front@9front.org In-Reply-To: <3081D214DA81F6DFFBB5552DC58A6020@prosimetrum.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: virtualized transactional strategy firewall AJAX metadata-scale strategy-aware event-scale frontend Subject: Re: [9front] nusb/kb mouse handling Reply-To: 9front@9front.org Precedence: bulk Sorry, a little tweak: if(!bpress) b = lastb & 7; Otherwise if I move the pointer too soon after the scroll wheel it thinks the scroll button is still held down and turbo-scrolling™ gets way out of control… umbraticus diff -r 7a249c0196e5 sys/src/cmd/nusb/kb/kb.c --- a/sys/src/cmd/nusb/kb/kb.c Mon Dec 07 18:59:54 2020 +0100 +++ b/sys/src/cmd/nusb/kb/kb.c Tue Dec 08 21:21:03 2020 +1300 @@ -637,7 +637,7 @@ s->h = v; break; - case 0x0D0051: /* Conteact identifier */ + case 0x0D0051: /* Contact identifier */ s->id = v; break; @@ -684,7 +684,7 @@ { char err[ERRMAX], mbuf[80]; uchar lastk[64], uk, dk; - int i, c, nerrs, lastb, nlastk; + int i, c, nerrs, bpress, lastb, nlastk; int abs, x, y, z, b; Hidreport p; Hidslot lasts[nelem(p.s)], *s, *l; @@ -774,7 +774,7 @@ continue; /* combine all the slots */ - abs = x = y = z = b = 0; + bpress = abs = x = y = z = b = 0; for(i=0; ivalid) *l = *s; - /* convet absolute z to relative */ + /* convert absolute z to relative */ z += s->z; if(s->abs & 4) z -= l->z; @@ -803,11 +803,8 @@ } /* map to mouse buttons */ - b |= s->b & 1; - if(s->b & (4|8)) - b |= 2; - if(s->b & 2) - b |= 4; + bpress |= s->m; + b |= s->b & ~6 | (s->b & 2) << 1 | (s->b & 4) >> 1; /* X/Y are absolute? */ if((s->abs & 3) == 3){ @@ -826,6 +823,7 @@ } } + if(!bpress) b = lastb & 7; if(z != 0) b |= z > 0 ? 8 : 16;