In pckbd_decode(), do the remapping of "extended" (multibyte) keys
before the elimination of typematic events. This fixes the case where the "extended" prefix was not ignored and affected the next keystroke. (seen with the AltGr key)
This commit is contained in:
parent
8613b8e39d
commit
b458b1c57e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pckbd.c,v 1.18 1999/05/15 15:55:55 drochner Exp $ */
|
/* $NetBSD: pckbd.c,v 1.19 1999/06/04 15:03:43 drochner Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||||
|
@ -376,7 +376,8 @@ pckbd_enable(v, on)
|
||||||
return (res);
|
return (res);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = pckbd_set_xtscancode(sc->id->t_kbctag, sc->id->t_kbcslot);
|
res = pckbd_set_xtscancode(sc->id->t_kbctag,
|
||||||
|
sc->id->t_kbcslot);
|
||||||
if (res)
|
if (res)
|
||||||
return (res);
|
return (res);
|
||||||
|
|
||||||
|
@ -408,6 +409,8 @@ pckbd_decode(id, datain, type, dataout)
|
||||||
u_int *type;
|
u_int *type;
|
||||||
int *dataout;
|
int *dataout;
|
||||||
{
|
{
|
||||||
|
int key;
|
||||||
|
|
||||||
if (datain == KBR_EXTENDED0) {
|
if (datain == KBR_EXTENDED0) {
|
||||||
id->t_extended = 1;
|
id->t_extended = 1;
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -416,31 +419,37 @@ pckbd_decode(id, datain, type, dataout)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process BREAK key (EXT1 1D 45 EXT1 9D C5) map to (unused) code 7F */
|
/* map extended keys to (unused) codes 128-254 */
|
||||||
|
key = (datain & 0x7f) | (id->t_extended ? 0x80 : 0);
|
||||||
|
id->t_extended = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* process BREAK key (EXT1 1D 45 EXT1 9D C5):
|
||||||
|
* map to (unused) code 7F
|
||||||
|
*/
|
||||||
if (id->t_extended1 == 2 && (datain == 0x1d || datain == 0x9d)) {
|
if (id->t_extended1 == 2 && (datain == 0x1d || datain == 0x9d)) {
|
||||||
id->t_extended1 = 1;
|
id->t_extended1 = 1;
|
||||||
return(0);
|
return(0);
|
||||||
} else if (id->t_extended1 == 1 && (datain == 0x45 || datain == 0xc5)) {
|
} else if (id->t_extended1 == 1 &&
|
||||||
|
(datain == 0x45 || datain == 0xc5)) {
|
||||||
id->t_extended1 = 0;
|
id->t_extended1 = 0;
|
||||||
datain = (datain & 0x80) | 0x7f;
|
key = 0x7f;
|
||||||
} else if (id->t_extended1 > 0) {
|
} else if (id->t_extended1 > 0) {
|
||||||
id->t_extended1 = 0;
|
id->t_extended1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Always ignore typematic keys */
|
|
||||||
if (datain == id->t_lastchar)
|
|
||||||
return(0);
|
|
||||||
id->t_lastchar = datain;
|
|
||||||
|
|
||||||
if (datain & 0x80)
|
if (datain & 0x80) {
|
||||||
|
id->t_lastchar = 0;
|
||||||
*type = WSCONS_EVENT_KEY_UP;
|
*type = WSCONS_EVENT_KEY_UP;
|
||||||
else
|
} else {
|
||||||
|
/* Always ignore typematic keys */
|
||||||
|
if (key == id->t_lastchar)
|
||||||
|
return(0);
|
||||||
|
id->t_lastchar = key;
|
||||||
*type = WSCONS_EVENT_KEY_DOWN;
|
*type = WSCONS_EVENT_KEY_DOWN;
|
||||||
|
}
|
||||||
|
|
||||||
/* map extended keys to (unused) codes 128-254 */
|
*dataout = key;
|
||||||
*dataout = (datain & 0x7f) | (id->t_extended ? 0x80 : 0);
|
|
||||||
|
|
||||||
id->t_extended = 0;
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue