1 /* $NetBSD: kbd_tables.h,v 1.4 1996/12/17 20:46:14 gwr Exp $ */
4 * Copyright (c) 1996 Gordon W. Ross
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * Keyboard translation tables. These tables contain
30 * "Key symbols" (or "keysyms", to use X terminology).
31 * The key symbol space is divided into "classes" where
32 * the high 8 bits determine the symbol class, and the
33 * low 8 bits are interpreted in a way specific to each
34 * class. The simplest class is ASCII, which is defined
35 * as class zero in order to simplify table definition.
37 * For convenience in the driver, all keysyms that
38 * deserve autorepeat are below 0x8000. The driver
39 * uses the following macro to determine if a keysym
40 * should NOT get autorepeat.
42 #define KEYSYM_NOREPEAT(sym) ((sym) & 0x8000)
44 #define KEYSYM_CLASS(sym) ((sym) & 0xFF00)
45 #define KEYSYM_DATA(sym) ((sym) & 0x00FF)
48 * The ACSII class. Low 8 bits are the character.
50 #define KEYSYM_ASCII 0
53 * The "special" class.
54 * We don't expect to receive any of these often,
55 * except for KEYSYM_NOP. All can be ignored,
56 * because HW_ERR, LAYOUT, RESET, are all handled
57 * at a lower layer, before the translation code.
59 #define KEYSYM_SPECIAL 0x8300
60 #define KEYSYM_NOP 0x8300
61 #define KEYSYM_OOPS 0x8301
62 #define KEYSYM_HOLE 0x8302
63 #define KEYSYM_HW_ERR 0x8307 /* kbd sent 0x7e */
64 #define KEYSYM_LAYOUT 0x830e /* kbd sent 0xfe */
65 #define KEYSYM_RESET 0x830f /* kbd sent 0xff */
69 * Floating accents class: (not implemented)
70 * umlaut, circumflex, tilde, cedilla, acute, grave,...
72 #define KEYSYM_ACCENT 0x0400
75 * The string entry class.
76 * The low 4 bits select one of the entries from
77 * the string table. (see kbd_stringtab[])
78 * By default, the string table has ANSI movement
79 * sequences for the arrow keys.
81 #define KEYSYM_STRING 0x0500
84 * Function keys (compatible with SunOS 4.1)
85 * L:left, R:right, F:func(top), N:numeric
87 #define KEYSYM_FUNC 0x0600
88 #define KEYSYM_FUNC_L(x) (KEYSYM_FUNC | ((x) - 1))
89 #define KEYSYM_FUNC_R(x) (KEYSYM_FUNC | ((x) - 1 + 0x10))
90 #define KEYSYM_FUNC_F(x) (KEYSYM_FUNC | ((x) - 1 + 0x20))
91 #define KEYSYM_FUNC_N(x) (KEYSYM_FUNC | ((x) - 1 + 0x30))
94 * Modifier symbols, to set/clear/toggle a modifier
95 * The low 5 bits define the position of a modifier
96 * bit to be cleared, set, or inverted. The meanings
97 * of the modifier bit positions are defined below.
99 #define KEYSYM_CLRMOD 0x9000
100 #define KEYSYM_SETMOD 0x9100
101 #define KEYSYM_INVMOD 0x9200
102 #define KEYSYM_ALL_UP 0x9300
106 * (logical OR with {CLR,SET,TOG}MOD above)
108 #define KBMOD_CTRL_L 0
109 #define KBMOD_CTRL_R 1
110 #define KBMOD_SHIFT_L 2
111 #define KBMOD_SHIFT_R 3
112 #define KBMOD_META_L 4
113 #define KBMOD_META_R 5
114 #define KBMOD_ALT_L 6
115 #define KBMOD_ALT_R 7
116 /* Note 0-15 are cleared by ALL_UP */
117 #define KBMOD_CAPSLOCK 16
118 #define KBMOD_NUMLOCK 17
120 #define KBMOD_ALTGRAPH KBMOD_ALT_R
125 #define KEYMAP_SIZE 128
128 u_short
*k_release
; /* Key released */
129 u_short
*k_control
; /* Ctrl is down */
130 u_short
*k_normal
; /* No shifts */
131 u_short
*k_shifted
; /* Shift is down */
134 extern char kbd_stringtab
[16][10];
135 extern unsigned short kbd_numlock_map
[64];
137 extern struct keyboard
* keyboards
[];
138 extern int kbd_max_type
;
139 #define KBD_MIN_TYPE 2