include/SDL_keysym.h
author Bob Pendleton <bob@pendleton.com>
Tue, 08 Jan 2008 00:10:46 +0000
changeset 2295 dbc6d1893869
parent 2268 4baee598306d
child 2303 d87417504c75
permissions -rw-r--r--
Checking in Christian Walther's patch for x11 keyboard input. Minor code tweaks by Bob.
slouken@0
     1
/*
slouken@0
     2
    SDL - Simple DirectMedia Layer
slouken@1312
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@0
     4
slouken@0
     5
    This library is free software; you can redistribute it and/or
slouken@1312
     6
    modify it under the terms of the GNU Lesser General Public
slouken@0
     7
    License as published by the Free Software Foundation; either
slouken@1312
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@0
     9
slouken@0
    10
    This library is distributed in the hope that it will be useful,
slouken@0
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@0
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1312
    13
    Lesser General Public License for more details.
slouken@0
    14
slouken@1312
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1312
    16
    License along with this library; if not, write to the Free Software
slouken@1312
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@0
    18
slouken@0
    19
    Sam Lantinga
slouken@251
    20
    slouken@libsdl.org
slouken@0
    21
*/
slouken@0
    22
slouken@1895
    23
/**
slouken@1895
    24
 * \file SDL_keysym.h
slouken@1895
    25
 */
slouken@1895
    26
slouken@0
    27
#ifndef _SDL_keysym_h
slouken@0
    28
#define _SDL_keysym_h
slouken@0
    29
slouken@2268
    30
#include "SDL_stdinc.h"
slouken@2268
    31
slouken@1895
    32
/**
slouken@2268
    33
 * \typedef SDLKey
slouken@1895
    34
 *
slouken@2268
    35
 * \brief The SDL virtual key representation.
slouken@1895
    36
 *
slouken@2268
    37
 * Values of this type are used to represent keyboard keys, among other places
slouken@2268
    38
 * in the \link SDL_keysym::sym key.keysym.sym \endlink field of the SDL_Event
slouken@2268
    39
 * structure.
slouken@2268
    40
 *
slouken@2268
    41
 * There are two fundamental ways of referring to a key: First, a certain code
slouken@2268
    42
 * can stand for a key at a specific physical location on the keyboard,
slouken@2268
    43
 * independent of its label or what character it generates. These are the \e
slouken@2268
    44
 * physical key codes, comparable to the raw hardware scancodes that a keyboard
slouken@2268
    45
 * generates. Second, a code can refer to a key with a specific label,
slouken@2268
    46
 * generating a specific character or performing a specific function, which may
slouken@2268
    47
 * be located at different places on the keyboard, or not exist at all,
slouken@2268
    48
 * depending on what keyboard layout is used. These are \e layout key codes.
slouken@2268
    49
 *
slouken@2268
    50
 * There is a certain overlap between the sets of physical key codes and layout
slouken@2268
    51
 * key codes: \e return, \e tab, \e ctrl etc. are typically independent of the
slouken@2268
    52
 * keyboard layout and can be thought of as either a physical or a layout key.
slouken@2268
    53
 * Therefore, rather than having separate types with separate sets of constants
slouken@2268
    54
 * for physical keys and layout keys, a single type ::SDLKey is used for both
slouken@2268
    55
 * sets. The physical key codes (forming a well-known set of a few hundred
slouken@2268
    56
 * elements) are enumerated in enum ::SDLPhysicalKey. The set of layout key
slouken@2268
    57
 * codes is more diverse: For keys that don't generate characters, the layout
slouken@2268
    58
 * key code is equal to the physical key code, i.e. the same SDLK_* constants
slouken@2268
    59
 * from enum ::SDLPhysicalKey are used. For character keys, the layout key code
slouken@2268
    60
 * is equal to the Unicode code point of the character that is generated when
slouken@2268
    61
 * the key is pressed without shift or any other modifiers (for ASCII
slouken@2268
    62
 * characters, this can be directly written as a character literal like
slouken@2268
    63
 * <tt>'x'</tt>).
slouken@2268
    64
 *
slouken@2268
    65
 * The \link SDL_keysym::sym key.keysym.sym \endlink field of the SDL_Event
slouken@2268
    66
 * structure is always a physical key code. To get the layout key code for the
slouken@2268
    67
 * event, run that physical key code through SDL_GetLayoutKey(), which converts
slouken@2268
    68
 * it to a layout key code according to the current keyboard layout settings of
slouken@2268
    69
 * the OS. In particular, this is what should be done when displaying the name
slouken@2268
    70
 * of a key to the user: use
slouken@2268
    71
 * <tt>SDL_GetKeyName(SDL_GetLayoutKey(myPhysicalKeyCode))</tt>. Do not use
slouken@2268
    72
 * SDL_GetKeyName() directly on a physical key code (except for debugging
slouken@2268
    73
 * purposes), as the name returned by that will not correspond to how the key
slouken@2268
    74
 * is labeled on the user's keyboard.
slouken@2268
    75
 *
slouken@2268
    76
 * \par Example:
slouken@2268
    77
 * To implement WASD directional keys, it makes sense to use physical key
slouken@2268
    78
 * codes, so that the "forward" key will be above the "backward" key even
slouken@2268
    79
 * though, for example, it's labeled "Z", not "W", on a French keyboard:
slouken@2268
    80
 * \code
slouken@2268
    81
 * print("To go forward, press the %s key.", SDL_GetKeyName(SDL_GetLayoutKey(SDLK_W)));
slouken@2268
    82
 * ...
slouken@2268
    83
 * switch (event.key.keysym.sym) {
slouken@2268
    84
 *     case SDLK_W:
slouken@2268
    85
 *         forward();
slouken@2268
    86
 *         break;
slouken@2268
    87
 *     case SDLK_A:
slouken@2268
    88
 *         left();
slouken@2268
    89
 *         break;
slouken@2268
    90
 *     ...
slouken@2268
    91
 * }
slouken@2268
    92
 * \endcode
slouken@2268
    93
 * For keys based on mnemonics like "I for inventory" or "Z for zoom", use
slouken@2268
    94
 * layout key codes, so that the key labeled "Z" will zoom, whether it's at the
slouken@2268
    95
 * bottom left of the keyboard like on a US layout, or in the upper center like
slouken@2268
    96
 * on a German layout (but keep in mind that this forces your users to use a
slouken@2268
    97
 * keyboard layout where there \e is an I or Z key):
slouken@2268
    98
 * \code
slouken@2268
    99
 * print("To open the inventory, press the %s key.", SDL_GetKeyName('i'));
slouken@2268
   100
 * ...
slouken@2268
   101
 * switch (SDL_GetLayoutKey(event.key.keysym.sym)) {
slouken@2268
   102
 *     case 'i':
slouken@2268
   103
 *         inventory();
slouken@2268
   104
 *         break;
slouken@2268
   105
 *     case 'z':
slouken@2268
   106
 *         zoom();
slouken@2268
   107
 *         break;
slouken@2268
   108
 *     ...
slouken@2268
   109
 * }
slouken@2268
   110
 * \endcode
slouken@2268
   111
 * Of course, in a real application, you should not hardcode your key
slouken@2268
   112
 * assignments like this, but make them user-configurable.
slouken@0
   113
 */
slouken@2268
   114
typedef Uint32 SDLKey;
slouken@2268
   115
slouken@2268
   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) */
slouken@2268
   117
#define SDL_KEY_KEYPAD_BIT (1<<25)      /* marks keypad keys that need [] around their name to distinguish them from the corresponding keyboard keys */
slouken@2268
   118
#define SDL_KEY_LAYOUT_SPECIAL_BIT (1<<26)      /* marks non-physical layout keys that cannot be described by a single character */
slouken@2268
   119
slouken@2268
   120
/** Converts an \link ::SDLPhysicalKey SDLK_* \endlink constant to an index into the array obtained from SDL_GetKeyState(). */
slouken@2268
   121
#define SDLK_INDEX(k) ((k) & 0x00FFFFFF)
slouken@2268
   122
slouken@2268
   123
#define SDL_PHYSICAL_KEY(n) ((n) | SDL_KEY_CAN_BE_PHYSICAL_BIT)
slouken@2268
   124
slouken@2268
   125
/**
slouken@2268
   126
 * \brief SDL physical key codes.
slouken@2268
   127
 *
slouken@2268
   128
 * This is the set of physical key codes, i.e. the values of SDL_keysym::sym.
slouken@2268
   129
 * Some of them (those for non-character keys) also appear as layout key codes.
slouken@2268
   130
 * The constants are typically named after how the key would be labeled on a US
slouken@2268
   131
 * keyboard, e.g. SDLK_A or SDLK_LEFTBRACKET refer to the keys used as A and [
slouken@2268
   132
 * on a US layout, but used as Q and ^ on a French layout.
slouken@2268
   133
 *
slouken@2268
   134
 * <em>enum SDLPhysicalKey</em> is not a useful type in its own right - the
slouken@2268
   135
 * constants defined here are intended as values of the ::SDLKey type. The only
slouken@2268
   136
 * reason for the enum to have a name at all is that otherwise it would be
slouken@2268
   137
 * impossible to refer to it in the documentation.
slouken@2268
   138
 *
slouken@2268
   139
 * \sa SDLKey
slouken@2268
   140
 *
slouken@2268
   141
 * \par Notes for driver implementors:
slouken@2268
   142
 * These constants and their numerical values are based on the USB HID usage
slouken@2268
   143
 * tables, version 1.12
slouken@2268
   144
 * <http://www.usb.org/developers/devclass_docs/Hut1_12.pdf>, section "10
slouken@2268
   145
 * Keyboard/Keypad Page (0x07)". When deciding what code to generate for what
slouken@2268
   146
 * key, the following rules can be used as guidelines:
slouken@2268
   147
 * - A given key on a given keyboard should produce the same SDLK_* code, no
slouken@2268
   148
 * matter what computer it is connected to, what OS runs on that computer, and
slouken@2268
   149
 * what the keyboard layout settings in the OS are. For USB keyboards, that
slouken@2268
   150
 * should be the code numerically corresponding to the key's USB usage code
slouken@2268
   151
 * (with exceptions, see comments for specific constants).
slouken@2268
   152
 * - Two keys on two different keyboards are considered "the same key" and
slouken@2268
   153
 * should generate the same SDLK_* code if, when connected to the same
slouken@2268
   154
 * computer, they are treated equally by the OS. For USB keyboards, that's
slouken@2268
   155
 * generally the case when they generate the same USB usage code. Non-USB
slouken@2268
   156
 * keyboards can probably be treated like USB keyboards of the same layout, if
slouken@2268
   157
 * such exist. If not, and there's no possibility to determine the equivalence
slouken@2268
   158
 * relation by transitivity from the above - in particular, on devices like
slouken@2268
   159
 * phones or game consoles that don't have PC-style alphabetic keyboards -
slouken@2268
   160
 * apply common sense. If none of the predefined codes fit, insert new ones at
slouken@2268
   161
 * the end.
slouken@2268
   162
 */
