comparison include/SDL_keysym.h @ 2268:4baee598306d

Date: Thu, 05 Jul 2007 14:02:33 -0700 From: Sam Lantinga Subject: SDL 1.3 keyboard plan After lots of discussion with Christian, this is what we came up with: > So, to sum up... > SDLK_* become the physical keys, starting at > (1<<21) > We create a macro SDLK_INDEX(X) > We have two functions SDL_GetLayoutKey(SDLKey) and SDL_GetKeyName() > SDL_GetLayoutKey maps to UCS4 for printable characters, and SDLK* for non-printable characters > and does so based on the OS's current keyboard layout > SDL_GetKeyName() handles both SDLK_* and UCS4, converting UCS4 to UTF-8 and converting SDLK_* into our names, which are UTF-8 for printable characters. > WASD folks use SDLK_*, and 'I' folks use SDL_GetLayoutKey(SDLK_*) Here is the patch he came up with, and his e-mail about it: Date: Fri, 17 Aug 2007 19:50:28 +0200 From: Christian Walther Subject: Re: SDL 1.3 keyboard plan > Sounds great, go ahead and send me a patch. Here goes! Thanks for having a look. Don't hesitate to comment if anything does not conform to your ideas. One caveat: Committing this now may break compilability of some video drivers - specifically, if they use any of the SDLK_* codes that were obsoleted and moved into SDL_compat.h. I only tried Cocoa (which did break, but is already fixed) and X11 (which didn't, but then its key handling is #iffed out). If that's a problem, it may need to go into a branch. -Christian
author Sam Lantinga <slouken@libsdl.org>
date Sun, 19 Aug 2007 14:52:52 +0000
parents c121d94672cb
children dbc6d1893869
comparison
equal deleted inserted replaced
2267:c785543d1843 2268:4baee598306d
25 */ 25 */
26 26
27 #ifndef _SDL_keysym_h 27 #ifndef _SDL_keysym_h
28 #define _SDL_keysym_h 28 #define _SDL_keysym_h
29 29
30 #include "SDL_stdinc.h"
31
30 /** 32 /**
31 * \enum SDLKey 33 * \typedef SDLKey
32 * 34 *
33 * \brief The SDL virtual key representation 35 * \brief The SDL virtual key representation.
34 * 36 *
35 * The SDLKey represents the unmodified character printed on the key 37 * Values of this type are used to represent keyboard keys, among other places
36 * for the current keyboard layout. The first 255 characters are used 38 * in the \link SDL_keysym::sym key.keysym.sym \endlink field of the SDL_Event
37 * unchanged from Latin-1, e.g. a key with 'a' on it will have the value "a". 39 * structure.
38 * The rest of the keys are named below, and fall into the range above 255. 40 *
41 * There are two fundamental ways of referring to a key: First, a certain code
42 * can stand for a key at a specific physical location on the keyboard,
43 * independent of its label or what character it generates. These are the \e
44 * physical key codes, comparable to the raw hardware scancodes that a keyboard
45 * generates. Second, a code can refer to a key with a specific label,
46 * generating a specific character or performing a specific function, which may
47 * be located at different places on the keyboard, or not exist at all,
48 * depending on what keyboard layout is used. These are \e layout key codes.
49 *
50 * There is a certain overlap between the sets of physical key codes and layout
51 * key codes: \e return, \e tab, \e ctrl etc. are typically independent of the
52 * keyboard layout and can be thought of as either a physical or a layout key.
53 * Therefore, rather than having separate types with separate sets of constants
54 * for physical keys and layout keys, a single type ::SDLKey is used for both
55 * sets. The physical key codes (forming a well-known set of a few hundred
56 * elements) are enumerated in enum ::SDLPhysicalKey. The set of layout key
57 * codes is more diverse: For keys that don't generate characters, the layout
58 * key code is equal to the physical key code, i.e. the same SDLK_* constants
59 * from enum ::SDLPhysicalKey are used. For character keys, the layout key code
60 * is equal to the Unicode code point of the character that is generated when
61 * the key is pressed without shift or any other modifiers (for ASCII
62 * characters, this can be directly written as a character literal like
63 * <tt>'x'</tt>).
64 *
65 * The \link SDL_keysym::sym key.keysym.sym \endlink field of the SDL_Event
66 * structure is always a physical key code. To get the layout key code for the
67 * event, run that physical key code through SDL_GetLayoutKey(), which converts
68 * it to a layout key code according to the current keyboard layout settings of
69 * the OS. In particular, this is what should be done when displaying the name
70 * of a key to the user: use
71 * <tt>SDL_GetKeyName(SDL_GetLayoutKey(myPhysicalKeyCode))</tt>. Do not use
72 * SDL_GetKeyName() directly on a physical key code (except for debugging
73 * purposes), as the name returned by that will not correspond to how the key
74 * is labeled on the user's keyboard.
75 *
76 * \par Example:
77 * To implement WASD directional keys, it makes sense to use physical key
78 * codes, so that the "forward" key will be above the "backward" key even
79 * though, for example, it's labeled "Z", not "W", on a French keyboard:
80 * \code
81 * print("To go forward, press the %s key.", SDL_GetKeyName(SDL_GetLayoutKey(SDLK_W)));
82 * ...
83 * switch (event.key.keysym.sym) {
84 * case SDLK_W:
85 * forward();
86 * break;
87 * case SDLK_A:
88 * left();
89 * break;
90 * ...
91 * }
92 * \endcode
93 * For keys based on mnemonics like "I for inventory" or "Z for zoom", use
94 * layout key codes, so that the key labeled "Z" will zoom, whether it's at the
95 * bottom left of the keyboard like on a US layout, or in the upper center like
96 * on a German layout (but keep in mind that this forces your users to use a
97 * keyboard layout where there \e is an I or Z key):
98 * \code
99 * print("To open the inventory, press the %s key.", SDL_GetKeyName('i'));
100 * ...
101 * switch (SDL_GetLayoutKey(event.key.keysym.sym)) {
102 * case 'i':
103 * inventory();
104 * break;
105 * case 'z':
106 * zoom();
107 * break;
108 * ...
109 * }
110 * \endcode
111 * Of course, in a real application, you should not hardcode your key
112 * assignments like this, but make them user-configurable.
39 */ 113 */
40 typedef enum 114 typedef Uint32 SDLKey;
115
116 #define SDL_KEY_CAN_BE_PHYSICAL_BIT (1<<24) /* marks SDLKeys from the "physical" set (some of these are also in the "layout" set) */
117 #define SDL_KEY_KEYPAD_BIT (1<<25) /* marks keypad keys that need [] around their name to distinguish them from the corresponding keyboard keys */
118 #define SDL_KEY_LAYOUT_SPECIAL_BIT (1<<26) /* marks non-physical layout keys that cannot be described by a single character */
119
120 /** Converts an \link ::SDLPhysicalKey SDLK_* \endlink constant to an index into the array obtained from SDL_GetKeyState(). */
121 #define SDLK_INDEX(k) ((k) & 0x00FFFFFF)
122
123 #define SDL_PHYSICAL_KEY(n) ((n) | SDL_KEY_CAN_BE_PHYSICAL_BIT)
124
125 /**
126 * \brief SDL physical key codes.
127 *
128 * This is the set of physical key codes, i.e. the values of SDL_keysym::sym.
129 * Some of them (those for non-character keys) also appear as layout key codes.
130 * The constants are typically named after how the key would be labeled on a US
131 * keyboard, e.g. SDLK_A or SDLK_LEFTBRACKET refer to the keys used as A and [
132 * on a US layout, but used as Q and ^ on a French layout.
133 *
134 * <em>enum SDLPhysicalKey</em> is not a useful type in its own right - the
135 * constants defined here are intended as values of the ::SDLKey type. The only
136 * reason for the enum to have a name at all is that otherwise it would be
137 * impossible to refer to it in the documentation.
138 *
139 * \sa SDLKey
140 *
141 * \par Notes for driver implementors:
142 * These constants and their numerical values are based on the USB HID usage
143 * tables, version 1.12
144 * <http://www.usb.org/developers/devclass_docs/Hut1_12.pdf>, section "10
145 * Keyboard/Keypad Page (0x07)". When deciding what code to generate for what
146 * key, the following rules can be used as guidelines:
147 * - A given key on a given keyboard should produce the same SDLK_* code, no
148 * matter what computer it is connected to, what OS runs on that computer, and
149 * what the keyboard layout settings in the OS are. For USB keyboards, that
150 * should be the code numerically corresponding to the key's USB usage code
151 * (with exceptions, see comments for specific constants).
152 * - Two keys on two different keyboards are considered "the same key" and
153 * should generate the same SDLK_* code if, when connected to the same
154 * computer, they are treated equally by the OS. For USB keyboards, that's
155 * generally the case when they generate the same USB usage code. Non-USB
156 * keyboards can probably be treated like USB keyboards of the same layout, if
157 * such exist. If not, and there's no possibility to determine the equivalence
158 * relation by transitivity from the above - in particular, on devices like
159 * phones or game consoles that don't have PC-style alphabetic keyboards -
160 * apply common sense. If none of the predefined codes fit, insert new ones at
161 * the end.
162 */
163 enum SDLPhysicalKey
41 { 164 {
42 /* The keyboard syms have been cleverly chosen to map to ASCII */ 165 SDLK_FIRST_PHYSICAL = 0, /**< (not a key, just marks the lowest used value in this enum) */
43 SDLK_UNKNOWN = 0, 166 SDLK_NONE = SDL_PHYSICAL_KEY(0),
44 SDLK_FIRST = 0, 167 SDLK_UNKNOWN = SDL_PHYSICAL_KEY(1), /* Not from the USB spec, but this is a convenient place for it */
45 SDLK_BACKSPACE = 8, 168
46 SDLK_TAB = 9, 169 SDLK_A = SDL_PHYSICAL_KEY(4),
47 SDLK_CLEAR = 12, 170 SDLK_B = SDL_PHYSICAL_KEY(5),
48 SDLK_RETURN = 13, 171 SDLK_C = SDL_PHYSICAL_KEY(6),
49 SDLK_PAUSE = 19, 172 SDLK_D = SDL_PHYSICAL_KEY(7),
50 SDLK_ESCAPE = 27, 173 SDLK_E = SDL_PHYSICAL_KEY(8),
51 SDLK_SPACE = 32, 174 SDLK_F = SDL_PHYSICAL_KEY(9),
52 SDLK_EXCLAIM = 33, 175 SDLK_G = SDL_PHYSICAL_KEY(10),
53 SDLK_QUOTEDBL = 34, 176 SDLK_H = SDL_PHYSICAL_KEY(11),
54 SDLK_HASH = 35, 177 SDLK_I = SDL_PHYSICAL_KEY(12),
55 SDLK_DOLLAR = 36, 178 SDLK_J = SDL_PHYSICAL_KEY(13),
56 SDLK_AMPERSAND = 38, 179 SDLK_K = SDL_PHYSICAL_KEY(14),
57 SDLK_QUOTE = 39, 180 SDLK_L = SDL_PHYSICAL_KEY(15),
58 SDLK_LEFTPAREN = 40, 181 SDLK_M = SDL_PHYSICAL_KEY(16),
59 SDLK_RIGHTPAREN = 41, 182 SDLK_N = SDL_PHYSICAL_KEY(17),
60 SDLK_ASTERISK = 42, 183 SDLK_O = SDL_PHYSICAL_KEY(18),
61 SDLK_PLUS = 43, 184 SDLK_P = SDL_PHYSICAL_KEY(19),
62 SDLK_COMMA = 44, 185 SDLK_Q = SDL_PHYSICAL_KEY(20),
63 SDLK_MINUS = 45, 186 SDLK_R = SDL_PHYSICAL_KEY(21),
64 SDLK_PERIOD = 46, 187 SDLK_S = SDL_PHYSICAL_KEY(22),
65 SDLK_SLASH = 47, 188 SDLK_T = SDL_PHYSICAL_KEY(23),
66 SDLK_0 = 48, 189 SDLK_U = SDL_PHYSICAL_KEY(24),
67 SDLK_1 = 49, 190 SDLK_V = SDL_PHYSICAL_KEY(25),
68 SDLK_2 = 50, 191 SDLK_W = SDL_PHYSICAL_KEY(26),
69 SDLK_3 = 51, 192 SDLK_X = SDL_PHYSICAL_KEY(27),
70 SDLK_4 = 52, 193 SDLK_Y = SDL_PHYSICAL_KEY(28),
71 SDLK_5 = 53, 194 SDLK_Z = SDL_PHYSICAL_KEY(29),
72 SDLK_6 = 54, 195
73 SDLK_7 = 55, 196 SDLK_1 = SDL_PHYSICAL_KEY(30),
74 SDLK_8 = 56, 197 SDLK_2 = SDL_PHYSICAL_KEY(31),
75 SDLK_9 = 57, 198 SDLK_3 = SDL_PHYSICAL_KEY(32),
76 SDLK_COLON = 58, 199 SDLK_4 = SDL_PHYSICAL_KEY(33),
77 SDLK_SEMICOLON = 59, 200 SDLK_5 = SDL_PHYSICAL_KEY(34),
78 SDLK_LESS = 60, 201 SDLK_6 = SDL_PHYSICAL_KEY(35),
79 SDLK_EQUALS = 61, 202 SDLK_7 = SDL_PHYSICAL_KEY(36),
80 SDLK_GREATER = 62, 203 SDLK_8 = SDL_PHYSICAL_KEY(37),
81 SDLK_QUESTION = 63, 204 SDLK_9 = SDL_PHYSICAL_KEY(38),
82 SDLK_AT = 64, 205 SDLK_0 = SDL_PHYSICAL_KEY(39),
83 /* 206
84 Skip uppercase letters 207 SDLK_RETURN = SDL_PHYSICAL_KEY(40),
85 */ 208 SDLK_ESCAPE = SDL_PHYSICAL_KEY(41),
86 SDLK_LEFTBRACKET = 91, 209 SDLK_BACKSPACE = SDL_PHYSICAL_KEY(42),
87 SDLK_BACKSLASH = 92, 210 SDLK_TAB = SDL_PHYSICAL_KEY(43),
88 SDLK_RIGHTBRACKET = 93, 211 SDLK_SPACE = SDL_PHYSICAL_KEY(44),
89 SDLK_CARET = 94, 212
90 SDLK_UNDERSCORE = 95, 213 SDLK_HYPHENMINUS = SDL_PHYSICAL_KEY(45),
91 SDLK_BACKQUOTE = 96, 214 SDLK_EQUALS = SDL_PHYSICAL_KEY(46),
92 SDLK_a = 97, 215 SDLK_LEFTBRACKET = SDL_PHYSICAL_KEY(47),
93 SDLK_b = 98, 216 SDLK_RIGHTBRACKET = SDL_PHYSICAL_KEY(48),
94 SDLK_c = 99, 217 SDLK_BACKSLASH = SDL_PHYSICAL_KEY(49), /**< Located at the lower left of the return key on ISO keyboards and at the right end of the QWERTY row on ANSI keyboards. Produces REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US layout, REVERSE SOLIDUS and VERTICAL LINE in a UK Mac layout, NUMBER SIGN and TILDE in a UK Windows layout, DOLLAR SIGN and POUND SIGN in a Swiss German layout, NUMBER SIGN and APOSTROPHE in a German layout, GRAVE ACCENT and POUND SIGN in a French Mac layout, and ASTERISK and MICRO SIGN in a French Windows layout. */
95 SDLK_d = 100, 218 SDLK_NONUSHASH = SDL_PHYSICAL_KEY(50), /**< ISO USB keyboards actually use this code instead of 49 for the same key, but all OSes I've seen treat the two codes identically. So, as an implementor, unless your keyboard generates both of those codes and your OS treats them differently, you should generate SDLK_BACKSLASH instead of this code. As a user, you should not rely on this code because SDL will never generate it with most (all?) keyboards. */
96 SDLK_e = 101, 219 SDLK_SEMICOLON = SDL_PHYSICAL_KEY(51),
97 SDLK_f = 102, 220 SDLK_APOSTROPHE = SDL_PHYSICAL_KEY(52),
98 SDLK_g = 103, 221 SDLK_GRAVE = SDL_PHYSICAL_KEY(53), /**< Located in the top left corner (on both ANSI and ISO keyboards). Produces GRAVE ACCENT and TILDE in a US Windows layout and in US and UK Mac layouts on ANSI keyboards, GRAVE ACCENT and NOT SIGN in a UK Windows layout, SECTION SIGN and PLUS-MINUS SIGN in US and UK Mac layouts on ISO keyboards, SECTION SIGN and DEGREE SIGN in a Swiss German layout (Mac: only on ISO keyboards), CIRCUMFLEX ACCENT and DEGREE SIGN in a German layout (Mac: only on ISO keyboards), SUPERSCRIPT TWO and TILDE in a French Windows layout, COMMERCIAL AT and NUMBER SIGN in a French Mac layout on ISO keyboards, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French Mac layout on ANSI keyboards. */
99 SDLK_h = 104, 222 SDLK_COMMA = SDL_PHYSICAL_KEY(54),
100 SDLK_i = 105, 223 SDLK_PERIOD = SDL_PHYSICAL_KEY(55),
101 SDLK_j = 106, 224 SDLK_SLASH = SDL_PHYSICAL_KEY(56),
102 SDLK_k = 107, 225
103 SDLK_l = 108, 226 SDLK_CAPSLOCK = SDL_PHYSICAL_KEY(57),
104 SDLK_m = 109, 227
105 SDLK_n = 110, 228 SDLK_F1 = SDL_PHYSICAL_KEY(58),
106 SDLK_o = 111, 229 SDLK_F2 = SDL_PHYSICAL_KEY(59),
107 SDLK_p = 112, 230 SDLK_F3 = SDL_PHYSICAL_KEY(60),
108 SDLK_q = 113, 231 SDLK_F4 = SDL_PHYSICAL_KEY(61),
109 SDLK_r = 114, 232 SDLK_F5 = SDL_PHYSICAL_KEY(62),
110 SDLK_s = 115, 233 SDLK_F6 = SDL_PHYSICAL_KEY(63),
111 SDLK_t = 116, 234 SDLK_F7 = SDL_PHYSICAL_KEY(64),
112 SDLK_u = 117, 235 SDLK_F8 = SDL_PHYSICAL_KEY(65),
113 SDLK_v = 118, 236 SDLK_F9 = SDL_PHYSICAL_KEY(66),
114 SDLK_w = 119, 237 SDLK_F10 = SDL_PHYSICAL_KEY(67),
115 SDLK_x = 120, 238 SDLK_F11 = SDL_PHYSICAL_KEY(68),
116 SDLK_y = 121, 239 SDLK_F12 = SDL_PHYSICAL_KEY(69),
117 SDLK_z = 122, 240
118 SDLK_DELETE = 127, 241 SDLK_PRINTSCREEN = SDL_PHYSICAL_KEY(70),
119 /* End of ASCII mapped keysyms */ 242 SDLK_SCROLLLOCK = SDL_PHYSICAL_KEY(71),
120 243 SDLK_PAUSE = SDL_PHYSICAL_KEY(72),
121 /* Numeric keypad */ 244 SDLK_INSERT = SDL_PHYSICAL_KEY(73), /**< insert on PC, help on some Mac keyboards (but does send code 73, not 117) */
122 SDLK_KP0 = 256, 245 SDLK_HOME = SDL_PHYSICAL_KEY(74),
123 SDLK_KP1 = 257, 246 SDLK_PAGEUP = SDL_PHYSICAL_KEY(75),
124 SDLK_KP2 = 258, 247 SDLK_DELETE = SDL_PHYSICAL_KEY(76),
125 SDLK_KP3 = 259, 248 SDLK_END = SDL_PHYSICAL_KEY(77),
126 SDLK_KP4 = 260, 249 SDLK_PAGEDOWN = SDL_PHYSICAL_KEY(78),
127 SDLK_KP5 = 261, 250 SDLK_RIGHT = SDL_PHYSICAL_KEY(79),
128 SDLK_KP6 = 262, 251 SDLK_LEFT = SDL_PHYSICAL_KEY(80),
129 SDLK_KP7 = 263, 252 SDLK_DOWN = SDL_PHYSICAL_KEY(81),
130 SDLK_KP8 = 264, 253 SDLK_UP = SDL_PHYSICAL_KEY(82),
131 SDLK_KP9 = 265, 254
132 SDLK_KP_PERIOD = 266, 255 SDLK_KP_NUMLOCKCLEAR = SDL_PHYSICAL_KEY(83), /**< num lock on PC, clear on Mac keyboards */
133 SDLK_KP_DIVIDE = 267, 256 SDLK_KP_DIVIDE = SDL_PHYSICAL_KEY(84) | SDL_KEY_KEYPAD_BIT,
134 SDLK_KP_MULTIPLY = 268, 257 SDLK_KP_MULTIPLY = SDL_PHYSICAL_KEY(85) | SDL_KEY_KEYPAD_BIT,
135 SDLK_KP_MINUS = 269, 258 SDLK_KP_MINUS = SDL_PHYSICAL_KEY(86) | SDL_KEY_KEYPAD_BIT,
136 SDLK_KP_PLUS = 270, 259 SDLK_KP_PLUS = SDL_PHYSICAL_KEY(87) | SDL_KEY_KEYPAD_BIT,
137 SDLK_KP_ENTER = 271, 260 SDLK_KP_ENTER = SDL_PHYSICAL_KEY(88),
138 SDLK_KP_EQUALS = 272, 261 SDLK_KP_1 = SDL_PHYSICAL_KEY(89) | SDL_KEY_KEYPAD_BIT,
139 262 SDLK_KP_2 = SDL_PHYSICAL_KEY(90) | SDL_KEY_KEYPAD_BIT,
140 /* Arrows + Home/End pad */ 263 SDLK_KP_3 = SDL_PHYSICAL_KEY(91) | SDL_KEY_KEYPAD_BIT,
141 SDLK_UP = 273, 264 SDLK_KP_4 = SDL_PHYSICAL_KEY(92) | SDL_KEY_KEYPAD_BIT,
142 SDLK_DOWN = 274, 265 SDLK_KP_5 = SDL_PHYSICAL_KEY(93) | SDL_KEY_KEYPAD_BIT,
143 SDLK_RIGHT = 275, 266 SDLK_KP_6 = SDL_PHYSICAL_KEY(94) | SDL_KEY_KEYPAD_BIT,
144 SDLK_LEFT = 276, 267 SDLK_KP_7 = SDL_PHYSICAL_KEY(95) | SDL_KEY_KEYPAD_BIT,
145 SDLK_INSERT = 277, 268 SDLK_KP_8 = SDL_PHYSICAL_KEY(96) | SDL_KEY_KEYPAD_BIT,
146 SDLK_HOME = 278, 269 SDLK_KP_9 = SDL_PHYSICAL_KEY(97) | SDL_KEY_KEYPAD_BIT,
147 SDLK_END = 279, 270 SDLK_KP_0 = SDL_PHYSICAL_KEY(98) | SDL_KEY_KEYPAD_BIT,
148 SDLK_PAGEUP = 280, 271 SDLK_KP_PERIOD = SDL_PHYSICAL_KEY(99) | SDL_KEY_KEYPAD_BIT,
149 SDLK_PAGEDOWN = 281, 272
150 273 SDLK_NONUSBACKSLASH = SDL_PHYSICAL_KEY(100), /**< This is the additional key that ISO keyboards have over ANSI ones, located between left shift and Y. Produces GRAVE ACCENT and TILDE in a US or UK Mac layout, REVERSE SOLIDUS (backslash) and VERTICAL LINE in a US or UK Windows layout, and LESS-THAN SIGN and GREATER-THAN SIGN in a Swiss German, German, or French layout. */
151 /* Function keys */ 274 SDLK_APPLICATION = SDL_PHYSICAL_KEY(101), /**< windows contextual menu, compose */
152 SDLK_F1 = 282, 275 SDLK_POWER = SDL_PHYSICAL_KEY(102), /**< The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key. */
153 SDLK_F2 = 283, 276 SDLK_KP_EQUALS = SDL_PHYSICAL_KEY(103) | SDL_KEY_KEYPAD_BIT,
154 SDLK_F3 = 284, 277 SDLK_F13 = SDL_PHYSICAL_KEY(104),
155 SDLK_F4 = 285, 278 SDLK_F14 = SDL_PHYSICAL_KEY(105),
156 SDLK_F5 = 286, 279 SDLK_F15 = SDL_PHYSICAL_KEY(106),
157 SDLK_F6 = 287, 280 SDLK_F16 = SDL_PHYSICAL_KEY(107),
158 SDLK_F7 = 288, 281 SDLK_F17 = SDL_PHYSICAL_KEY(108),
159 SDLK_F8 = 289, 282 SDLK_F18 = SDL_PHYSICAL_KEY(109),
160 SDLK_F9 = 290, 283 SDLK_F19 = SDL_PHYSICAL_KEY(110),
161 SDLK_F10 = 291, 284 SDLK_F20 = SDL_PHYSICAL_KEY(111),
162 SDLK_F11 = 292, 285 SDLK_F21 = SDL_PHYSICAL_KEY(112),
163 SDLK_F12 = 293, 286 SDLK_F22 = SDL_PHYSICAL_KEY(113),
164 SDLK_F13 = 294, 287 SDLK_F23 = SDL_PHYSICAL_KEY(114),
165 SDLK_F14 = 295, 288 SDLK_F24 = SDL_PHYSICAL_KEY(115),
166 SDLK_F15 = 296, 289 SDLK_EXECUTE = SDL_PHYSICAL_KEY(116),
167 290 SDLK_HELP = SDL_PHYSICAL_KEY(117),
168 /* Key state modifier keys */ 291 SDLK_MENU = SDL_PHYSICAL_KEY(118),
169 SDLK_NUMLOCK = 300, 292 SDLK_SELECT = SDL_PHYSICAL_KEY(119),
170 SDLK_CAPSLOCK = 301, 293 SDLK_STOP = SDL_PHYSICAL_KEY(120),
171 SDLK_SCROLLOCK = 302, 294 SDLK_AGAIN = SDL_PHYSICAL_KEY(121), /*!< redo */
172 SDLK_RSHIFT = 303, 295 SDLK_UNDO = SDL_PHYSICAL_KEY(122),
173 SDLK_LSHIFT = 304, 296 SDLK_CUT = SDL_PHYSICAL_KEY(123),
174 SDLK_RCTRL = 305, 297 SDLK_COPY = SDL_PHYSICAL_KEY(124),
175 SDLK_LCTRL = 306, 298 SDLK_PASTE = SDL_PHYSICAL_KEY(125),
176 SDLK_RALT = 307, 299 SDLK_FIND = SDL_PHYSICAL_KEY(126),
177 SDLK_LALT = 308, 300 SDLK_MUTE = SDL_PHYSICAL_KEY(127),
178 SDLK_RMETA = 309, 301 SDLK_VOLUMEUP = SDL_PHYSICAL_KEY(128),
179 SDLK_LMETA = 310, 302 SDLK_VOLUMEDOWN = SDL_PHYSICAL_KEY(129),
180 SDLK_LSUPER = 311, /**< Left "Windows" key */ 303 /*SDLK_LOCKINGCAPSLOCK = SDL_PHYSICAL_KEY(130), not sure whether there's a reason to enable these
181 SDLK_RSUPER = 312, /**< Right "Windows" key */ 304 SDLK_LOCKINGNUMLOCK = SDL_PHYSICAL_KEY(131),
182 SDLK_MODE = 313, /**< "Alt Gr" key */ 305 SDLK_LOCKINGSCROLLLOCK = SDL_PHYSICAL_KEY(132), */
183 SDLK_COMPOSE = 314, /**< Multi-key compose key */ 306 SDLK_KP_COMMA = SDL_PHYSICAL_KEY(133) | SDL_KEY_KEYPAD_BIT,
184 307 SDLK_KP_EQUALSAS400 = SDL_PHYSICAL_KEY(134) | SDL_KEY_KEYPAD_BIT,
185 /* Miscellaneous function keys */ 308
186 SDLK_HELP = 315, 309 SDLK_INTERNATIONAL1 = SDL_PHYSICAL_KEY(135), /**< used on Asian keyboards, see footnotes in USB doc */
187 SDLK_PRINT = 316, 310 SDLK_INTERNATIONAL2 = SDL_PHYSICAL_KEY(136),
188 SDLK_SYSREQ = 317, 311 SDLK_INTERNATIONAL3 = SDL_PHYSICAL_KEY(137), /**< Yen */
189 SDLK_BREAK = 318, 312 SDLK_INTERNATIONAL4 = SDL_PHYSICAL_KEY(138),
190 SDLK_MENU = 319, 313 SDLK_INTERNATIONAL5 = SDL_PHYSICAL_KEY(139),
191 SDLK_POWER = 320, /**< Power Macintosh power key */ 314 SDLK_INTERNATIONAL6 = SDL_PHYSICAL_KEY(140),
192 SDLK_EURO = 321, /**< Some european keyboards */ 315 SDLK_INTERNATIONAL7 = SDL_PHYSICAL_KEY(141),
193 SDLK_UNDO = 322, /**< Atari keyboard has Undo */ 316 SDLK_INTERNATIONAL8 = SDL_PHYSICAL_KEY(142),
317 SDLK_INTERNATIONAL9 = SDL_PHYSICAL_KEY(143),
318 SDLK_LANG1 = SDL_PHYSICAL_KEY(144), /**< Hangul/English toggle */
319 SDLK_LANG2 = SDL_PHYSICAL_KEY(145), /**< Hanja conversion */
320 SDLK_LANG3 = SDL_PHYSICAL_KEY(146), /**< Katakana */
321 SDLK_LANG4 = SDL_PHYSICAL_KEY(147), /**< Hiragana */
322 SDLK_LANG5 = SDL_PHYSICAL_KEY(148), /**< Zenkaku/Hankaku */
323 SDLK_LANG6 = SDL_PHYSICAL_KEY(149), /**< reserved */
324 SDLK_LANG7 = SDL_PHYSICAL_KEY(150), /**< reserved */
325 SDLK_LANG8 = SDL_PHYSICAL_KEY(151), /**< reserved */
326 SDLK_LANG9 = SDL_PHYSICAL_KEY(152), /**< reserved */
327
328 SDLK_ALTERASE = SDL_PHYSICAL_KEY(153), /**< Erase-Eaze */
329 SDLK_SYSREQ = SDL_PHYSICAL_KEY(154),
330 SDLK_CANCEL = SDL_PHYSICAL_KEY(155),
331 SDLK_CLEAR = SDL_PHYSICAL_KEY(156),
332 SDLK_PRIOR = SDL_PHYSICAL_KEY(157),
333 SDLK_RETURN2 = SDL_PHYSICAL_KEY(158),
334 SDLK_SEPARATOR = SDL_PHYSICAL_KEY(159),
335 SDLK_OUT = SDL_PHYSICAL_KEY(160),
336 SDLK_OPER = SDL_PHYSICAL_KEY(161),
337 SDLK_CLEARAGAIN = SDL_PHYSICAL_KEY(162),
338 SDLK_CRSELPROPS = SDL_PHYSICAL_KEY(163),
339 SDLK_EXSEL = SDL_PHYSICAL_KEY(164),
340
341 SDLK_KP_00 = SDL_PHYSICAL_KEY(176) | SDL_KEY_KEYPAD_BIT,
342 SDLK_KP_000 = SDL_PHYSICAL_KEY(177) | SDL_KEY_KEYPAD_BIT,
343 SDLK_THOUSANDSSEPARATOR = SDL_PHYSICAL_KEY(178),
344 SDLK_DECIMALSEPARATOR = SDL_PHYSICAL_KEY(179),
345 SDLK_CURRENCYUNIT = SDL_PHYSICAL_KEY(180),
346 SDLK_CURRENCYSUBUNIT = SDL_PHYSICAL_KEY(181),
347 SDLK_KP_LEFTPAREN = SDL_PHYSICAL_KEY(182) | SDL_KEY_KEYPAD_BIT,
348 SDLK_KP_RIGHTPAREN = SDL_PHYSICAL_KEY(183) | SDL_KEY_KEYPAD_BIT,
349 SDLK_KP_LEFTBRACE = SDL_PHYSICAL_KEY(184) | SDL_KEY_KEYPAD_BIT,
350 SDLK_KP_RIGHTBRACE = SDL_PHYSICAL_KEY(185) | SDL_KEY_KEYPAD_BIT,
351 SDLK_KP_TAB = SDL_PHYSICAL_KEY(186) | SDL_KEY_KEYPAD_BIT,
352 SDLK_KP_BACKSPACE = SDL_PHYSICAL_KEY(187) | SDL_KEY_KEYPAD_BIT,
353 SDLK_KP_A = SDL_PHYSICAL_KEY(188) | SDL_KEY_KEYPAD_BIT,
354 SDLK_KP_B = SDL_PHYSICAL_KEY(189) | SDL_KEY_KEYPAD_BIT,
355 SDLK_KP_C = SDL_PHYSICAL_KEY(190) | SDL_KEY_KEYPAD_BIT,
356 SDLK_KP_D = SDL_PHYSICAL_KEY(191) | SDL_KEY_KEYPAD_BIT,
357 SDLK_KP_E = SDL_PHYSICAL_KEY(192) | SDL_KEY_KEYPAD_BIT,
358 SDLK_KP_F = SDL_PHYSICAL_KEY(193) | SDL_KEY_KEYPAD_BIT,
359 SDLK_KP_XOR = SDL_PHYSICAL_KEY(194) | SDL_KEY_KEYPAD_BIT,
360 SDLK_KP_POWER = SDL_PHYSICAL_KEY(195) | SDL_KEY_KEYPAD_BIT,
361 SDLK_KP_PERCENT = SDL_PHYSICAL_KEY(196) | SDL_KEY_KEYPAD_BIT,
362 SDLK_KP_LESS = SDL_PHYSICAL_KEY(197) | SDL_KEY_KEYPAD_BIT,
363 SDLK_KP_GREATER = SDL_PHYSICAL_KEY(198) | SDL_KEY_KEYPAD_BIT,
364 SDLK_KP_AMPERSAND = SDL_PHYSICAL_KEY(199) | SDL_KEY_KEYPAD_BIT,
365 SDLK_KP_DBLAMPERSAND = SDL_PHYSICAL_KEY(200) | SDL_KEY_KEYPAD_BIT,
366 SDLK_KP_VERTICALBAR = SDL_PHYSICAL_KEY(201) | SDL_KEY_KEYPAD_BIT,
367 SDLK_KP_DBLVERTICALBAR = SDL_PHYSICAL_KEY(202) | SDL_KEY_KEYPAD_BIT,
368 SDLK_KP_COLON = SDL_PHYSICAL_KEY(203) | SDL_KEY_KEYPAD_BIT,
369 SDLK_KP_HASH = SDL_PHYSICAL_KEY(204) | SDL_KEY_KEYPAD_BIT,
370 SDLK_KP_SPACE = SDL_PHYSICAL_KEY(205) | SDL_KEY_KEYPAD_BIT,
371 SDLK_KP_AT = SDL_PHYSICAL_KEY(206) | SDL_KEY_KEYPAD_BIT,
372 SDLK_KP_EXCLAM = SDL_PHYSICAL_KEY(207) | SDL_KEY_KEYPAD_BIT,
373 SDLK_KP_MEMSTORE = SDL_PHYSICAL_KEY(208) | SDL_KEY_KEYPAD_BIT,
374 SDLK_KP_MEMRECALL = SDL_PHYSICAL_KEY(209) | SDL_KEY_KEYPAD_BIT,
375 SDLK_KP_MEMCLEAR = SDL_PHYSICAL_KEY(210) | SDL_KEY_KEYPAD_BIT,
376 SDLK_KP_MEMADD = SDL_PHYSICAL_KEY(211) | SDL_KEY_KEYPAD_BIT,
377 SDLK_KP_MEMSUBTRACT = SDL_PHYSICAL_KEY(212) | SDL_KEY_KEYPAD_BIT,
378 SDLK_KP_MEMMULTIPLY = SDL_PHYSICAL_KEY(213) | SDL_KEY_KEYPAD_BIT,
379 SDLK_KP_MEMDIVIDE = SDL_PHYSICAL_KEY(214) | SDL_KEY_KEYPAD_BIT,
380 SDLK_KP_PLUSMINUS = SDL_PHYSICAL_KEY(215) | SDL_KEY_KEYPAD_BIT,
381 SDLK_KP_CLEAR = SDL_PHYSICAL_KEY(216) | SDL_KEY_KEYPAD_BIT,
382 SDLK_KP_CLEARENTRY = SDL_PHYSICAL_KEY(217) | SDL_KEY_KEYPAD_BIT,
383 SDLK_KP_BINARY = SDL_PHYSICAL_KEY(218) | SDL_KEY_KEYPAD_BIT,
384 SDLK_KP_OCTAL = SDL_PHYSICAL_KEY(219) | SDL_KEY_KEYPAD_BIT,
385 SDLK_KP_DECIMAL = SDL_PHYSICAL_KEY(220) | SDL_KEY_KEYPAD_BIT,
386 SDLK_KP_HEXADECIMAL = SDL_PHYSICAL_KEY(221) | SDL_KEY_KEYPAD_BIT,
387
388 SDLK_LCTRL = SDL_PHYSICAL_KEY(224),
389 SDLK_LSHIFT = SDL_PHYSICAL_KEY(225),
390 SDLK_LALT = SDL_PHYSICAL_KEY(226), /**< alt, option */
391 SDLK_LMETA = SDL_PHYSICAL_KEY(227), /**< windows, command (apple), meta */
392 SDLK_RCTRL = SDL_PHYSICAL_KEY(228),
393 SDLK_RSHIFT = SDL_PHYSICAL_KEY(229),
394 SDLK_RALT = SDL_PHYSICAL_KEY(230), /**< alt gr, option */
395 SDLK_RMETA = SDL_PHYSICAL_KEY(231), /**< windows, command (apple), meta */
396
397 /* Everything below here is not from the USB spec */
398
399 SDLK_MODE = SDL_PHYSICAL_KEY(232), /* I'm not sure if this is really not covered by any of the above, but since there's a special KMOD_MODE for it I'm adding it here */
400
401 SDLK_BRIGHTNESSDOWN = SDL_PHYSICAL_KEY(236),
402 SDLK_BRIGHTNESSUP = SDL_PHYSICAL_KEY(237),
403 SDLK_DISPLAYSWITCH = SDL_PHYSICAL_KEY(238), /**< display mirroring/dual display switch, video mode switch */
404 SDLK_KBDILLUMTOGGLE = SDL_PHYSICAL_KEY(239),
405 SDLK_KBDILLUMDOWN = SDL_PHYSICAL_KEY(240),
406 SDLK_KBDILLUMUP = SDL_PHYSICAL_KEY(241),
407 SDLK_EJECT = SDL_PHYSICAL_KEY(242),
408 SDLK_SLEEP = SDL_PHYSICAL_KEY(243),
409
410 /* Some of the more common and more standardized "multimedia"/"internet" keyboard keys */
411 SDLK_AUDIOPLAY = SDL_PHYSICAL_KEY(244),
412 SDLK_AUDIOSTOP = SDL_PHYSICAL_KEY(245),
413 SDLK_AUDIOPREV = SDL_PHYSICAL_KEY(246),
414 SDLK_AUDIONEXT = SDL_PHYSICAL_KEY(247),
415 SDLK_CALC = SDL_PHYSICAL_KEY(248),
416 SDLK_WWW = SDL_PHYSICAL_KEY(249),
417 SDLK_EMAIL = SDL_PHYSICAL_KEY(250),
418 SDLK_MEDIA = SDL_PHYSICAL_KEY(251),
419 SDLK_COMPUTER = SDL_PHYSICAL_KEY(252),
420 SDLK_SEARCH = SDL_PHYSICAL_KEY(253),
421 SDLK_BOOKMARKS = SDL_PHYSICAL_KEY(254),
422 SDLK_BROWSERBACK = SDL_PHYSICAL_KEY(255),
423 SDLK_BROWSERFORWARD = SDL_PHYSICAL_KEY(256),
424 SDLK_BROWSERRELOAD = SDL_PHYSICAL_KEY(257),
425 SDLK_BROWSERSTOP = SDL_PHYSICAL_KEY(258),
194 426
195 /* Add any other keys here */ 427 /* Add any other keys here */
196 428
197 SDLK_LAST 429 SDLK_LAST_PHYSICAL /**< (not a key, just marks the highest used value in this enum) */
198 } SDLKey; 430 };
431
432 #define SDLK_FIRST SDLK_INDEX(SDLK_FIRST_PHYSICAL)
433 #define SDLK_LAST SDLK_INDEX(SDLK_LAST_PHYSICAL)
434
435
199 436
200 /** 437 /**
201 * \enum SDLMod 438 * \enum SDLMod
202 * 439 *
203 * \brief Enumeration of valid key mods (possibly OR'd together) 440 * \brief Enumeration of valid key mods (possibly OR'd together)