kbdfs: ignore compose sequence if ctl was pressed

This commit is contained in:
cinap_lenrek 2011-05-28 16:34:14 +00:00
parent 64f14cc6a4
commit 4c93f534ac

View file

@ -441,13 +441,13 @@ nextrune(Channel *ch, Rune *r)
case Kcaps: case Kcaps:
case Knum: case Knum:
case Kshift: case Kshift:
case Kctl:
case Kaltgr: case Kaltgr:
/* ignore these special keys */ /* ignore modifiers */
continue; continue;
case Kctl:
case Kalt: case Kalt:
/* latin escape! */ /* composing escapes */
return 1; return 1;
} }
return 0; return 0;
@ -463,25 +463,40 @@ void
runeproc(void *) runeproc(void *)
{ {
static struct { static struct {
char *ld; /* must be seen before using this conversion */ char *ld; /* must be seen before using this conversion */
char *si; /* options for last input characters */ char *si; /* options for last input characters */
Rune *so; /* the corresponding Rune for each si entry */ Rune *so; /* the corresponding Rune for each si entry */
} tab[] = { } tab[] = {
#include "latin1.h" #include "latin1.h"
}; };
Rune r, rr; Rune r, rr;
int i, j; int i, j;
int ctl;
threadsetname("runeproc"); threadsetname("runeproc");
ctl = 0;
while((i = nextrune(rawchan, &r)) >= 0){ while((i = nextrune(rawchan, &r)) >= 0){
if(i == 0){ if(i == 0){
ctl = 0;
Forward: Forward:
send(runechan, &r); send(runechan, &r);
continue; continue;
} }
/* latin sequence */ if(r == Kctl){
ctl = 1;
continue;
}
/*
* emulators like qemu and vmware use Ctrl+Alt to lock
* keyboard input so dont confuse them for a compose
* sequence.
*/
if(r != Kalt || ctl)
continue;
if(nextrune(rawchan, &r)) if(nextrune(rawchan, &r))
continue; continue;
@ -500,7 +515,7 @@ Forward:
else else
break; break;
} }
if(i == 4 && r > 0) if(i == 4 && r)
goto Forward; goto Forward;
} else { } else {
if(nextrune(rawchan, &rr)) if(nextrune(rawchan, &rr))