Chameleon

Chameleon Svn Source Tree

Root/branches/mozodojo/i386/include/IOKit/hidsystem/ev_keymap.h

1/*
2 * @APPLE_LICENSE_HEADER_START@
3 *
4 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
24 *
25 *ev_keymap.h
26 *Defines the structure used for parsing keymappings. These structures
27 *and definitions are used by event sources in the kernel and by
28 *applications and utilities which manipulate keymaps.
29 *
30 * HISTORY
31 * 02-Jun-1992 Mike Paquette at NeXT
32 * Created.
33 */
34
35#ifndef _DEV_EV_KEYMAP_H
36#define _DEV_EV_KEYMAP_H
37
38#defineNX_NUMKEYCODES256/* Highest key code is 0xff. ADB used to use 0x80 for keydown state, but who the heck uses adb anymore. */
39#define NX_NUMSEQUENCES128/* Maximum possible number of sequences */
40#defineNX_NUMMODIFIERS16/* Maximum number of modifier bits */
41#defineNX_BYTE_CODES0/* If first short 0, all are bytes (else shorts) */
42
43#defineNX_WHICHMODMASK0x0f /* bits out of keyBits for bucky bits */
44#defineNX_MODMASK0x10/* Bit out of keyBits indicates modifier bit */
45#defineNX_CHARGENMASK0x20/* bit out of keyBits for char gen */
46#defineNX_SPECIALKEYMASK 0x40/* bit out of keyBits for specialty key */
47#defineNX_KEYSTATEMASK0x80/* 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_NOSPECIALKEY0xFFFF
56#define NX_KEYTYPE_SOUND_UP0
57#define NX_KEYTYPE_SOUND_DOWN1
58#define NX_KEYTYPE_BRIGHTNESS_UP2
59#define NX_KEYTYPE_BRIGHTNESS_DOWN3
60#define NX_KEYTYPE_CAPS_LOCK4
61#define NX_KEYTYPE_HELP5
62#define NX_POWER_KEY6
63#defineNX_KEYTYPE_MUTE7
64#define NX_UP_ARROW_KEY8
65#define NX_DOWN_ARROW_KEY9
66#define NX_KEYTYPE_NUM_LOCK10
67
68#define NX_KEYTYPE_CONTRAST_UP11
69#define NX_KEYTYPE_CONTRAST_DOWN12
70#define NX_KEYTYPE_LAUNCH_PANEL13
71#define NX_KEYTYPE_EJECT14
72#define NX_KEYTYPE_VIDMIRROR15
73
74#define NX_KEYTYPE_PLAY16
75#define NX_KEYTYPE_NEXT17
76#define NX_KEYTYPE_PREVIOUS18
77#define NX_KEYTYPE_FAST19
78#define NX_KEYTYPE_REWIND20
79
80#define NX_KEYTYPE_ILLUMINATION_UP21
81#define NX_KEYTYPE_ILLUMINATION_DOWN22
82#define NX_KEYTYPE_ILLUMINATION_TOGGLE23
83
84#defineNX_NUMSPECIALKEYS24 /* Maximum number of special keys */
85#define NX_NUM_SCANNED_SPECIALKEYS24 /* First 24 special keys are */
86 /* actively scanned in kernel */
87
88/* Mask of special keys that are posted as events */
89
90#define NX_SPECIALKEY_POST_MASK\
91 ((1 << NX_KEYTYPE_SOUND_UP) | (1 << NX_KEYTYPE_SOUND_DOWN) | \
92 (1 << NX_POWER_KEY) | (1 << NX_KEYTYPE_MUTE) | \
93 (1 << NX_KEYTYPE_BRIGHTNESS_UP) | (1 << NX_KEYTYPE_BRIGHTNESS_DOWN) | \
94 (1 << NX_KEYTYPE_CONTRAST_UP) | (1 << NX_KEYTYPE_CONTRAST_UP) | \
95 (1 << NX_KEYTYPE_LAUNCH_PANEL) | (1 << NX_KEYTYPE_EJECT) | \
96 (1 << NX_KEYTYPE_VIDMIRROR) | (1 << NX_KEYTYPE_PLAY) | \
97 (1 << NX_KEYTYPE_NEXT) | (1 << NX_KEYTYPE_PREVIOUS) | \
98 (1 << NX_KEYTYPE_FAST) | (1 << NX_KEYTYPE_REWIND) | \
99 (1 << NX_KEYTYPE_ILLUMINATION_UP) | \
100 (1 << NX_KEYTYPE_ILLUMINATION_DOWN) | \
101 (1 << NX_KEYTYPE_ILLUMINATION_TOGGLE) | 0)
102
103/* Modifier key indices into modDefs[] */
104#define NX_MODIFIERKEY_ALPHALOCK0
105#define NX_MODIFIERKEY_SHIFT1
106#define NX_MODIFIERKEY_CONTROL2
107#define NX_MODIFIERKEY_ALTERNATE3
108#define NX_MODIFIERKEY_COMMAND4
109#define NX_MODIFIERKEY_NUMERICPAD5
110#define NX_MODIFIERKEY_HELP6
111#define NX_MODIFIERKEY_SECONDARYFN 7
112#define NX_MODIFIERKEY_NUMLOCK8
113
114/* support for right hand modifier */
115#define NX_MODIFIERKEY_RSHIFT9
116#define NX_MODIFIERKEY_RCONTROL10
117#define NX_MODIFIERKEY_RALTERNATE11
118#define NX_MODIFIERKEY_RCOMMAND12
119
120
121typedef struct _NXParsedKeyMapping_ {
122 /* If nonzero, all numbers are shorts; if zero, all numbers are bytes*/
123shortshorts;
124
125/*
126 * For each keycode, low order bit says if the key
127 * generates characters.
128 * High order bit says if the key is assigned to a modifier bit.
129 * The second to low order bit gives the current state of the key.
130 */
131charkeyBits[NX_NUMKEYCODES];
132
133/* Bit number of highest numbered modifier bit */
134intmaxMod;
135
136/* Pointers to where the list of keys for each modifiers bit begins,
137 * or NULL.
138 */
139unsigned char *modDefs[NX_NUMMODIFIERS];
140
141/* Key code of highest key deinfed to generate characters */
142intnumDefs;
143
144/* Pointer into the keyMapping where this key's definitions begin */
145unsigned char *keyDefs[NX_NUMKEYCODES];
146
147/* number of sequence definitions */
148intnumSeqs;
149
150/* pointers to sequences */
151unsigned char *seqDefs[NX_NUMSEQUENCES];
152
153/* Special key definitions */
154intnumSpecialKeys;
155
156/* Special key values, or 0xFFFF if none */
157unsigned short specialKeys[NX_NUMSPECIALKEYS];
158
159/* Pointer to the original keymapping string */
160const unsigned char *mapping;
161
162/* Length of the original string */
163intmappingLen;
164} NXParsedKeyMapping;
165
166#endif /* !_DEV_EV_KEYMAP_H */
167

Archive Download this file

Revision: 1232