ref: 64a404f009f516860b4af02f68da13b910ebdce9
parent: 1c238283cb531d6024f55b96411c061b80df5258
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Oct 7 02:49:34 EDT 2013
kbdfs: implement keyboard mouse buttons with /dev/mousein
--- a/sys/src/cmd/aux/kbdfs/kbdfs.c
+++ b/sys/src/cmd/aux/kbdfs/kbdfs.c
@@ -93,6 +93,7 @@
int ledsfd;
int consfd;
int mctlfd;
+int msinfd;
int notefd;
int kbdopen;
@@ -354,13 +355,24 @@
{Rune rb[Nscan+1];
Key key;
- int i, nb;
+ int i, nb, mouseb;
char *s;
threadsetname("keyproc");nb = 0;
+ mouseb = 0;
while(recv(keychan, &key) > 0){+ if(msinfd >= 0 && key.r >= Kmouse+1 && key.r <= Kmouse+5){+ i = 1<<(key.r-(Kmouse+1));
+ if(key.down)
+ mouseb |= i;
+ else
+ mouseb &= ~i;
+ fprint(msinfd, "m%11d %11d %11d", 0, 0, mouseb);
+ continue; /* ignored when mapped to mouse button */
+ }
+
rb[0] = 0;
for(i=0; i<nb && rb[i+1] != key.b; i++)
;
@@ -898,7 +910,7 @@
else
goto Badarg;
}else if(*lp == 'M' && ('1' <= lp[1] && lp[1] <= '5'))- r = 0xF900+lp[1]-'0';
+ r = Kmouse+lp[1]-'0';
else if(*lp>='0' && *lp<='9') /* includes 0x... */
r = strtoul(lp, &lp, 0);
else
@@ -1386,6 +1398,7 @@
scanfd = eopen("/dev/scancode", OREAD); ledsfd = eopen("/dev/leds", OWRITE); mctlfd = eopen("/dev/mousectl", OWRITE);+ msinfd = eopen("/dev/mousein", OWRITE);if(*argv)
consfd = eopen(*argv, OREAD);
--
⑨