slouken@2268
   163
enum SDLPhysicalKey
slouken@1895
   164
{
slouken@2268
   165
    SDLK_FIRST_PHYSICAL = 0, /**< (not a key, just marks the lowest used value in this enum) */
slouken@2268
   166
    SDLK_NONE = SDL_PHYSICAL_KEY(0),
slouken@2268
   167
    SDLK_UNKNOWN = SDL_PHYSICAL_KEY(1), /* Not from the USB spec, but this is a convenient place for it */
slouken@0
   168
slouken@2268
   169
    SDLK_A = SDL_PHYSICAL_KEY(4),
slouken@2268
   170
    SDLK_B = SDL_PHYSICAL_KEY(5),
slouken@2268
   171
    SDLK_C = SDL_PHYSICAL_KEY(6),
slouken@2268
   172
    SDLK_D = SDL_PHYSICAL_KEY(7),
slouken@2268
   173
    SDLK_E = SDL_PHYSICAL_KEY(8),
slouken@2268
   174
    SDLK_F = SDL_PHYSICAL_KEY(9),
slouken@2268
   175
    SDLK_G = SDL_PHYSICAL_KEY(10),
slouken@2268
   176
    SDLK_H = SDL_PHYSICAL_KEY(11),
slouken@2268
   177
    SDLK_I = SDL_PHYSICAL_KEY(12),
slouken@2268
   178
    SDLK_J = SDL_PHYSICAL_KEY(13),
slouken@2268
   179
    SDLK_K = SDL_PHYSICAL_KEY(14),
slouken@2268
   180
    SDLK_L = SDL_PHYSICAL_KEY(15),
slouken@2268
   181
    SDLK_M = SDL_PHYSICAL_KEY(16),
slouken@2268
   182
    SDLK_N = SDL_PHYSICAL_KEY(17),
slouken@2268
   183
    SDLK_O = SDL_PHYSICAL_KEY(18),
slouken@2268
   184
    SDLK_P = SDL_PHYSICAL_KEY(19),
slouken@2268
   185
    SDLK_Q = SDL_PHYSICAL_KEY(20),
slouken@2268
   186
    SDLK_R = SDL_PHYSICAL_KEY(21),
slouken@2268
   187
    SDLK_S = SDL_PHYSICAL_KEY(22),
slouken@2268
   188
    SDLK_T = SDL_PHYSICAL_KEY(23),
slouken@2268
   189
    SDLK_U = SDL_PHYSICAL_KEY(24),
slouken@2268
   190
    SDLK_V = SDL_PHYSICAL_KEY(25),
slouken@2268
   191
    SDLK_W = SDL_PHYSICAL_KEY(26),
slouken@2268
   192
    SDLK_X = SDL_PHYSICAL_KEY(27),
slouken@2268
   193
    SDLK_Y = SDL_PHYSICAL_KEY(28),
slouken@2268
   194
    SDLK_Z = SDL_PHYSICAL_KEY(29),
slouken@0
   195
slouken@2268
   196
    SDLK_1 = SDL_PHYSICAL_KEY(30),
slouken@2268
   197
    SDLK_2 = SDL_PHYSICAL_KEY(31),
slouken@2268
   198
    SDLK_3 = SDL_PHYSICAL_KEY(32),
slouken@2268
   199
    SDLK_4 = SDL_PHYSICAL_KEY(33),
slouken@2268
   200
    SDLK_5 = SDL_PHYSICAL_KEY(34),
slouken@2268
   201
    SDLK_6 = SDL_PHYSICAL_KEY(35),
slouken@2268
   202
    SDLK_7 = SDL_PHYSICAL_KEY(36),
slouken@2268
   203
    SDLK_8 = SDL_PHYSICAL_KEY(37),
slouken@2268
   204
    SDLK_9 = SDL_PHYSICAL_KEY(38),
slouken@2268
   205
    SDLK_0 = SDL_PHYSICAL_KEY(39),
slouken@0
   206
slouken@2268
   207
    SDLK_RETURN = SDL_PHYSICAL_KEY(40),
slouken@2268
   208
    SDLK_ESCAPE = SDL_PHYSICAL_KEY(41),
slouken@2268
   209
    SDLK_BACKSPACE = SDL_PHYSICAL_KEY(42),
slouken@2268
   210
    SDLK_TAB = SDL_PHYSICAL_KEY(43),
slouken@2268
   211
    SDLK_SPACE = SDL_PHYSICAL_KEY(44),
slouken@0
   212
slouken@2268
   213
    SDLK_HYPHENMINUS = SDL_PHYSICAL_KEY(45),
slouken@2268
   214
    SDLK_EQUALS = SDL_PHYSICAL_KEY(46),
slouken@2268
   215
    SDLK_LEFTBRACKET = SDL_PHYSICAL_KEY(47),
slouken@2268
   216
    SDLK_RIGHTBRACKET = SDL_PHYSICAL_KEY(48),
slouken@2268
   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. */
slouken@2268
   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. */
slouken@2268
   219
    SDLK_SEMICOLON = SDL_PHYSICAL_KEY(51),
slouken@2268
   220
    SDLK_APOSTROPHE = SDL_PHYSICAL_KEY(52),
slouken@2268
   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. */
slouken@2268
   222
    SDLK_COMMA = SDL_PHYSICAL_KEY(54),
slouken@2268
   223
    SDLK_PERIOD = SDL_PHYSICAL_KEY(55),
slouken@2268
   224
    SDLK_SLASH = SDL_PHYSICAL_KEY(56),
slouken@0
   225
slouken@2268
   226
    SDLK_CAPSLOCK = SDL_PHYSICAL_KEY(57),
slouken@2268
   227
slouken@2268
   228
    SDLK_F1 = SDL_PHYSICAL_KEY(58),
slouken@2268
   229
    SDLK_F2 = SDL_PHYSICAL_KEY(59),
slouken@2268
   230
    SDLK_F3 = SDL_PHYSICAL_KEY(60),
slouken@2268
   231
    SDLK_F4 = SDL_PHYSICAL_KEY(61),
slouken@2268
   232
    SDLK_F5 = SDL_PHYSICAL_KEY(62),
slouken@2268
   233
    SDLK_F6 = SDL_PHYSICAL_KEY(63),
slouken@2268
   234
    SDLK_F7 = SDL_PHYSICAL_KEY(64),
slouken@2268
   235
    SDLK_F8 = SDL_PHYSICAL_KEY(65),
slouken@2268
   236
    SDLK_F9 = SDL_PHYSICAL_KEY(66),
slouken@2268
   237
    SDLK_F10 = SDL_PHYSICAL_KEY(67),
slouken@2268
   238
    SDLK_F11 = SDL_PHYSICAL_KEY(68),
slouken@2268
   239
    SDLK_F12 = SDL_PHYSICAL_KEY(69),
slouken@2268
   240
slouken@2268
   241
    SDLK_PRINTSCREEN = SDL_PHYSICAL_KEY(70),
slouken@2268
   242
    SDLK_SCROLLLOCK = SDL_PHYSICAL_KEY(71),
slouken@2268
   243
    SDLK_PAUSE = SDL_PHYSICAL_KEY(72),
slouken@2268
   244
    SDLK_INSERT = SDL_PHYSICAL_KEY(73), /**< insert on PC, help on some Mac keyboards (but does send code 73, not 117) */
slouken@2268
   245
    SDLK_HOME = SDL_PHYSICAL_KEY(74),
slouken@2268
   246
    SDLK_PAGEUP = SDL_PHYSICAL_KEY(75),
slouken@2268
   247
    SDLK_DELETE = SDL_PHYSICAL_KEY(76),
slouken@2268
   248
    SDLK_END = SDL_PHYSICAL_KEY(77),
slouken@2268
   249
    SDLK_PAGEDOWN = SDL_PHYSICAL_KEY(78),
slouken@2268
   250
    SDLK_RIGHT = SDL_PHYSICAL_KEY(79),
slouken@2268
   251
    SDLK_LEFT = SDL_PHYSICAL_KEY(80),
slouken@2268
   252
    SDLK_DOWN = SDL_PHYSICAL_KEY(81),
slouken@2268
   253
    SDLK_UP = SDL_PHYSICAL_KEY(82),
slouken@2268
   254
slouken@2268
   255
    SDLK_KP_NUMLOCKCLEAR = SDL_PHYSICAL_KEY(83), /**< num lock on PC, clear on Mac keyboards */
slouken@2268
   256
    SDLK_KP_DIVIDE = SDL_PHYSICAL_KEY(84) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   257
    SDLK_KP_MULTIPLY = SDL_PHYSICAL_KEY(85) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   258
    SDLK_KP_MINUS = SDL_PHYSICAL_KEY(86) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   259
    SDLK_KP_PLUS = SDL_PHYSICAL_KEY(87) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   260
    SDLK_KP_ENTER = SDL_PHYSICAL_KEY(88),
slouken@2268
   261
    SDLK_KP_1 = SDL_PHYSICAL_KEY(89) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   262
    SDLK_KP_2 = SDL_PHYSICAL_KEY(90) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   263
    SDLK_KP_3 = SDL_PHYSICAL_KEY(91) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   264
    SDLK_KP_4 = SDL_PHYSICAL_KEY(92) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   265
    SDLK_KP_5 = SDL_PHYSICAL_KEY(93) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   266
    SDLK_KP_6 = SDL_PHYSICAL_KEY(94) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   267
    SDLK_KP_7 = SDL_PHYSICAL_KEY(95) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   268
    SDLK_KP_8 = SDL_PHYSICAL_KEY(96) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   269
    SDLK_KP_9 = SDL_PHYSICAL_KEY(97) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   270
    SDLK_KP_0 = SDL_PHYSICAL_KEY(98) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   271
    SDLK_KP_PERIOD = SDL_PHYSICAL_KEY(99) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   272
slouken@2268
   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. */
slouken@2268
   274
    SDLK_APPLICATION = SDL_PHYSICAL_KEY(101), /**< windows contextual menu, compose */
slouken@2268
   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. */
slouken@2268
   276
    SDLK_KP_EQUALS = SDL_PHYSICAL_KEY(103) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   277
    SDLK_F13 = SDL_PHYSICAL_KEY(104),
slouken@2268
   278
    SDLK_F14 = SDL_PHYSICAL_KEY(105),
slouken@2268
   279
    SDLK_F15 = SDL_PHYSICAL_KEY(106),
slouken@2268
   280
    SDLK_F16 = SDL_PHYSICAL_KEY(107),
slouken@2268
   281
    SDLK_F17 = SDL_PHYSICAL_KEY(108),
slouken@2268
   282
    SDLK_F18 = SDL_PHYSICAL_KEY(109),
slouken@2268
   283
    SDLK_F19 = SDL_PHYSICAL_KEY(110),
slouken@2268
   284
    SDLK_F20 = SDL_PHYSICAL_KEY(111),
slouken@2268
   285
    SDLK_F21 = SDL_PHYSICAL_KEY(112),
slouken@2268
   286
    SDLK_F22 = SDL_PHYSICAL_KEY(113),
slouken@2268
   287
    SDLK_F23 = SDL_PHYSICAL_KEY(114),
slouken@2268
   288
    SDLK_F24 = SDL_PHYSICAL_KEY(115),
slouken@2268
   289
    SDLK_EXECUTE = SDL_PHYSICAL_KEY(116),
slouken@2268
   290
    SDLK_HELP = SDL_PHYSICAL_KEY(117),
slouken@2268
   291
    SDLK_MENU = SDL_PHYSICAL_KEY(118),
slouken@2268
   292
    SDLK_SELECT = SDL_PHYSICAL_KEY(119),
slouken@2268
   293
    SDLK_STOP = SDL_PHYSICAL_KEY(120),
slouken@2268
   294
    SDLK_AGAIN = SDL_PHYSICAL_KEY(121), /*!< redo */
slouken@2268
   295
    SDLK_UNDO = SDL_PHYSICAL_KEY(122),
slouken@2268
   296
    SDLK_CUT = SDL_PHYSICAL_KEY(123),
slouken@2268
   297
    SDLK_COPY = SDL_PHYSICAL_KEY(124),
slouken@2268
   298
    SDLK_PASTE = SDL_PHYSICAL_KEY(125),
slouken@2268
   299
    SDLK_FIND = SDL_PHYSICAL_KEY(126),
slouken@2268
   300
    SDLK_MUTE = SDL_PHYSICAL_KEY(127),
slouken@2268
   301
    SDLK_VOLUMEUP = SDL_PHYSICAL_KEY(128),
slouken@2268
   302
    SDLK_VOLUMEDOWN = SDL_PHYSICAL_KEY(129),
bob@2295
   303
/* not sure whether there's a reason to enable these */
bob@2295
   304
/*     SDLK_LOCKINGCAPSLOCK = SDL_PHYSICAL_KEY(130),  */
bob@2295
   305
/*     SDLK_LOCKINGNUMLOCK = SDL_PHYSICAL_KEY(131), */
bob@2295
   306
/*     SDLK_LOCKINGSCROLLLOCK = SDL_PHYSICAL_KEY(132), */
slouken@2268
   307
    SDLK_KP_COMMA = SDL_PHYSICAL_KEY(133) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   308
    SDLK_KP_EQUALSAS400 = SDL_PHYSICAL_KEY(134) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   309
slouken@2268
   310
    SDLK_INTERNATIONAL1 = SDL_PHYSICAL_KEY(135), /**< used on Asian keyboards, see footnotes in USB doc */
slouken@2268
   311
    SDLK_INTERNATIONAL2 = SDL_PHYSICAL_KEY(136),
slouken@2268
   312
    SDLK_INTERNATIONAL3 = SDL_PHYSICAL_KEY(137), /**< Yen */
slouken@2268
   313
    SDLK_INTERNATIONAL4 = SDL_PHYSICAL_KEY(138),
slouken@2268
   314
    SDLK_INTERNATIONAL5 = SDL_PHYSICAL_KEY(139),
slouken@2268
   315
    SDLK_INTERNATIONAL6 = SDL_PHYSICAL_KEY(140),
slouken@2268
   316
    SDLK_INTERNATIONAL7 = SDL_PHYSICAL_KEY(141),
slouken@2268
   317
    SDLK_INTERNATIONAL8 = SDL_PHYSICAL_KEY(142),
slouken@2268
   318
    SDLK_INTERNATIONAL9 = SDL_PHYSICAL_KEY(143),
slouken@2268
   319
    SDLK_LANG1 = SDL_PHYSICAL_KEY(144), /**< Hangul/English toggle */
slouken@2268
   320
    SDLK_LANG2 = SDL_PHYSICAL_KEY(145), /**< Hanja conversion */
slouken@2268
   321
    SDLK_LANG3 = SDL_PHYSICAL_KEY(146), /**< Katakana */
slouken@2268
   322
    SDLK_LANG4 = SDL_PHYSICAL_KEY(147), /**< Hiragana */
slouken@2268
   323
    SDLK_LANG5 = SDL_PHYSICAL_KEY(148), /**< Zenkaku/Hankaku */
slouken@2268
   324
    SDLK_LANG6 = SDL_PHYSICAL_KEY(149), /**< reserved */
slouken@2268
   325
    SDLK_LANG7 = SDL_PHYSICAL_KEY(150), /**< reserved */
slouken@2268
   326
    SDLK_LANG8 = SDL_PHYSICAL_KEY(151), /**< reserved */
slouken@2268
   327
    SDLK_LANG9 = SDL_PHYSICAL_KEY(152), /**< reserved */
slouken@2268
   328
slouken@2268
   329
    SDLK_ALTERASE = SDL_PHYSICAL_KEY(153), /**< Erase-Eaze */
slouken@2268
   330
    SDLK_SYSREQ = SDL_PHYSICAL_KEY(154),
slouken@2268
   331
    SDLK_CANCEL = SDL_PHYSICAL_KEY(155),
slouken@2268
   332
    SDLK_CLEAR = SDL_PHYSICAL_KEY(156),
slouken@2268
   333
    SDLK_PRIOR = SDL_PHYSICAL_KEY(157),
slouken@2268
   334
    SDLK_RETURN2 = SDL_PHYSICAL_KEY(158),
slouken@2268
   335
    SDLK_SEPARATOR = SDL_PHYSICAL_KEY(159),
slouken@2268
   336
    SDLK_OUT = SDL_PHYSICAL_KEY(160),
slouken@2268
   337
    SDLK_OPER = SDL_PHYSICAL_KEY(161),
slouken@2268
   338
    SDLK_CLEARAGAIN = SDL_PHYSICAL_KEY(162),
slouken@2268
   339
    SDLK_CRSELPROPS = SDL_PHYSICAL_KEY(163),
slouken@2268
   340
    SDLK_EXSEL = SDL_PHYSICAL_KEY(164),
slouken@2268
   341
slouken@2268
   342
    SDLK_KP_00 = SDL_PHYSICAL_KEY(176) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   343
    SDLK_KP_000 = SDL_PHYSICAL_KEY(177) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   344
    SDLK_THOUSANDSSEPARATOR = SDL_PHYSICAL_KEY(178),
slouken@2268
   345
    SDLK_DECIMALSEPARATOR = SDL_PHYSICAL_KEY(179),
slouken@2268
   346
    SDLK_CURRENCYUNIT = SDL_PHYSICAL_KEY(180),
slouken@2268
   347
    SDLK_CURRENCYSUBUNIT = SDL_PHYSICAL_KEY(181),
slouken@2268
   348
    SDLK_KP_LEFTPAREN = SDL_PHYSICAL_KEY(182) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   349
    SDLK_KP_RIGHTPAREN = SDL_PHYSICAL_KEY(183) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   350
    SDLK_KP_LEFTBRACE = SDL_PHYSICAL_KEY(184) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   351
    SDLK_KP_RIGHTBRACE = SDL_PHYSICAL_KEY(185) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   352
    SDLK_KP_TAB = SDL_PHYSICAL_KEY(186) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   353
    SDLK_KP_BACKSPACE = SDL_PHYSICAL_KEY(187) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   354
    SDLK_KP_A = SDL_PHYSICAL_KEY(188) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   355
    SDLK_KP_B = SDL_PHYSICAL_KEY(189) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   356
    SDLK_KP_C = SDL_PHYSICAL_KEY(190) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   357
    SDLK_KP_D = SDL_PHYSICAL_KEY(191) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   358
    SDLK_KP_E = SDL_PHYSICAL_KEY(192) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   359
    SDLK_KP_F = SDL_PHYSICAL_KEY(193) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   360
    SDLK_KP_XOR = SDL_PHYSICAL_KEY(194) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   361
    SDLK_KP_POWER = SDL_PHYSICAL_KEY(195) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   362
    SDLK_KP_PERCENT = SDL_PHYSICAL_KEY(196) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   363
    SDLK_KP_LESS = SDL_PHYSICAL_KEY(197) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   364
    SDLK_KP_GREATER = SDL_PHYSICAL_KEY(198) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   365
    SDLK_KP_AMPERSAND = SDL_PHYSICAL_KEY(199) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   366
    SDLK_KP_DBLAMPERSAND = SDL_PHYSICAL_KEY(200) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   367
    SDLK_KP_VERTICALBAR = SDL_PHYSICAL_KEY(201) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   368
    SDLK_KP_DBLVERTICALBAR = SDL_PHYSICAL_KEY(202) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   369
    SDLK_KP_COLON = SDL_PHYSICAL_KEY(203) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   370
    SDLK_KP_HASH = SDL_PHYSICAL_KEY(204) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   371
    SDLK_KP_SPACE = SDL_PHYSICAL_KEY(205) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   372
    SDLK_KP_AT = SDL_PHYSICAL_KEY(206) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   373
    SDLK_KP_EXCLAM = SDL_PHYSICAL_KEY(207) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   374
    SDLK_KP_MEMSTORE = SDL_PHYSICAL_KEY(208) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   375
    SDLK_KP_MEMRECALL = SDL_PHYSICAL_KEY(209) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   376
    SDLK_KP_MEMCLEAR = SDL_PHYSICAL_KEY(210) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   377
    SDLK_KP_MEMADD = SDL_PHYSICAL_KEY(211) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   378
    SDLK_KP_MEMSUBTRACT = SDL_PHYSICAL_KEY(212) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   379
    SDLK_KP_MEMMULTIPLY = SDL_PHYSICAL_KEY(213) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   380
    SDLK_KP_MEMDIVIDE = SDL_PHYSICAL_KEY(214) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   381
    SDLK_KP_PLUSMINUS = SDL_PHYSICAL_KEY(215) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   382
    SDLK_KP_CLEAR = SDL_PHYSICAL_KEY(216) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   383
    SDLK_KP_CLEARENTRY = SDL_PHYSICAL_KEY(217) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   384
    SDLK_KP_BINARY = SDL_PHYSICAL_KEY(218) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   385
    SDLK_KP_OCTAL = SDL_PHYSICAL_KEY(219) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   386
    SDLK_KP_DECIMAL = SDL_PHYSICAL_KEY(220) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   387
    SDLK_KP_HEXADECIMAL = SDL_PHYSICAL_KEY(221) | SDL_KEY_KEYPAD_BIT,
slouken@2268
   388
slouken@2268
   389
    SDLK_LCTRL = SDL_PHYSICAL_KEY(224),
slouken@2268
   390
    SDLK_LSHIFT = SDL_PHYSICAL_KEY(225),
slouken@2268
   391
    SDLK_LALT = SDL_PHYSICAL_KEY(226), /**< alt, option */
slouken@2268
   392
    SDLK_LMETA = SDL_PHYSICAL_KEY(227), /**< windows, command (apple), meta */
slouken@2268
   393
    SDLK_RCTRL = SDL_PHYSICAL_KEY(228),
slouken@2268
   394
    SDLK_RSHIFT = SDL_PHYSICAL_KEY(229),
slouken@2268
   395
    SDLK_RALT = SDL_PHYSICAL_KEY(230), /**< alt gr, option */
slouken@2268
   396
    SDLK_RMETA = SDL_PHYSICAL_KEY(231), /**< windows, command (apple), meta */
slouken@2268
   397
slouken@2268
   398
    /* Everything below here is not from the USB spec */
slouken@2268
   399
slouken@2268
   400
    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 */
slouken@2268
   401
slouken@2268
   402
    SDLK_BRIGHTNESSDOWN = SDL_PHYSICAL_KEY(236),
slouken@2268
   403
    SDLK_BRIGHTNESSUP = SDL_PHYSICAL_KEY(237),
slouken@2268
   404
    SDLK_DISPLAYSWITCH = SDL_PHYSICAL_KEY(238), /**< display mirroring/dual display switch, video mode switch */
slouken@2268
   405
    SDLK_KBDILLUMTOGGLE = SDL_PHYSICAL_KEY(239),
slouken@2268
   406
    SDLK_KBDILLUMDOWN = SDL_PHYSICAL_KEY(240),
slouken@2268
   407
    SDLK_KBDILLUMUP = SDL_PHYSICAL_KEY(241),
slouken@2268
   408
    SDLK_EJECT = SDL_PHYSICAL_KEY(242),
slouken@2268
   409
    SDLK_SLEEP = SDL_PHYSICAL_KEY(243),
slouken@2268
   410
slouken@2268
   411
    /* Some of the more common and more standardized "multimedia"/"internet" keyboard keys */
slouken@2268
   412
    SDLK_AUDIOPLAY = SDL_PHYSICAL_KEY(244),
slouken@2268
   413
    SDLK_AUDIOSTOP = SDL_PHYSICAL_KEY(245),
slouken@2268
   414
    SDLK_AUDIOPREV = SDL_PHYSICAL_KEY(246),
slouken@2268
   415
    SDLK_AUDIONEXT = SDL_PHYSICAL_KEY(247),
slouken@2268
   416
    SDLK_CALC = SDL_PHYSICAL_KEY(248),
slouken@2268
   417
    SDLK_WWW = SDL_PHYSICAL_KEY(249),
slouken@2268
   418
    SDLK_EMAIL = SDL_PHYSICAL_KEY(250),
slouken@2268
   419
    SDLK_MEDIA = SDL_PHYSICAL_KEY(251),
slouken@2268
   420
    SDLK_COMPUTER = SDL_PHYSICAL_KEY(252),
slouken@2268
   421
    SDLK_SEARCH = SDL_PHYSICAL_KEY(253),
slouken@2268
   422
    SDLK_BOOKMARKS = SDL_PHYSICAL_KEY(254),
slouken@2268
   423
    SDLK_BROWSERBACK = SDL_PHYSICAL_KEY(255),
slouken@2268
   424
    SDLK_BROWSERFORWARD = SDL_PHYSICAL_KEY(256),
slouken@2268
   425
    SDLK_BROWSERRELOAD = SDL_PHYSICAL_KEY(257),
slouken@2268
   426
    SDLK_BROWSERSTOP = SDL_PHYSICAL_KEY(258),
slouken@0
   427
slouken@1895
   428
    /* Add any other keys here */
slouken@0
   429
slouken@2268
   430
    SDLK_LAST_PHYSICAL /**< (not a key, just marks the highest used value in this enum) */
slouken@2268
   431
};
slouken@2268
   432
