kbdfs: ignoring fake shifts

This commit is contained in:
cinap_lenrek 2012-02-26 13:43:50 +01:00
parent 612d666d54
commit 11e38d21c8

View file

@ -164,7 +164,7 @@ Rune kbtabesc1[Nscan] =
[0x10] 0, 0, 0, 0, 0, 0, 0, 0,
[0x18] 0, 0, 0, 0, '\n', Kctl, 0, 0,
[0x20] 0, 0, 0, 0, 0, 0, 0, 0,
[0x28] 0, 0, Kshift, 0, 0, 0, 0, 0,
[0x28] 0, 0, 0, 0, 0, 0, 0, 0,
[0x30] 0, 0, 0, 0, 0, '/', 0, Kprint,
[0x38] Kaltgr, 0, 0, 0, 0, 0, 0, 0,
[0x40] 0, 0, 0, 0, 0, 0, Kbreak, Khome,
@ -228,15 +228,18 @@ kbdputsc(Scan *scan, int c)
Key key;
/*
* e0's is the first of a 2 character sequence, e1 the first
* e0's is the first of a 2 character sequence, e1 and e2 the first
* of a 3 character sequence (on the safari)
*/
if(c == 0xe0){
scan->esc1 = 1;
if(scan->esc2){
scan->esc2--;
return;
} else if(c == 0xe1){
} else if(c == 0xe1 || c == 0xe2){
scan->esc2 = 2;
return;
} else if(c == 0xe0){
scan->esc1 = 1;
return;
}
key.down = (c & 0x80) == 0;
@ -268,7 +271,7 @@ kbdputsc(Scan *scan, int c)
break;
}
if(scan->esc1)
if(scan->esc1 || kbtab[c] == 0)
key.b = key.r;
else
key.b = kbtab[c];
@ -279,13 +282,9 @@ kbdputsc(Scan *scan, int c)
if(scan->ctl && scan->alt && key.r == Kdel)
reboot();
if(key.b)
send(keychan, &key);
if(scan->esc1)
scan->esc1 = 0;
else if(scan->esc2)
scan->esc2--;
switch(key.r){
case Kshift:
scan->shift = key.down;
@ -306,6 +305,7 @@ kbdputsc(Scan *scan, int c)
scan->caps ^= key.down;
break;
}
scan->esc1 = 0;
}
void
@ -1155,6 +1155,7 @@ fswrite(Req *r)
*/
for(i=0; i<Nscan; i++){
if((a->shift && kbtabshift[i] == k.r) || (kbtab[i] == k.r)){
if(kbtab[i])
k.b = kbtab[i];
if(a->shift)
k.r = kbtabshift[i];
@ -1165,6 +1166,7 @@ fswrite(Req *r)
break;
}
}
if(k.b)
send(keychan, &k);
if(k.r == Kshift)
a->shift = k.down;