kbdfs: mouse button 2 emulation by changing mouse buttonmap when shift is pressed

This commit is contained in:
cinap_lenrek 2011-07-17 18:15:29 +02:00
parent 3ab76015d7
commit 12619cb9a5
2 changed files with 19 additions and 5 deletions

View file

@ -5,7 +5,7 @@ bind /root /mnt/broot
unmount /root
bind -q '#p' /proc
for(i in S f k æ t)
for(i in S f k æ t m)
bind -a '#'^$i /dev >/dev/null >[2=1]
# make variables settable by copying them from #ec

View file

@ -88,6 +88,7 @@ char Eintr[] = "interrupted";
int scanfd;
int ledsfd;
int consfd;
int mctlfd;
int kbdopen;
int consctlopen;
@ -391,10 +392,21 @@ keyproc(void *)
}
rb[0] = 'k';
}
if(rb[0] && kbdopen){
s = utfconv(rb, nb+1);
if(nbsendp(kbdchan, s) <= 0)
free(s);
if(rb[0]){
if(key.r == Kshift && mctlfd >= 0){
if(key.down){
fprint(mctlfd, "buttonmap 132");
} else {
fprint(mctlfd, "swap");
fprint(mctlfd, "swap");
}
}
if(kbdopen){
s = utfconv(rb, nb+1);
if(nbsendp(kbdchan, s) <= 0)
free(s);
}
}
}
}
@ -1259,6 +1271,8 @@ threadmain(int argc, char** argv)
fprint(2, "%s: warning: can't open /dev/scancode: %r\n", argv0);
if((ledsfd = open("/dev/leds", OWRITE)) < 0)
fprint(2, "%s: warning: can't open /dev/leds: %r\n", argv0);
if((mctlfd = open("/dev/mousectl", OWRITE)) < 0)
fprint(2, "%s: warning: can't open /dev/mousectl: %r\n", argv0);
if(*argv)
if((consfd = open(*argv, OREAD)) < 0)