From: umbraticus@prosimetrum.com
To: 9front@9front.org
Subject: Re: [9front] nusb/kb mouse handling
Date: Tue, 08 Dec 2020 21:44:00 +1300 [thread overview]
Message-ID: <FB974048B2649E428C3392848A4D06D7@prosimetrum.com> (raw)
In-Reply-To: <3081D214DA81F6DFFBB5552DC58A6020@prosimetrum.com>
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; i<p.ns; *l = *s, i++){
s = &p.s[i];
@@ -785,7 +785,7 @@
if(l == &lasts[nelem(lasts)-1] || !l->valid)
*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;
next prev parent reply other threads:[~2020-12-08 8:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 0:59 umbraticus
2020-12-08 8:44 ` umbraticus [this message]
2020-12-08 11:37 ` umbraticus
2020-12-08 13:50 ` kvik
2020-12-08 21:18 ` umbraticus
2020-12-09 0:14 ` kvik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FB974048B2649E428C3392848A4D06D7@prosimetrum.com \
--to=umbraticus@prosimetrum.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).