]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/hidsystem/ev_keymap.h
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
25 * Defines the structure used for parsing keymappings. These structures
26 * and definitions are used by event sources in the kernel and by
27 * applications and utilities which manipulate keymaps.
30 * 02-Jun-1992 Mike Paquette at NeXT
34 #ifndef _DEV_EV_KEYMAP_H
35 #define _DEV_EV_KEYMAP_H
37 #define NX_NUMKEYCODES 128 /* Highest key code is 0x7f */
38 #define NX_NUMSEQUENCES 128 /* Maximum possible number of sequences */
39 #define NX_NUMMODIFIERS 16 /* Maximum number of modifier bits */
40 #define NX_BYTE_CODES 0 /* If first short 0, all are bytes (else shorts) */
42 #define NX_WHICHMODMASK 0x0f /* bits out of keyBits for bucky bits */
43 #define NX_MODMASK 0x10 /* Bit out of keyBits indicates modifier bit */
44 #define NX_CHARGENMASK 0x20 /* bit out of keyBits for char gen */
45 #define NX_SPECIALKEYMASK 0x40 /* bit out of keyBits for specialty key */
46 #define NX_KEYSTATEMASK 0x80 /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
49 * Special keys currently known to and understood by the system.
50 * If new specialty keys are invented, extend this list as appropriate.
51 * The presence of these keys in a particular implementation is not
54 #define NX_NOSPECIALKEY 0xFFFF
55 #define NX_KEYTYPE_SOUND_UP 0
56 #define NX_KEYTYPE_SOUND_DOWN 1
57 #define NX_KEYTYPE_BRIGHTNESS_UP 2
58 #define NX_KEYTYPE_BRIGHTNESS_DOWN 3
59 #define NX_KEYTYPE_CAPS_LOCK 4
60 #define NX_KEYTYPE_HELP 5
61 #define NX_POWER_KEY 6
62 #define NX_KEYTYPE_MUTE 7
63 #define NX_UP_ARROW_KEY 8
64 #define NX_DOWN_ARROW_KEY 9
65 #define NX_KEYTYPE_NUM_LOCK 10
67 #define NX_KEYTYPE_CONTRAST_UP 11
68 #define NX_KEYTYPE_CONTRAST_DOWN 12
69 #define NX_KEYTYPE_LAUNCH_PANEL 13
70 #define NX_KEYTYPE_EJECT 14
72 #define NX_NUMSPECIALKEYS 15 /* Maximum number of special keys */
73 #define NX_NUM_SCANNED_SPECIALKEYS 15 /* First 15 special keys are */
74 /* actively scanned in kernel */
76 /* Mask of special keys that are posted as events */
78 #define NX_SPECIALKEY_POST_MASK \
79 ((1 << NX_KEYTYPE_SOUND_UP) | (1 << NX_KEYTYPE_SOUND_DOWN) | \
80 (1 << NX_POWER_KEY) | (1 << NX_KEYTYPE_MUTE) | \
81 (1 << NX_KEYTYPE_BRIGHTNESS_UP) | (1 << NX_KEYTYPE_BRIGHTNESS_DOWN) | \
82 (1 << NX_KEYTYPE_CONTRAST_UP) | (1 << NX_KEYTYPE_CONTRAST_UP) | \
83 (1 << NX_KEYTYPE_LAUNCH_PANEL) | (1 << NX_KEYTYPE_EJECT) | \
86 /* Modifier key indices into modDefs[] */
87 #define NX_MODIFIERKEY_ALPHALOCK 0
88 #define NX_MODIFIERKEY_SHIFT 1
89 #define NX_MODIFIERKEY_CONTROL 2
90 #define NX_MODIFIERKEY_ALTERNATE 3
91 #define NX_MODIFIERKEY_COMMAND 4
92 #define NX_MODIFIERKEY_NUMERICPAD 5
93 #define NX_MODIFIERKEY_HELP 6
94 #define NX_MODIFIERKEY_SECONDARYFN 7
95 #define NX_MODIFIERKEY_NUMLOCK 8
98 typedef struct _NXParsedKeyMapping_
{
99 /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
103 * For each keycode, low order bit says if the key
104 * generates characters.
105 * High order bit says if the key is assigned to a modifier bit.
106 * The second to low order bit gives the current state of the key.
108 char keyBits
[NX_NUMKEYCODES
];
110 /* Bit number of highest numbered modifier bit */
113 /* Pointers to where the list of keys for each modifiers bit begins,
116 unsigned char *modDefs
[NX_NUMMODIFIERS
];
118 /* Key code of highest key deinfed to generate characters */
121 /* Pointer into the keyMapping where this key's definitions begin */
122 unsigned char *keyDefs
[NX_NUMKEYCODES
];
124 /* number of sequence definitions */
127 /* pointers to sequences */
128 unsigned char *seqDefs
[NX_NUMSEQUENCES
];
130 /* Special key definitions */
133 /* Special key values, or 0xFFFF if none */
134 unsigned short specialKeys
[NX_NUMSPECIALKEYS
];
136 /* Pointer to the original keymapping string */
137 const unsigned char *mapping
;
139 /* Length of the original string */
141 } NXParsedKeyMapping
;
143 #endif /* !_DEV_EV_KEYMAP_H */