slouken@2268
   433
#define SDLK_FIRST SDLK_INDEX(SDLK_FIRST_PHYSICAL)
slouken@2268
   434
#define SDLK_LAST SDLK_INDEX(SDLK_LAST_PHYSICAL)
slouken@2268
   435
slouken@2268
   436
slouken@0
   437
slouken@1895
   438
/**
slouken@1895
   439
 * \enum SDLMod
slouken@1895
   440
 *
slouken@1895
   441
 * \brief Enumeration of valid key mods (possibly OR'd together)
slouken@1895
   442
 */
slouken@1895
   443
typedef enum
slouken@1895
   444
{
slouken@1895
   445
    KMOD_NONE = 0x0000,
slouken@1895
   446
    KMOD_LSHIFT = 0x0001,
slouken@1895
   447
    KMOD_RSHIFT = 0x0002,
slouken@1895
   448
    KMOD_LCTRL = 0x0040,
slouken@1895
   449
    KMOD_RCTRL = 0x0080,
slouken@1895
   450
    KMOD_LALT = 0x0100,
slouken@1895
   451
    KMOD_RALT = 0x0200,
slouken@1895
   452
    KMOD_LMETA = 0x0400,
slouken@1895
   453
    KMOD_RMETA = 0x0800,
slouken@1895
   454
    KMOD_NUM = 0x1000,
slouken@1895
   455
    KMOD_CAPS = 0x2000,
slouken@1895
   456
    KMOD_MODE = 0x4000,
slouken@1895
   457
    KMOD_RESERVED = 0x8000
slouken@0
   458
} SDLMod;
slouken@0
   459
slouken@0
   460
#define KMOD_CTRL	(KMOD_LCTRL|KMOD_RCTRL)
slouken@0
   461
#define KMOD_SHIFT	(KMOD_LSHIFT|KMOD_RSHIFT)
slouken@0
   462
#define KMOD_ALT	(KMOD_LALT|KMOD_RALT)
slouken@0
   463
#define KMOD_META	(KMOD_LMETA|KMOD_RMETA)
slouken@0
   464
slouken@0
   465
#endif /* _SDL_keysym_h */