1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * \file SDL_scancode.h
24 *
25 * Defines keyboard scancodes.
26 */
27
28#ifndef SDL_scancode_h_
29#define SDL_scancode_h_
30
31#include "SDL_stdinc.h"
32
33/**
34 * \brief The SDL keyboard scancode representation.
35 *
36 * Values of this type are used to represent keyboard keys, among other places
37 * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
38 * SDL_Event structure.
39 *
40 * The values in this enumeration are based on the USB usage page standard:
41 * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
42 */
43typedef enum
44{
45 SDL_SCANCODE_UNKNOWN = 0,
46
47 /**
48 * \name Usage page 0x07
49 *
50 * These values are from usage page 0x07 (USB keyboard page).
51 */
52 /* @{ */
53
54 SDL_SCANCODE_A = 4,
55 SDL_SCANCODE_B = 5,
56 SDL_SCANCODE_C = 6,
57 SDL_SCANCODE_D = 7,
58 SDL_SCANCODE_E = 8,
59 SDL_SCANCODE_F = 9,
60 SDL_SCANCODE_G = 10,
61 SDL_SCANCODE_H = 11,
62 SDL_SCANCODE_I = 12,
63 SDL_SCANCODE_J = 13,
64 SDL_SCANCODE_K = 14,
65 SDL_SCANCODE_L = 15,
66 SDL_SCANCODE_M = 16,
67 SDL_SCANCODE_N = 17,
68 SDL_SCANCODE_O = 18,
69 SDL_SCANCODE_P = 19,
70 SDL_SCANCODE_Q = 20,
71 SDL_SCANCODE_R = 21,
72 SDL_SCANCODE_S = 22,
73 SDL_SCANCODE_T = 23,
74 SDL_SCANCODE_U = 24,
75 SDL_SCANCODE_V = 25,
76 SDL_SCANCODE_W = 26,
77 SDL_SCANCODE_X = 27,
78 SDL_SCANCODE_Y = 28,
79 SDL_SCANCODE_Z = 29,
80
81 SDL_SCANCODE_1 = 30,
82 SDL_SCANCODE_2 = 31,
83 SDL_SCANCODE_3 = 32,
84 SDL_SCANCODE_4 = 33,
85 SDL_SCANCODE_5 = 34,
86 SDL_SCANCODE_6 = 35,
87 SDL_SCANCODE_7 = 36,
88 SDL_SCANCODE_8 = 37,
89 SDL_SCANCODE_9 = 38,
90 SDL_SCANCODE_0 = 39,
91
92 SDL_SCANCODE_RETURN = 40,
93 SDL_SCANCODE_ESCAPE = 41,
94 SDL_SCANCODE_BACKSPACE = 42,
95 SDL_SCANCODE_TAB = 43,
96 SDL_SCANCODE_SPACE = 44,
97
98 SDL_SCANCODE_MINUS = 45,
99 SDL_SCANCODE_EQUALS = 46,
100 SDL_SCANCODE_LEFTBRACKET = 47,
101 SDL_SCANCODE_RIGHTBRACKET = 48,
102 SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return
103 * key on ISO keyboards and at the right end
104 * of the QWERTY row on ANSI keyboards.
105 * Produces REVERSE SOLIDUS (backslash) and
106 * VERTICAL LINE in a US layout, REVERSE
107 * SOLIDUS and VERTICAL LINE in a UK Mac
108 * layout, NUMBER SIGN and TILDE in a UK
109 * Windows layout, DOLLAR SIGN and POUND SIGN
110 * in a Swiss German layout, NUMBER SIGN and
111 * APOSTROPHE in a German layout, GRAVE
112 * ACCENT and POUND SIGN in a French Mac
113 * layout, and ASTERISK and MICRO SIGN in a
114 * French Windows layout.
115 */
116 SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code
117 * instead of 49 for the same key, but all
118 * OSes I've seen treat the two codes
119 * identically. So, as an implementor, unless
120 * your keyboard generates both of those
121 * codes and your OS treats them differently,
122 * you should generate SDL_SCANCODE_BACKSLASH
123 * instead of this code. As a user, you
124 * should not rely on this code because SDL
125 * will never generate it with most (all?)
126 * keyboards.
127 */
128 SDL_SCANCODE_SEMICOLON = 51,
129 SDL_SCANCODE_APOSTROPHE = 52,
130 SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI
131 * and ISO keyboards). Produces GRAVE ACCENT and
132 * TILDE in a US Windows layout and in US and UK
133 * Mac layouts on ANSI keyboards, GRAVE ACCENT
134 * and NOT SIGN in a UK Windows layout, SECTION
135 * SIGN and PLUS-MINUS SIGN in US and UK Mac
136 * layouts on ISO keyboards, SECTION SIGN and
137 * DEGREE SIGN in a Swiss German layout (Mac:
138 * only on ISO keyboards), CIRCUMFLEX ACCENT and
139 * DEGREE SIGN in a German layout (Mac: only on
140 * ISO keyboards), SUPERSCRIPT TWO and TILDE in a
141 * French Windows layout, COMMERCIAL AT and
142 * NUMBER SIGN in a French Mac layout on ISO
143 * keyboards, and LESS-THAN SIGN and GREATER-THAN
144 * SIGN in a Swiss German, German, or French Mac
145 * layout on ANSI keyboards.
146 */
147 SDL_SCANCODE_COMMA = 54,
148 SDL_SCANCODE_PERIOD = 55,
149 SDL_SCANCODE_SLASH = 56,
150
151 SDL_SCANCODE_CAPSLOCK = 57,
152
153 SDL_SCANCODE_F1 = 58,
154 SDL_SCANCODE_F2 = 59,
155 SDL_SCANCODE_F3 = 60,
156 SDL_SCANCODE_F4 = 61,
157 SDL_SCANCODE_F5 = 62,
158 SDL_SCANCODE_F6 = 63,
159 SDL_SCANCODE_F7 = 64,
160 SDL_SCANCODE_F8 = 65,
161 SDL_SCANCODE_F9 = 66,
162 SDL_SCANCODE_F10 = 67,
163 SDL_SCANCODE_F11 = 68,
164 SDL_SCANCODE_F12 = 69,
165
166 SDL_SCANCODE_PRINTSCREEN = 70,
167 SDL_SCANCODE_SCROLLLOCK = 71,
168 SDL_SCANCODE_PAUSE = 72,
169 SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
170 does send code 73, not 117) */
171 SDL_SCANCODE_HOME = 74,
172 SDL_SCANCODE_PAGEUP = 75,
173 SDL_SCANCODE_DELETE = 76,
174 SDL_SCANCODE_END = 77,
175 SDL_SCANCODE_PAGEDOWN = 78,
176 SDL_SCANCODE_RIGHT = 79,
177 SDL_SCANCODE_LEFT = 80,
178 SDL_SCANCODE_DOWN = 81,
179 SDL_SCANCODE_UP = 82,
180
181 SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
182 */
183 SDL_SCANCODE_KP_DIVIDE = 84,
184 SDL_SCANCODE_KP_MULTIPLY = 85,
185 SDL_SCANCODE_KP_MINUS = 86,
186 SDL_SCANCODE_KP_PLUS = 87,
187 SDL_SCANCODE_KP_ENTER = 88,
188 SDL_SCANCODE_KP_1 = 89,
189 SDL_SCANCODE_KP_2 = 90,
190 SDL_SCANCODE_KP_3 = 91,
191 SDL_SCANCODE_KP_4 = 92,
192 SDL_SCANCODE_KP_5 = 93,
193 SDL_SCANCODE_KP_6 = 94,
194 SDL_SCANCODE_KP_7 = 95,
195 SDL_SCANCODE_KP_8 = 96,
196 SDL_SCANCODE_KP_9 = 97,
197 SDL_SCANCODE_KP_0 = 98,
198 SDL_SCANCODE_KP_PERIOD = 99,
199
200 SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO
201 * keyboards have over ANSI ones,
202 * located between left shift and Y.
203 * Produces GRAVE ACCENT and TILDE in a
204 * US or UK Mac layout, REVERSE SOLIDUS
205 * (backslash) and VERTICAL LINE in a
206 * US or UK Windows layout, and
207 * LESS-THAN SIGN and GREATER-THAN SIGN
208 * in a Swiss German, German, or French
209 * layout. */
210 SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
211 SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag,
212 * not a physical key - but some Mac keyboards
213 * do have a power key. */
214 SDL_SCANCODE_KP_EQUALS = 103,
215 SDL_SCANCODE_F13 = 104,
216 SDL_SCANCODE_F14 = 105,
217 SDL_SCANCODE_F15 = 106,
218 SDL_SCANCODE_F16 = 107,
219 SDL_SCANCODE_F17 = 108,
220 SDL_SCANCODE_F18 = 109,
221 SDL_SCANCODE_F19 = 110,
222 SDL_SCANCODE_F20 = 111,
223 SDL_SCANCODE_F21 = 112,
224 SDL_SCANCODE_F22 = 113,
225 SDL_SCANCODE_F23 = 114,
226 SDL_SCANCODE_F24 = 115,
227 SDL_SCANCODE_EXECUTE = 116,
228 SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */
229 SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */
230 SDL_SCANCODE_SELECT = 119,
231 SDL_SCANCODE_STOP = 120, /**< AC Stop */
232 SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */
233 SDL_SCANCODE_UNDO = 122, /**< AC Undo */
234 SDL_SCANCODE_CUT = 123, /**< AC Cut */
235 SDL_SCANCODE_COPY = 124, /**< AC Copy */
236 SDL_SCANCODE_PASTE = 125, /**< AC Paste */
237 SDL_SCANCODE_FIND = 126, /**< AC Find */
238 SDL_SCANCODE_MUTE = 127,
239 SDL_SCANCODE_VOLUMEUP = 128,
240 SDL_SCANCODE_VOLUMEDOWN = 129,
241/* not sure whether there's a reason to enable these */
242/* SDL_SCANCODE_LOCKINGCAPSLOCK = 130, */
243/* SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
244/* SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
245 SDL_SCANCODE_KP_COMMA = 133,
246 SDL_SCANCODE_KP_EQUALSAS400 = 134,
247
248 SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
249 footnotes in USB doc */
250 SDL_SCANCODE_INTERNATIONAL2 = 136,
251 SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
252 SDL_SCANCODE_INTERNATIONAL4 = 138,
253 SDL_SCANCODE_INTERNATIONAL5 = 139,
254 SDL_SCANCODE_INTERNATIONAL6 = 140,
255 SDL_SCANCODE_INTERNATIONAL7 = 141,
256 SDL_SCANCODE_INTERNATIONAL8 = 142,
257 SDL_SCANCODE_INTERNATIONAL9 = 143,
258 SDL_SCANCODE_LANG1 = 144, /**< Hangul/English toggle */
259 SDL_SCANCODE_LANG2 = 145, /**< Hanja conversion */
260 SDL_SCANCODE_LANG3 = 146, /**< Katakana */
261 SDL_SCANCODE_LANG4 = 147, /**< Hiragana */
262 SDL_SCANCODE_LANG5 = 148, /**< Zenkaku/Hankaku */
263 SDL_SCANCODE_LANG6 = 149, /**< reserved */
264 SDL_SCANCODE_LANG7 = 150, /**< reserved */
265 SDL_SCANCODE_LANG8 = 151, /**< reserved */
266 SDL_SCANCODE_LANG9 = 152, /**< reserved */
267
268 SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
269 SDL_SCANCODE_SYSREQ = 154,
270 SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */
271 SDL_SCANCODE_CLEAR = 156,
272 SDL_SCANCODE_PRIOR = 157,
273 SDL_SCANCODE_RETURN2 = 158,
274 SDL_SCANCODE_SEPARATOR = 159,
275 SDL_SCANCODE_OUT = 160,
276 SDL_SCANCODE_OPER = 161,
277 SDL_SCANCODE_CLEARAGAIN = 162,
278 SDL_SCANCODE_CRSEL = 163,
279 SDL_SCANCODE_EXSEL = 164,
280
281 SDL_SCANCODE_KP_00 = 176,
282 SDL_SCANCODE_KP_000 = 177,
283 SDL_SCANCODE_THOUSANDSSEPARATOR = 178,
284 SDL_SCANCODE_DECIMALSEPARATOR = 179,
285 SDL_SCANCODE_CURRENCYUNIT = 180,
286 SDL_SCANCODE_CURRENCYSUBUNIT = 181,
287 SDL_SCANCODE_KP_LEFTPAREN = 182,
288 SDL_SCANCODE_KP_RIGHTPAREN = 183,
289 SDL_SCANCODE_KP_LEFTBRACE = 184,
290 SDL_SCANCODE_KP_RIGHTBRACE = 185,
291 SDL_SCANCODE_KP_TAB = 186,
292 SDL_SCANCODE_KP_BACKSPACE = 187,
293 SDL_SCANCODE_KP_A = 188,
294 SDL_SCANCODE_KP_B = 189,
295 SDL_SCANCODE_KP_C = 190,
296 SDL_SCANCODE_KP_D = 191,
297 SDL_SCANCODE_KP_E = 192,
298 SDL_SCANCODE_KP_F = 193,
299 SDL_SCANCODE_KP_XOR = 194,
300 SDL_SCANCODE_KP_POWER = 195,
301 SDL_SCANCODE_KP_PERCENT = 196,
302 SDL_SCANCODE_KP_LESS = 197,
303 SDL_SCANCODE_KP_GREATER = 198,
304 SDL_SCANCODE_KP_AMPERSAND = 199,
305 SDL_SCANCODE_KP_DBLAMPERSAND = 200,
306 SDL_SCANCODE_KP_VERTICALBAR = 201,
307 SDL_SCANCODE_KP_DBLVERTICALBAR = 202,
308 SDL_SCANCODE_KP_COLON = 203,
309 SDL_SCANCODE_KP_HASH = 204,
310 SDL_SCANCODE_KP_SPACE = 205,
311 SDL_SCANCODE_KP_AT = 206,
312 SDL_SCANCODE_KP_EXCLAM = 207,
313 SDL_SCANCODE_KP_MEMSTORE = 208,
314 SDL_SCANCODE_KP_MEMRECALL = 209,
315 SDL_SCANCODE_KP_MEMCLEAR = 210,
316 SDL_SCANCODE_KP_MEMADD = 211,
317 SDL_SCANCODE_KP_MEMSUBTRACT = 212,
318 SDL_SCANCODE_KP_MEMMULTIPLY = 213,
319 SDL_SCANCODE_KP_MEMDIVIDE = 214,
320 SDL_SCANCODE_KP_PLUSMINUS = 215,
321 SDL_SCANCODE_KP_CLEAR = 216,
322 SDL_SCANCODE_KP_CLEARENTRY = 217,
323 SDL_SCANCODE_KP_BINARY = 218,
324 SDL_SCANCODE_KP_OCTAL = 219,
325 SDL_SCANCODE_KP_DECIMAL = 220,
326 SDL_SCANCODE_KP_HEXADECIMAL = 221,
327
328 SDL_SCANCODE_LCTRL = 224,
329 SDL_SCANCODE_LSHIFT = 225,
330 SDL_SCANCODE_LALT = 226, /**< alt, option */
331 SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
332 SDL_SCANCODE_RCTRL = 228,
333 SDL_SCANCODE_RSHIFT = 229,
334 SDL_SCANCODE_RALT = 230, /**< alt gr, option */
335 SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
336
337 SDL_SCANCODE_MODE = 257, /**< I'm not sure if this is really not covered
338 * by any of the above, but since there's a
339 * special KMOD_MODE for it I'm adding it here
340 */
341
342 /* @} *//* Usage page 0x07 */
343
344 /**
345 * \name Usage page 0x0C
346 *
347 * These values are mapped from usage page 0x0C (USB consumer page).
348 * See https://usb.org/sites/default/files/hut1_2.pdf
349 *
350 * There are way more keys in the spec than we can represent in the
351 * current scancode range, so pick the ones that commonly come up in
352 * real world usage.
353 */
354 /* @{ */
355
356 SDL_SCANCODE_AUDIONEXT = 258,
357 SDL_SCANCODE_AUDIOPREV = 259,
358 SDL_SCANCODE_AUDIOSTOP = 260,
359 SDL_SCANCODE_AUDIOPLAY = 261,
360 SDL_SCANCODE_AUDIOMUTE = 262,
361 SDL_SCANCODE_MEDIASELECT = 263,
362 SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */
363 SDL_SCANCODE_MAIL = 265,
364 SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */
365 SDL_SCANCODE_COMPUTER = 267,
366 SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */
367 SDL_SCANCODE_AC_HOME = 269, /**< AC Home */
368 SDL_SCANCODE_AC_BACK = 270, /**< AC Back */
369 SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */
370 SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */
371 SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */
372 SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */
373
374 /* @} *//* Usage page 0x0C */
375
376 /**
377 * \name Walther keys
378 *
379 * These are values that Christian Walther added (for mac keyboard?).
380 */
381 /* @{ */
382
383 SDL_SCANCODE_BRIGHTNESSDOWN = 275,
384 SDL_SCANCODE_BRIGHTNESSUP = 276,
385 SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
386 switch, video mode switch */
387 SDL_SCANCODE_KBDILLUMTOGGLE = 278,
388 SDL_SCANCODE_KBDILLUMDOWN = 279,
389 SDL_SCANCODE_KBDILLUMUP = 280,
390 SDL_SCANCODE_EJECT = 281,
391 SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */
392
393 SDL_SCANCODE_APP1 = 283,
394 SDL_SCANCODE_APP2 = 284,
395
396 /* @} *//* Walther keys */
397
398 /**
399 * \name Usage page 0x0C (additional media keys)
400 *
401 * These values are mapped from usage page 0x0C (USB consumer page).
402 */
403 /* @{ */
404
405 SDL_SCANCODE_AUDIOREWIND = 285,
406 SDL_SCANCODE_AUDIOFASTFORWARD = 286,
407
408 /* @} *//* Usage page 0x0C (additional media keys) */
409
410 /**
411 * \name Mobile keys
412 *
413 * These are values that are often used on mobile phones.
414 */
415 /* @{ */
416
417 SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and
418 used as a multi-function feature key for selecting
419 a software defined function shown on the bottom left
420 of the display. */
421 SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and
422 used as a multi-function feature key for selecting
423 a software defined function shown on the bottom right
424 of the display. */
425 SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */
426 SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */
427
428 /* @} *//* Mobile keys */
429
430 /* Add any other keys here. */
431
432 SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
433 for array bounds */
434} SDL_Scancode;
435
436#endif /* SDL_scancode_h_ */
437
438/* vi: set ts=4 sw=4 expandtab: */
439