• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2     SDL - Simple DirectMedia Layer
3     Copyright (C) 1997-2006 Sam Lantinga
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Lesser General Public
7     License as published by the Free Software Foundation; either
8     version 2.1 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     Lesser General Public License for more details.
14 
15     You should have received a copy of the GNU Lesser General Public
16     License along with this library; if not, write to the Free Software
17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 
19     Sam Lantinga
20     slouken@libsdl.org
21 */
22 
23 #ifndef _SDL_keysym_h
24 #define _SDL_keysym_h
25 
26 /* What we really want is a mapping of every raw key on the keyboard.
27    To support international keyboards, we use the range 0xA1 - 0xFF
28    as international virtual keycodes.  We'll follow in the footsteps of X11...
29    The names of the keys
30  */
31 
32 typedef enum {
33 	/* The keyboard syms have been cleverly chosen to map to ASCII */
34 	SDLK_UNKNOWN		= 0,
35 	SDLK_FIRST		= 0,
36 	SDLK_BACKSPACE		= 8,
37 	SDLK_TAB		= 9,
38 	SDLK_CLEAR		= 12,
39 	SDLK_RETURN		= 13,
40 	SDLK_PAUSE		= 19,
41 	SDLK_ESCAPE		= 27,
42 	SDLK_SPACE		= 32,
43 	SDLK_EXCLAIM		= 33,
44 	SDLK_QUOTEDBL		= 34,
45 	SDLK_HASH		= 35,
46 	SDLK_DOLLAR		= 36,
47 	SDLK_AMPERSAND		= 38,
48 	SDLK_QUOTE		= 39,
49 	SDLK_LEFTPAREN		= 40,
50 	SDLK_RIGHTPAREN		= 41,
51 	SDLK_ASTERISK		= 42,
52 	SDLK_PLUS		= 43,
53 	SDLK_COMMA		= 44,
54 	SDLK_MINUS		= 45,
55 	SDLK_PERIOD		= 46,
56 	SDLK_SLASH		= 47,
57 	SDLK_0			= 48,
58 	SDLK_1			= 49,
59 	SDLK_2			= 50,
60 	SDLK_3			= 51,
61 	SDLK_4			= 52,
62 	SDLK_5			= 53,
63 	SDLK_6			= 54,
64 	SDLK_7			= 55,
65 	SDLK_8			= 56,
66 	SDLK_9			= 57,
67 	SDLK_COLON		= 58,
68 	SDLK_SEMICOLON		= 59,
69 	SDLK_LESS		= 60,
70 	SDLK_EQUALS		= 61,
71 	SDLK_GREATER		= 62,
72 	SDLK_QUESTION		= 63,
73 	SDLK_AT			= 64,
74 	/*
75 	   Skip uppercase letters
76 	 */
77 	SDLK_LEFTBRACKET	= 91,
78 	SDLK_BACKSLASH		= 92,
79 	SDLK_RIGHTBRACKET	= 93,
80 	SDLK_CARET		= 94,
81 	SDLK_UNDERSCORE		= 95,
82 	SDLK_BACKQUOTE		= 96,
83 	SDLK_a			= 97,
84 	SDLK_b			= 98,
85 	SDLK_c			= 99,
86 	SDLK_d			= 100,
87 	SDLK_e			= 101,
88 	SDLK_f			= 102,
89 	SDLK_g			= 103,
90 	SDLK_h			= 104,
91 	SDLK_i			= 105,
92 	SDLK_j			= 106,
93 	SDLK_k			= 107,
94 	SDLK_l			= 108,
95 	SDLK_m			= 109,
96 	SDLK_n			= 110,
97 	SDLK_o			= 111,
98 	SDLK_p			= 112,
99 	SDLK_q			= 113,
100 	SDLK_r			= 114,
101 	SDLK_s			= 115,
102 	SDLK_t			= 116,
103 	SDLK_u			= 117,
104 	SDLK_v			= 118,
105 	SDLK_w			= 119,
106 	SDLK_x			= 120,
107 	SDLK_y			= 121,
108 	SDLK_z			= 122,
109 	SDLK_DELETE		= 127,
110 	/* End of ASCII mapped keysyms */
111 
112 	/* International keyboard syms */
113 	SDLK_WORLD_0		= 160,		/* 0xA0 */
114 	SDLK_WORLD_1		= 161,
115 	SDLK_WORLD_2		= 162,
116 	SDLK_WORLD_3		= 163,
117 	SDLK_WORLD_4		= 164,
118 	SDLK_WORLD_5		= 165,
119 	SDLK_WORLD_6		= 166,
120 	SDLK_WORLD_7		= 167,
121 	SDLK_WORLD_8		= 168,
122 	SDLK_WORLD_9		= 169,
123 	SDLK_WORLD_10		= 170,
124 	SDLK_WORLD_11		= 171,
125 	SDLK_WORLD_12		= 172,
126 	SDLK_WORLD_13		= 173,
127 	SDLK_WORLD_14		= 174,
128 	SDLK_WORLD_15		= 175,
129 	SDLK_WORLD_16		= 176,
130 	SDLK_WORLD_17		= 177,
131 	SDLK_WORLD_18		= 178,
132 	SDLK_WORLD_19		= 179,
133 	SDLK_WORLD_20		= 180,
134 	SDLK_WORLD_21		= 181,
135 	SDLK_WORLD_22		= 182,
136 	SDLK_WORLD_23		= 183,
137 	SDLK_WORLD_24		= 184,
138 	SDLK_WORLD_25		= 185,
139 	SDLK_WORLD_26		= 186,
140 	SDLK_WORLD_27		= 187,
141 	SDLK_WORLD_28		= 188,
142 	SDLK_WORLD_29		= 189,
143 	SDLK_WORLD_30		= 190,
144 	SDLK_WORLD_31		= 191,
145 	SDLK_WORLD_32		= 192,
146 	SDLK_WORLD_33		= 193,
147 	SDLK_WORLD_34		= 194,
148 	SDLK_WORLD_35		= 195,
149 	SDLK_WORLD_36		= 196,
150 	SDLK_WORLD_37		= 197,
151 	SDLK_WORLD_38		= 198,
152 	SDLK_WORLD_39		= 199,
153 	SDLK_WORLD_40		= 200,
154 	SDLK_WORLD_41		= 201,
155 	SDLK_WORLD_42		= 202,
156 	SDLK_WORLD_43		= 203,
157 	SDLK_WORLD_44		= 204,
158 	SDLK_WORLD_45		= 205,
159 	SDLK_WORLD_46		= 206,
160 	SDLK_WORLD_47		= 207,
161 	SDLK_WORLD_48		= 208,
162 	SDLK_WORLD_49		= 209,
163 	SDLK_WORLD_50		= 210,
164 	SDLK_WORLD_51		= 211,
165 	SDLK_WORLD_52		= 212,
166 	SDLK_WORLD_53		= 213,
167 	SDLK_WORLD_54		= 214,
168 	SDLK_WORLD_55		= 215,
169 	SDLK_WORLD_56		= 216,
170 	SDLK_WORLD_57		= 217,
171 	SDLK_WORLD_58		= 218,
172 	SDLK_WORLD_59		= 219,
173 	SDLK_WORLD_60		= 220,
174 	SDLK_WORLD_61		= 221,
175 	SDLK_WORLD_62		= 222,
176 	SDLK_WORLD_63		= 223,
177 	SDLK_WORLD_64		= 224,
178 	SDLK_WORLD_65		= 225,
179 	SDLK_WORLD_66		= 226,
180 	SDLK_WORLD_67		= 227,
181 	SDLK_WORLD_68		= 228,
182 	SDLK_WORLD_69		= 229,
183 	SDLK_WORLD_70		= 230,
184 	SDLK_WORLD_71		= 231,
185 	SDLK_WORLD_72		= 232,
186 	SDLK_WORLD_73		= 233,
187 	SDLK_WORLD_74		= 234,
188 	SDLK_WORLD_75		= 235,
189 	SDLK_WORLD_76		= 236,
190 	SDLK_WORLD_77		= 237,
191 	SDLK_WORLD_78		= 238,
192 	SDLK_WORLD_79		= 239,
193 	SDLK_WORLD_80		= 240,
194 	SDLK_WORLD_81		= 241,
195 	SDLK_WORLD_82		= 242,
196 	SDLK_WORLD_83		= 243,
197 	SDLK_WORLD_84		= 244,
198 	SDLK_WORLD_85		= 245,
199 	SDLK_WORLD_86		= 246,
200 	SDLK_WORLD_87		= 247,
201 	SDLK_WORLD_88		= 248,
202 	SDLK_WORLD_89		= 249,
203 	SDLK_WORLD_90		= 250,
204 	SDLK_WORLD_91		= 251,
205 	SDLK_WORLD_92		= 252,
206 	SDLK_WORLD_93		= 253,
207 	SDLK_WORLD_94		= 254,
208 	SDLK_WORLD_95		= 255,		/* 0xFF */
209 
210 	/* Numeric keypad */
211 	SDLK_KP0		= 256,
212 	SDLK_KP1		= 257,
213 	SDLK_KP2		= 258,
214 	SDLK_KP3		= 259,
215 	SDLK_KP4		= 260,
216 	SDLK_KP5		= 261,
217 	SDLK_KP6		= 262,
218 	SDLK_KP7		= 263,
219 	SDLK_KP8		= 264,
220 	SDLK_KP9		= 265,
221 	SDLK_KP_PERIOD		= 266,
222 	SDLK_KP_DIVIDE		= 267,
223 	SDLK_KP_MULTIPLY	= 268,
224 	SDLK_KP_MINUS		= 269,
225 	SDLK_KP_PLUS		= 270,
226 	SDLK_KP_ENTER		= 271,
227 	SDLK_KP_EQUALS		= 272,
228 
229 	/* Arrows + Home/End pad */
230 	SDLK_UP			= 273,
231 	SDLK_DOWN		= 274,
232 	SDLK_RIGHT		= 275,
233 	SDLK_LEFT		= 276,
234 	SDLK_INSERT		= 277,
235 	SDLK_HOME		= 278,
236 	SDLK_END		= 279,
237 	SDLK_PAGEUP		= 280,
238 	SDLK_PAGEDOWN		= 281,
239 
240 	/* Function keys */
241 	SDLK_F1			= 282,
242 	SDLK_F2			= 283,
243 	SDLK_F3			= 284,
244 	SDLK_F4			= 285,
245 	SDLK_F5			= 286,
246 	SDLK_F6			= 287,
247 	SDLK_F7			= 288,
248 	SDLK_F8			= 289,
249 	SDLK_F9			= 290,
250 	SDLK_F10		= 291,
251 	SDLK_F11		= 292,
252 	SDLK_F12		= 293,
253 	SDLK_F13		= 294,
254 	SDLK_F14		= 295,
255 	SDLK_F15		= 296,
256 
257 	/* Key state modifier keys */
258 	SDLK_NUMLOCK		= 300,
259 	SDLK_CAPSLOCK		= 301,
260 	SDLK_SCROLLOCK		= 302,
261 	SDLK_RSHIFT		= 303,
262 	SDLK_LSHIFT		= 304,
263 	SDLK_RCTRL		= 305,
264 	SDLK_LCTRL		= 306,
265 	SDLK_RALT		= 307,
266 	SDLK_LALT		= 308,
267 	SDLK_RMETA		= 309,
268 	SDLK_LMETA		= 310,
269 	SDLK_LSUPER		= 311,		/* Left "Windows" key */
270 	SDLK_RSUPER		= 312,		/* Right "Windows" key */
271 	SDLK_MODE		= 313,		/* "Alt Gr" key */
272 	SDLK_COMPOSE		= 314,		/* Multi-key compose key */
273 
274 	/* Miscellaneous function keys */
275 	SDLK_HELP		= 315,
276 	SDLK_PRINT		= 316,
277 	SDLK_SYSREQ		= 317,
278 	SDLK_BREAK		= 318,
279 	SDLK_MENU		= 319,
280 	SDLK_POWER		= 320,		/* Power Macintosh power key */
281 	SDLK_EURO		= 321,		/* Some european keyboards */
282 	SDLK_UNDO		= 322,		/* Atari keyboard has Undo */
283 
284 	/* Add any other keys here */
285 
286 	SDLK_LAST
287 } SDLKey;
288 
289 /* Enumeration of valid key mods (possibly OR'd together) */
290 typedef enum {
291 	KMOD_NONE  = 0x0000,
292 	KMOD_LSHIFT= 0x0001,
293 	KMOD_RSHIFT= 0x0002,
294 	KMOD_LCTRL = 0x0040,
295 	KMOD_RCTRL = 0x0080,
296 	KMOD_LALT  = 0x0100,
297 	KMOD_RALT  = 0x0200,
298 	KMOD_LMETA = 0x0400,
299 	KMOD_RMETA = 0x0800,
300 	KMOD_NUM   = 0x1000,
301 	KMOD_CAPS  = 0x2000,
302 	KMOD_MODE  = 0x4000,
303 	KMOD_RESERVED = 0x8000
304 } SDLMod;
305 
306 #define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
307 #define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
308 #define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
309 #define KMOD_META	(KMOD_LMETA|KMOD_RMETA)
310 
311 #endif /* _SDL_keysym_h */
312