|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
24:
25: /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
26: *
27: * ev_keymap.h
28: * Defines the structure used for parsing keymappings. These structures
29: * and definitions are used by event sources in the kernel and by
30: * applications and utilities which manipulate keymaps.
31: *
32: * HISTORY
33: * 02-Jun-1992 Mike Paquette at NeXT
34: * Created.
35: */
36: #import <bsd/dev/ev_types.h> /* Kernel keymap, keyboard info */
37:
38: #define NX_NUMKEYCODES 128 /* Highest key code is 0x7f */
39: #define NX_NUMSEQUENCES 128 /* Maximum possible number of sequences */
40: #define NX_NUMMODIFIERS 16 /* Maximum number of modifier bits */
41: #define NX_BYTE_CODES 0 /* If first short 0, all are bytes (else shorts) */
42:
43: #define NX_WHICHMODMASK 0x0f /* bits out of keyBits for bucky bits */
44: #define NX_MODMASK 0x10 /* Bit out of keyBits indicates modifier bit */
45: #define NX_CHARGENMASK 0x20 /* bit out of keyBits for char gen */
46: #define NX_SPECIALKEYMASK 0x40 /* bit out of keyBits for specialty key */
47: #define NX_KEYSTATEMASK 0x80 /* OBSOLETE - DO NOT USE IN NEW DESIGNS */
48:
49: /*
50: * Special keys currently known to and understood by the system.
51: * If new specialty keys are invented, extend this list as appropriate.
52: * The presence of these keys in a particular implementation is not
53: * guaranteed.
54: */
55: #define NX_NOSPECIALKEY 0xFFFF
56: #define NX_KEYTYPE_SOUND_UP 0 /* Processed by kernel */
57: #define NX_KEYTYPE_SOUND_DOWN 1 /* Processed by kernel */
58: #define NX_KEYTYPE_BRIGHTNESS_UP 2 /* Processed by kernel */
59: #define NX_KEYTYPE_BRIGHTNESS_DOWN 3 /* Processed by kernel */
60: #define NX_KEYTYPE_CAPS_LOCK 4 /* Processed by kernel */
61: #define NX_KEYTYPE_HELP 5
62: #define NX_POWER_KEY 6
63: #define NX_UP_ARROW_KEY 7
64: #define NX_DOWN_ARROW_KEY 8
65: #define NX_NUMSPECIALKEYS 9 /* Maximum number of special keys */
66: // on the 68k, the power key is handled specially... we don't want it scanned
67: #ifdef m68k
68: #define NX_NUM_SCANNED_SPECIALKEYS 5 /* First 5 special keys are */
69: /* actively scanned in kernel */
70: #else
71: #define NX_NUM_SCANNED_SPECIALKEYS 7 /* First 7 special keys are */
72: /* actively scanned in kernel */
73: #endif
74:
75: /* Modifier key indices into modDefs[] */
76: #define NX_MODIFIERKEY_ALPHALOCK 0
77: #define NX_MODIFIERKEY_SHIFT 1
78: #define NX_MODIFIERKEY_CONTROL 2
79: #define NX_MODIFIERKEY_ALTERNATE 3
80: #define NX_MODIFIERKEY_COMMAND 4
81: #define NX_MODIFIERKEY_NUMERICPAD 5
82: #define NX_MODIFIERKEY_HELP 6
83:
84: typedef struct _NXParsedKeyMapping_ {
85: /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
86: short shorts;
87:
88: /*
89: * For each keycode, low order bit says if the key
90: * generates characters.
91: * High order bit says if the key is assigned to a modifier bit.
92: * The second to low order bit gives the current state of the key.
93: */
94: char keyBits[NX_NUMKEYCODES];
95:
96: /* Bit number of highest numbered modifier bit */
97: int maxMod;
98:
99: /* Pointers to where the list of keys for each modifiers bit begins,
100: * or NULL.
101: */
102: unsigned char *modDefs[NX_NUMMODIFIERS];
103:
104: /* Key code of highest key deinfed to generate characters */
105: int numDefs;
106:
107: /* Pointer into the keyMapping where this key's definitions begin */
108: unsigned char *keyDefs[NX_NUMKEYCODES];
109:
110: /* number of sequence definitions */
111: int numSeqs;
112:
113: /* pointers to sequences */
114: unsigned char *seqDefs[NX_NUMSEQUENCES];
115:
116: /* Special key definitions */
117: int numSpecialKeys;
118:
119: /* Special key values, or 0xFFFF if none */
120: unsigned short specialKeys[NX_NUMSPECIALKEYS];
121:
122: /* Pointer to the original keymapping string */
123: unsigned char *mapping;
124:
125: /* Length of the original string */
126: int mappingLen;
127: } NXParsedKeyMapping;
128:
129:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.