|
|
1.1 root 1: /*
2: * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
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.
11: *
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
18: * under the License.
19: *
20: * @APPLE_LICENSE_HEADER_END@
21: */
22: /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
23: *
24: * ev_keymap.h
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.
28: *
29: * HISTORY
30: * 02-Jun-1992 Mike Paquette at NeXT
31: * Created.
32: */
33:
34: #ifndef _DEV_EV_KEYMAP_H
35: #define _DEV_EV_KEYMAP_H
36:
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) */
41:
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 */
47:
48: /*
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
52: * guaranteed.
53: */
54: #define NX_NOSPECIALKEY 0xFFFF
55: #define NX_KEYTYPE_SOUND_UP 0 /* Processed by kernel */
56: #define NX_KEYTYPE_SOUND_DOWN 1 /* Processed by kernel */
57: #define NX_KEYTYPE_BRIGHTNESS_UP 2 /* Processed by kernel */
58: #define NX_KEYTYPE_BRIGHTNESS_DOWN 3 /* Processed by kernel */
59: #define NX_KEYTYPE_CAPS_LOCK 4 /* Processed by kernel */
60: #define NX_KEYTYPE_HELP 5
61: #define NX_POWER_KEY 6
62: #define NX_KEYTYPE_MUTE 7 /* Processed by kernel */
63: #define NX_UP_ARROW_KEY 8 /* Processed by kernel */
64: #define NX_DOWN_ARROW_KEY 9
65: #define NX_NUMSPECIALKEYS 10 /* Maximum number of special keys */
66: #define NX_NUM_SCANNED_SPECIALKEYS 8 /* First 8 special keys are */
67: /* actively scanned in kernel */
68:
69: /* Modifier key indices into modDefs[] */
70: #define NX_MODIFIERKEY_ALPHALOCK 0
71: #define NX_MODIFIERKEY_SHIFT 1
72: #define NX_MODIFIERKEY_CONTROL 2
73: #define NX_MODIFIERKEY_ALTERNATE 3
74: #define NX_MODIFIERKEY_COMMAND 4
75: #define NX_MODIFIERKEY_NUMERICPAD 5
76: #define NX_MODIFIERKEY_HELP 6
77:
78: typedef struct _NXParsedKeyMapping_ {
79: /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
80: short shorts;
81:
82: /*
83: * For each keycode, low order bit says if the key
84: * generates characters.
85: * High order bit says if the key is assigned to a modifier bit.
86: * The second to low order bit gives the current state of the key.
87: */
88: char keyBits[NX_NUMKEYCODES];
89:
90: /* Bit number of highest numbered modifier bit */
91: int maxMod;
92:
93: /* Pointers to where the list of keys for each modifiers bit begins,
94: * or NULL.
95: */
96: unsigned char *modDefs[NX_NUMMODIFIERS];
97:
98: /* Key code of highest key deinfed to generate characters */
99: int numDefs;
100:
101: /* Pointer into the keyMapping where this key's definitions begin */
102: unsigned char *keyDefs[NX_NUMKEYCODES];
103:
104: /* number of sequence definitions */
105: int numSeqs;
106:
107: /* pointers to sequences */
108: unsigned char *seqDefs[NX_NUMSEQUENCES];
109:
110: /* Special key definitions */
111: int numSpecialKeys;
112:
113: /* Special key values, or 0xFFFF if none */
114: unsigned short specialKeys[NX_NUMSPECIALKEYS];
115:
116: /* Pointer to the original keymapping string */
117: const unsigned char *mapping;
118:
119: /* Length of the original string */
120: int mappingLen;
121: } NXParsedKeyMapping;
122:
123: #endif /* !_DEV_EV_KEYMAP_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.