SDL  2.0
SDL_scancode.h
Go to the documentation of this file.
1 /*
2  Simple DirectMedia Layer
3  Copyright (C) 1997-2018 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  * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf
42  */
43 typedef enum
44 {
46 
47  /**
48  * \name Usage page 0x07
49  *
50  * These values are from usage page 0x07 (USB keyboard page).
51  */
52  /* @{ */
53 
80 
91 
97 
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  */
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  */
150 
152 
165 
169  SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
170  does send code 73, not 117) */
180 
181  SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards
182  */
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. */
232  SDL_SCANCODE_AGAIN = 121, /**< redo */
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, */
247 
248  SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see
249  footnotes in USB doc */
251  SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
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 */
280 
327 
330  SDL_SCANCODE_LALT = 226, /**< alt, option */
331  SDL_SCANCODE_LGUI = 227, /**< windows, command (apple), meta */
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  */
349  /* @{ */
350 
368 
369  /* @} *//* Usage page 0x0C */
370 
371  /**
372  * \name Walther keys
373  *
374  * These are values that Christian Walther added (for mac keyboard?).
375  */
376  /* @{ */
377 
380  SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
381  switch, video mode switch */
387 
390 
391  /* @} *//* Walther keys */
392 
393  /**
394  * \name Usage page 0x0C (additional media keys)
395  *
396  * These values are mapped from usage page 0x0C (USB consumer page).
397  */
398  /* @{ */
399 
402 
403  /* @} *//* Usage page 0x0C (additional media keys) */
404 
405  /* Add any other keys here. */
406 
407  SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
408  for array bounds */
409 } SDL_Scancode;
410 
411 #endif /* SDL_scancode_h_ */
412 
413 /* vi: set ts=4 sw=4 expandtab: */
SDL_Scancode
The SDL keyboard scancode representation.
Definition: SDL_scancode.h:43