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