Mercurial > sdl-ios-xcode
annotate include/SDL_keysym.h @ 934:af585d6efec8
Date: Thu, 17 Jun 2004 11:38:51 -0700 (PDT)
From: Eric Wing <ewing2121@yahoo.com>
Subject: New OS X patch (was Re: [SDL] Bug with inverted mouse coordinates in
I have a new patch for OS X I would like to submit.
First, it appears no further action has been taken on
my fix from Apple on the OpenGL windowed mode mouse
inversion problem. The fix would reunify the code, and
no longer require case checking for which version of
the OS you are running. This is probably a good fix
because the behavior with the old code could change
again with future versions of the OS, so those fixes
are included in this new patch.
But in addition, when I was at Apple, I asked them
about the ability to distinguish between the modifier
keys on the left and right sides of the keyboard (e.g.
Left Shift, Right Shift, Left/Right Alt, L/R Cmd, L/R
Ctrl). They told me that starting with Panther, the OS
began supporting this feature. This has always been a
source of annoyance for me when bringing a program
that comes from Windows or Linux to OS X when the
keybindings happened to need distinguishable left-side
and right-side keys. So the rest of the patch I am
submitting contains new code to support this feature
on Panther (and presumably later versions of the OS).
So after removing the OS version checks for the mouse
inversion problem, I reused the OS version checks to
activate the Left/Right detection of modifier keys. If
you are running Panther (or above), the new code will
attempt to distinguish between sides. For the older
OS's, the code path reverts to the original code.
I've tested with Panther on a G4 Cube, G5 dual
processor, and Powerbook Rev C. The Cube and G5
keyboards demonstrated the ability to distinguish
between sides. The Powerbook seems to only have
left-side keys, but the patch was still able to handle
it by producing the same results as before the patch.
I also wanted to test a non-Apple keyboard.
Unfortunately, I don't have any PC USB keyboards.
However, I was able to borrow a Sun Microsystems USB
keyboard, so I tried that out on the G5, and I got the
correct behavior for left and right sides. I'm
expecting that if it worked with a Sun keyboard, most
other keyboards should work with no problems.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 20 Aug 2004 22:35:23 +0000 |
parents | b8d311d90021 |
children | c9b51268668f |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
251
b8688cfdc232
Updated the headers with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
184
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #ifndef _SDL_keysym_h | |
29 #define _SDL_keysym_h | |
30 | |
31 /* What we really want is a mapping of every raw key on the keyboard. | |
32 To support international keyboards, we use the range 0xA1 - 0xFF | |
33 as international virtual keycodes. We'll follow in the footsteps of X11... | |
34 The names of the keys | |
35 */ | |
36 | |
37 typedef enum { | |
38 /* The keyboard syms have been cleverly chosen to map to ASCII */ | |
39 SDLK_UNKNOWN = 0, | |
40 SDLK_FIRST = 0, | |
41 SDLK_BACKSPACE = 8, | |
42 SDLK_TAB = 9, | |
43 SDLK_CLEAR = 12, | |
44 SDLK_RETURN = 13, | |
45 SDLK_PAUSE = 19, | |
46 SDLK_ESCAPE = 27, | |
47 SDLK_SPACE = 32, | |
48 SDLK_EXCLAIM = 33, | |
49 SDLK_QUOTEDBL = 34, | |
50 SDLK_HASH = 35, | |
51 SDLK_DOLLAR = 36, | |
52 SDLK_AMPERSAND = 38, | |
53 SDLK_QUOTE = 39, | |
54 SDLK_LEFTPAREN = 40, | |
55 SDLK_RIGHTPAREN = 41, | |
56 SDLK_ASTERISK = 42, | |
57 SDLK_PLUS = 43, | |
58 SDLK_COMMA = 44, | |
59 SDLK_MINUS = 45, | |
60 SDLK_PERIOD = 46, | |
61 SDLK_SLASH = 47, | |
62 SDLK_0 = 48, | |
63 SDLK_1 = 49, | |
64 SDLK_2 = 50, | |
65 SDLK_3 = 51, | |
66 SDLK_4 = 52, | |
67 SDLK_5 = 53, | |
68 SDLK_6 = 54, | |
69 SDLK_7 = 55, | |
70 SDLK_8 = 56, | |
71 SDLK_9 = 57, | |
72 SDLK_COLON = 58, | |
73 SDLK_SEMICOLON = 59, | |
74 SDLK_LESS = 60, | |
75 SDLK_EQUALS = 61, | |
76 SDLK_GREATER = 62, | |
77 SDLK_QUESTION = 63, | |
78 SDLK_AT = 64, | |
79 /* | |
80 Skip uppercase letters | |
81 */ | |
82 SDLK_LEFTBRACKET = 91, | |
83 SDLK_BACKSLASH = 92, | |
84 SDLK_RIGHTBRACKET = 93, | |
85 SDLK_CARET = 94, | |
86 SDLK_UNDERSCORE = 95, | |
87 SDLK_BACKQUOTE = 96, | |
88 SDLK_a = 97, | |
89 SDLK_b = 98, | |
90 SDLK_c = 99, | |
91 SDLK_d = 100, | |
92 SDLK_e = 101, | |
93 SDLK_f = 102, | |
94 SDLK_g = 103, | |
95 SDLK_h = 104, | |
96 SDLK_i = 105, | |
97 SDLK_j = 106, | |
98 SDLK_k = 107, | |
99 SDLK_l = 108, | |
100 SDLK_m = 109, | |
101 SDLK_n = 110, | |
102 SDLK_o = 111, | |
103 SDLK_p = 112, | |
104 SDLK_q = 113, | |
105 SDLK_r = 114, | |
106 SDLK_s = 115, | |
107 SDLK_t = 116, | |
108 SDLK_u = 117, | |
109 SDLK_v = 118, | |
110 SDLK_w = 119, | |
111 SDLK_x = 120, | |
112 SDLK_y = 121, | |
113 SDLK_z = 122, | |
114 SDLK_DELETE = 127, | |
115 /* End of ASCII mapped keysyms */ | |
116 | |
117 /* International keyboard syms */ | |
118 SDLK_WORLD_0 = 160, /* 0xA0 */ | |
119 SDLK_WORLD_1 = 161, | |
120 SDLK_WORLD_2 = 162, | |
121 SDLK_WORLD_3 = 163, | |
122 SDLK_WORLD_4 = 164, | |
123 SDLK_WORLD_5 = 165, | |
124 SDLK_WORLD_6 = 166, | |
125 SDLK_WORLD_7 = 167, | |
126 SDLK_WORLD_8 = 168, | |
127 SDLK_WORLD_9 = 169, | |
128 SDLK_WORLD_10 = 170, | |
129 SDLK_WORLD_11 = 171, | |
130 SDLK_WORLD_12 = 172, | |
131 SDLK_WORLD_13 = 173, | |
132 SDLK_WORLD_14 = 174, | |
133 SDLK_WORLD_15 = 175, | |
134 SDLK_WORLD_16 = 176, | |
135 SDLK_WORLD_17 = 177, | |
136 SDLK_WORLD_18 = 178, | |
137 SDLK_WORLD_19 = 179, | |
138 SDLK_WORLD_20 = 180, | |
139 SDLK_WORLD_21 = 181, | |
140 SDLK_WORLD_22 = 182, | |
141 SDLK_WORLD_23 = 183, | |
142 SDLK_WORLD_24 = 184, | |
143 SDLK_WORLD_25 = 185, | |
144 SDLK_WORLD_26 = 186, | |
145 SDLK_WORLD_27 = 187, | |
146 SDLK_WORLD_28 = 188, | |
147 SDLK_WORLD_29 = 189, | |
148 SDLK_WORLD_30 = 190, | |
149 SDLK_WORLD_31 = 191, | |
150 SDLK_WORLD_32 = 192, | |
151 SDLK_WORLD_33 = 193, | |
152 SDLK_WORLD_34 = 194, | |
153 SDLK_WORLD_35 = 195, | |
154 SDLK_WORLD_36 = 196, | |
155 SDLK_WORLD_37 = 197, | |
156 SDLK_WORLD_38 = 198, | |
157 SDLK_WORLD_39 = 199, | |
158 SDLK_WORLD_40 = 200, | |
159 SDLK_WORLD_41 = 201, | |
160 SDLK_WORLD_42 = 202, | |
161 SDLK_WORLD_43 = 203, | |
162 SDLK_WORLD_44 = 204, | |
163 SDLK_WORLD_45 = 205, | |
164 SDLK_WORLD_46 = 206, | |
165 SDLK_WORLD_47 = 207, | |
166 SDLK_WORLD_48 = 208, | |
167 SDLK_WORLD_49 = 209, | |
168 SDLK_WORLD_50 = 210, | |
169 SDLK_WORLD_51 = 211, | |
170 SDLK_WORLD_52 = 212, | |
171 SDLK_WORLD_53 = 213, | |
172 SDLK_WORLD_54 = 214, | |
173 SDLK_WORLD_55 = 215, | |
174 SDLK_WORLD_56 = 216, | |
175 SDLK_WORLD_57 = 217, | |
176 SDLK_WORLD_58 = 218, | |
177 SDLK_WORLD_59 = 219, | |
178 SDLK_WORLD_60 = 220, | |
179 SDLK_WORLD_61 = 221, | |
180 SDLK_WORLD_62 = 222, | |
181 SDLK_WORLD_63 = 223, | |
182 SDLK_WORLD_64 = 224, | |
183 SDLK_WORLD_65 = 225, | |
184 SDLK_WORLD_66 = 226, | |
185 SDLK_WORLD_67 = 227, | |
186 SDLK_WORLD_68 = 228, | |
187 SDLK_WORLD_69 = 229, | |
188 SDLK_WORLD_70 = 230, | |
189 SDLK_WORLD_71 = 231, | |
190 SDLK_WORLD_72 = 232, | |
191 SDLK_WORLD_73 = 233, | |
192 SDLK_WORLD_74 = 234, | |
193 SDLK_WORLD_75 = 235, | |
194 SDLK_WORLD_76 = 236, | |
195 SDLK_WORLD_77 = 237, | |
196 SDLK_WORLD_78 = 238, | |
197 SDLK_WORLD_79 = 239, | |
198 SDLK_WORLD_80 = 240, | |
199 SDLK_WORLD_81 = 241, | |
200 SDLK_WORLD_82 = 242, | |
201 SDLK_WORLD_83 = 243, | |
202 SDLK_WORLD_84 = 244, | |
203 SDLK_WORLD_85 = 245, | |
204 SDLK_WORLD_86 = 246, | |
205 SDLK_WORLD_87 = 247, | |
206 SDLK_WORLD_88 = 248, | |
207 SDLK_WORLD_89 = 249, | |
208 SDLK_WORLD_90 = 250, | |
209 SDLK_WORLD_91 = 251, | |
210 SDLK_WORLD_92 = 252, | |
211 SDLK_WORLD_93 = 253, | |
212 SDLK_WORLD_94 = 254, | |
213 SDLK_WORLD_95 = 255, /* 0xFF */ | |
214 | |
215 /* Numeric keypad */ | |
216 SDLK_KP0 = 256, | |
217 SDLK_KP1 = 257, | |
218 SDLK_KP2 = 258, | |
219 SDLK_KP3 = 259, | |
220 SDLK_KP4 = 260, | |
221 SDLK_KP5 = 261, | |
222 SDLK_KP6 = 262, | |
223 SDLK_KP7 = 263, | |
224 SDLK_KP8 = 264, | |
225 SDLK_KP9 = 265, | |
226 SDLK_KP_PERIOD = 266, | |
227 SDLK_KP_DIVIDE = 267, | |
228 SDLK_KP_MULTIPLY = 268, | |
229 SDLK_KP_MINUS = 269, | |
230 SDLK_KP_PLUS = 270, | |
231 SDLK_KP_ENTER = 271, | |
232 SDLK_KP_EQUALS = 272, | |
233 | |
234 /* Arrows + Home/End pad */ | |
235 SDLK_UP = 273, | |
236 SDLK_DOWN = 274, | |
237 SDLK_RIGHT = 275, | |
238 SDLK_LEFT = 276, | |
239 SDLK_INSERT = 277, | |
240 SDLK_HOME = 278, | |
241 SDLK_END = 279, | |
242 SDLK_PAGEUP = 280, | |
243 SDLK_PAGEDOWN = 281, | |
244 | |
245 /* Function keys */ | |
246 SDLK_F1 = 282, | |
247 SDLK_F2 = 283, | |
248 SDLK_F3 = 284, | |
249 SDLK_F4 = 285, | |
250 SDLK_F5 = 286, | |
251 SDLK_F6 = 287, | |
252 SDLK_F7 = 288, | |
253 SDLK_F8 = 289, | |
254 SDLK_F9 = 290, | |
255 SDLK_F10 = 291, | |
256 SDLK_F11 = 292, | |
257 SDLK_F12 = 293, | |
258 SDLK_F13 = 294, | |
259 SDLK_F14 = 295, | |
260 SDLK_F15 = 296, | |
261 | |
262 /* Key state modifier keys */ | |
263 SDLK_NUMLOCK = 300, | |
264 SDLK_CAPSLOCK = 301, | |
265 SDLK_SCROLLOCK = 302, | |
266 SDLK_RSHIFT = 303, | |
267 SDLK_LSHIFT = 304, | |
268 SDLK_RCTRL = 305, | |
269 SDLK_LCTRL = 306, | |
270 SDLK_RALT = 307, | |
271 SDLK_LALT = 308, | |
272 SDLK_RMETA = 309, | |
273 SDLK_LMETA = 310, | |
274 SDLK_LSUPER = 311, /* Left "Windows" key */ | |
275 SDLK_RSUPER = 312, /* Right "Windows" key */ | |
276 SDLK_MODE = 313, /* "Alt Gr" key */ | |
277 SDLK_COMPOSE = 314, /* Multi-key compose key */ | |
278 | |
279 /* Miscellaneous function keys */ | |
280 SDLK_HELP = 315, | |
281 SDLK_PRINT = 316, | |
282 SDLK_SYSREQ = 317, | |
283 SDLK_BREAK = 318, | |
284 SDLK_MENU = 319, | |
285 SDLK_POWER = 320, /* Power Macintosh power key */ | |
286 SDLK_EURO = 321, /* Some european keyboards */ | |
184
3142d2ac11db
Added the Undo key for the Atari keyboard
Sam Lantinga <slouken@libsdl.org>
parents:
0
diff
changeset
|
287 SDLK_UNDO = 322, /* Atari keyboard has Undo */ |
0 | 288 |
289 /* Add any other keys here */ | |
290 | |
291 SDLK_LAST | |
292 } SDLKey; | |
293 | |
294 /* Enumeration of valid key mods (possibly OR'd together) */ | |
295 typedef enum { | |
296 KMOD_NONE = 0x0000, | |
297 KMOD_LSHIFT= 0x0001, | |
298 KMOD_RSHIFT= 0x0002, | |
299 KMOD_LCTRL = 0x0040, | |
300 KMOD_RCTRL = 0x0080, | |
301 KMOD_LALT = 0x0100, | |
302 KMOD_RALT = 0x0200, | |
303 KMOD_LMETA = 0x0400, | |
304 KMOD_RMETA = 0x0800, | |
305 KMOD_NUM = 0x1000, | |
306 KMOD_CAPS = 0x2000, | |
307 KMOD_MODE = 0x4000, | |
308 KMOD_RESERVED = 0x8000 | |
309 } SDLMod; | |
310 | |
311 #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) | |
312 #define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) | |
313 #define KMOD_ALT (KMOD_LALT|KMOD_RALT) | |
314 #define KMOD_META (KMOD_LMETA|KMOD_RMETA) | |
315 | |
316 #endif /* _SDL_keysym_h */ |