Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pckbc In pckbd_decode(), do the remapping of "extend...



details:   https://anonhg.NetBSD.org/src/rev/1c62d09e4eee
branches:  trunk
changeset: 473448:1c62d09e4eee
user:      drochner <drochner%NetBSD.org@localhost>
date:      Fri Jun 04 15:03:43 1999 +0000

description:
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)

diffstat:

 sys/dev/pckbc/pckbd.c |  41 +++++++++++++++++++++++++----------------
 1 files changed, 25 insertions(+), 16 deletions(-)

diffs (80 lines):

diff -r 038df6b1ed65 -r 1c62d09e4eee sys/dev/pckbc/pckbd.c
--- a/sys/dev/pckbc/pckbd.c     Fri Jun 04 14:29:38 1999 +0000
+++ b/sys/dev/pckbc/pckbd.c     Fri Jun 04 15:03:43 1999 +0000
@@ -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.
@@ -376,7 +376,8 @@
                        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)
                        return (res);
 
@@ -408,6 +409,8 @@
        u_int *type;
        int *dataout;
 {
+       int key;
+
        if (datain == KBR_EXTENDED0) {
                id->t_extended = 1;
                return(0);
@@ -416,31 +419,37 @@
                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)) {
                id->t_extended1 = 1;
                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;
-               datain = (datain & 0x80) | 0x7f;
+               key = 0x7f;
        } else if (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;
-       else
+       } else {
+               /* Always ignore typematic keys */
+               if (key == id->t_lastchar)
+                       return(0);
+               id->t_lastchar = key;
                *type = WSCONS_EVENT_KEY_DOWN;
+       }
 
-       /* map extended keys to (unused) codes 128-254 */
-       *dataout = (datain & 0x7f) | (id->t_extended ? 0x80 : 0);
-
-       id->t_extended = 0;
+       *dataout = key;
        return(1);
 }
 



Home | Main Index | Thread Index | Old Index