include/SDL_scancode.h
changeset 3407 d3baf5ac4e37
parent 2859 99210400e8b9
child 3697 f7b03b6838cb
equal deleted inserted replaced
3406:8ae607392409 3407:d3baf5ac4e37
    19     Sam Lantinga
    19     Sam Lantinga
    20     slouken@libsdl.org
    20     slouken@libsdl.org
    21 */
    21 */
    22 
    22 
    23 /**
    23 /**
    24  * \file SDL_scancode.h
    24  *  \file SDL_scancode.h
       
    25  *  
       
    26  *  Defines keyboard scancodes.
    25  */
    27  */
    26 
    28 
    27 #ifndef _SDL_scancode_h
    29 #ifndef _SDL_scancode_h
    28 #define _SDL_scancode_h
    30 #define _SDL_scancode_h
    29 
    31 
    30 #include "SDL_stdinc.h"
    32 #include "SDL_stdinc.h"
    31 
    33 
    32 /**
    34 /**
    33  * \enum SDL_scancode
    35  *  \brief The SDL keyboard scancode representation.
    34  *
    36  *  
    35  * \brief The SDL keyboard scancode representation.
    37  *  Values of this type are used to represent keyboard keys, among other places
    36  *
    38  *  in the \link SDL_keysym::scancode key.keysym.scancode \endlink field of the
    37  * Values of this type are used to represent keyboard keys, among other places
    39  *  SDL_Event structure.
    38  * in the \link SDL_keysym::scancode key.keysym.scancode \endlink field of the
    40  *  
    39  * SDL_Event structure.
    41  *  The values in this enumeration are based on the USB usage page standard:
    40  *
    42  *  http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
    41  * The values in this enumeration are based on the USB usage page standard:
       
    42  * http://www.usb.org/developers/devclass_docs/Hut1_12.pdf
       
    43  */
    43  */
    44 typedef enum
    44 typedef enum
    45 {
    45 {
    46     SDL_SCANCODE_UNKNOWN = 0,
    46     SDL_SCANCODE_UNKNOWN = 0,
    47 
    47 
    48     /* These values are from usage page 0x07 (USB keyboard page) */
    48     /** 
       
    49      *  \name Usage page 0x07
       
    50      *  
       
    51      *  These values are from usage page 0x07 (USB keyboard page).
       
    52      */
       
    53     /*@{*/
    49 
    54 
    50     SDL_SCANCODE_A = 4,
    55     SDL_SCANCODE_A = 4,
    51     SDL_SCANCODE_B = 5,
    56     SDL_SCANCODE_B = 5,
    52     SDL_SCANCODE_C = 6,
    57     SDL_SCANCODE_C = 6,
    53     SDL_SCANCODE_D = 7,
    58     SDL_SCANCODE_D = 7,
    93 
    98 
    94     SDL_SCANCODE_MINUS = 45,
    99     SDL_SCANCODE_MINUS = 45,
    95     SDL_SCANCODE_EQUALS = 46,
   100     SDL_SCANCODE_EQUALS = 46,
    96     SDL_SCANCODE_LEFTBRACKET = 47,
   101     SDL_SCANCODE_LEFTBRACKET = 47,
    97     SDL_SCANCODE_RIGHTBRACKET = 48,
   102     SDL_SCANCODE_RIGHTBRACKET = 48,
    98     SDL_SCANCODE_BACKSLASH = 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. */
   103     SDL_SCANCODE_BACKSLASH = 49, /**< Located at the lower left of the return 
    99     SDL_SCANCODE_NONUSHASH = 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 SDL_SCANCODE_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. */
   104                                   *   key on ISO keyboards and at the right end 
       
   105                                   *   of the QWERTY row on ANSI keyboards. 
       
   106                                   *   Produces REVERSE SOLIDUS (backslash) and 
       
   107                                   *   VERTICAL LINE in a US layout, REVERSE 
       
   108                                   *   SOLIDUS and VERTICAL LINE in a UK Mac 
       
   109                                   *   layout, NUMBER SIGN and TILDE in a UK 
       
   110                                   *   Windows layout, DOLLAR SIGN and POUND SIGN
       
   111                                   *   in a Swiss German layout, NUMBER SIGN and 
       
   112                                   *   APOSTROPHE in a German layout, GRAVE 
       
   113                                   *   ACCENT and POUND SIGN in a French Mac 
       
   114                                   *   layout, and ASTERISK and MICRO SIGN in a 
       
   115                                   *   French Windows layout.
       
   116                                   */
       
   117     SDL_SCANCODE_NONUSHASH = 50, /**< ISO USB keyboards actually use this code 
       
   118                                   *   instead of 49 for the same key, but all 
       
   119                                   *   OSes I've seen treat the two codes 
       
   120                                   *   identically. So, as an implementor, unless
       
   121                                   *   your keyboard generates both of those 
       
   122                                   *   codes and your OS treats them differently,
       
   123                                   *   you should generate SDL_SCANCODE_BACKSLASH
       
   124                                   *   instead of this code. As a user, you 
       
   125                                   *   should not rely on this code because SDL 
       
   126                                   *   will never generate it with most (all?) 
       
   127                                   *   keyboards. 
       
   128                                   */
   100     SDL_SCANCODE_SEMICOLON = 51,
   129     SDL_SCANCODE_SEMICOLON = 51,
   101     SDL_SCANCODE_APOSTROPHE = 52,
   130     SDL_SCANCODE_APOSTROPHE = 52,
   102     SDL_SCANCODE_GRAVE = 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. */
   131     SDL_SCANCODE_GRAVE = 53, /**< Located in the top left corner (on both ANSI 
       
   132                               *   and ISO keyboards). Produces GRAVE ACCENT and 
       
   133                               *   TILDE in a US Windows layout and in US and UK 
       
   134                               *   Mac layouts on ANSI keyboards, GRAVE ACCENT 
       
   135                               *   and NOT SIGN in a UK Windows layout, SECTION 
       
   136                               *   SIGN and PLUS-MINUS SIGN in US and UK Mac 
       
   137                               *   layouts on ISO keyboards, SECTION SIGN and 
       
   138                               *   DEGREE SIGN in a Swiss German layout (Mac: 
       
   139                               *   only on ISO keyboards), CIRCUMFLEX ACCENT and 
       
   140                               *   DEGREE SIGN in a German layout (Mac: only on 
       
   141                               *   ISO keyboards), SUPERSCRIPT TWO and TILDE in a
       
   142                               *   French Windows layout, COMMERCIAL AT and 
       
   143                               *   NUMBER SIGN in a French Mac layout on ISO 
       
   144                               *   keyboards, and LESS-THAN SIGN and GREATER-THAN
       
   145                               *   SIGN in a Swiss German, German, or French Mac 
       
   146                               *   layout on ANSI keyboards.
       
   147                               */
   103     SDL_SCANCODE_COMMA = 54,
   148     SDL_SCANCODE_COMMA = 54,
   104     SDL_SCANCODE_PERIOD = 55,
   149     SDL_SCANCODE_PERIOD = 55,
   105     SDL_SCANCODE_SLASH = 56,
   150     SDL_SCANCODE_SLASH = 56,
   106 
   151 
   107     SDL_SCANCODE_CAPSLOCK = 57,
   152     SDL_SCANCODE_CAPSLOCK = 57,
   120     SDL_SCANCODE_F12 = 69,
   165     SDL_SCANCODE_F12 = 69,
   121 
   166 
   122     SDL_SCANCODE_PRINTSCREEN = 70,
   167     SDL_SCANCODE_PRINTSCREEN = 70,
   123     SDL_SCANCODE_SCROLLLOCK = 71,
   168     SDL_SCANCODE_SCROLLLOCK = 71,
   124     SDL_SCANCODE_PAUSE = 72,
   169     SDL_SCANCODE_PAUSE = 72,
   125     SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but does send code 73, not 117) */
   170     SDL_SCANCODE_INSERT = 73, /**< insert on PC, help on some Mac keyboards (but
       
   171                                    does send code 73, not 117) */
   126     SDL_SCANCODE_HOME = 74,
   172     SDL_SCANCODE_HOME = 74,
   127     SDL_SCANCODE_PAGEUP = 75,
   173     SDL_SCANCODE_PAGEUP = 75,
   128     SDL_SCANCODE_DELETE = 76,
   174     SDL_SCANCODE_DELETE = 76,
   129     SDL_SCANCODE_END = 77,
   175     SDL_SCANCODE_END = 77,
   130     SDL_SCANCODE_PAGEDOWN = 78,
   176     SDL_SCANCODE_PAGEDOWN = 78,
   131     SDL_SCANCODE_RIGHT = 79,
   177     SDL_SCANCODE_RIGHT = 79,
   132     SDL_SCANCODE_LEFT = 80,
   178     SDL_SCANCODE_LEFT = 80,
   133     SDL_SCANCODE_DOWN = 81,
   179     SDL_SCANCODE_DOWN = 81,
   134     SDL_SCANCODE_UP = 82,
   180     SDL_SCANCODE_UP = 82,
   135 
   181 
   136     SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards */
   182     SDL_SCANCODE_NUMLOCKCLEAR = 83, /**< num lock on PC, clear on Mac keyboards 
       
   183                                      */
   137     SDL_SCANCODE_KP_DIVIDE = 84,
   184     SDL_SCANCODE_KP_DIVIDE = 84,
   138     SDL_SCANCODE_KP_MULTIPLY = 85,
   185     SDL_SCANCODE_KP_MULTIPLY = 85,
   139     SDL_SCANCODE_KP_MINUS = 86,
   186     SDL_SCANCODE_KP_MINUS = 86,
   140     SDL_SCANCODE_KP_PLUS = 87,
   187     SDL_SCANCODE_KP_PLUS = 87,
   141     SDL_SCANCODE_KP_ENTER = 88,
   188     SDL_SCANCODE_KP_ENTER = 88,
   149     SDL_SCANCODE_KP_8 = 96,
   196     SDL_SCANCODE_KP_8 = 96,
   150     SDL_SCANCODE_KP_9 = 97,
   197     SDL_SCANCODE_KP_9 = 97,
   151     SDL_SCANCODE_KP_0 = 98,
   198     SDL_SCANCODE_KP_0 = 98,
   152     SDL_SCANCODE_KP_PERIOD = 99,
   199     SDL_SCANCODE_KP_PERIOD = 99,
   153 
   200 
   154     SDL_SCANCODE_NONUSBACKSLASH = 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. */
   201     SDL_SCANCODE_NONUSBACKSLASH = 100, /**< This is the additional key that ISO 
       
   202                                         *   keyboards have over ANSI ones, 
       
   203                                         *   located between left shift and Y. 
       
   204                                         *   Produces GRAVE ACCENT and TILDE in a
       
   205                                         *   US or UK Mac layout, REVERSE SOLIDUS
       
   206                                         *   (backslash) and VERTICAL LINE in a 
       
   207                                         *   US or UK Windows layout, and 
       
   208                                         *   LESS-THAN SIGN and GREATER-THAN SIGN
       
   209                                         *   in a Swiss German, German, or French
       
   210                                         *   layout. */
   155     SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
   211     SDL_SCANCODE_APPLICATION = 101, /**< windows contextual menu, compose */
   156     SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, not a physical key - but some Mac keyboards do have a power key. */
   212     SDL_SCANCODE_POWER = 102, /**< The USB document says this is a status flag, 
       
   213                                *   not a physical key - but some Mac keyboards 
       
   214                                *   do have a power key. */
   157     SDL_SCANCODE_KP_EQUALS = 103,
   215     SDL_SCANCODE_KP_EQUALS = 103,
   158     SDL_SCANCODE_F13 = 104,
   216     SDL_SCANCODE_F13 = 104,
   159     SDL_SCANCODE_F14 = 105,
   217     SDL_SCANCODE_F14 = 105,
   160     SDL_SCANCODE_F15 = 106,
   218     SDL_SCANCODE_F15 = 106,
   161     SDL_SCANCODE_F16 = 107,
   219     SDL_SCANCODE_F16 = 107,
   170     SDL_SCANCODE_EXECUTE = 116,
   228     SDL_SCANCODE_EXECUTE = 116,
   171     SDL_SCANCODE_HELP = 117,
   229     SDL_SCANCODE_HELP = 117,
   172     SDL_SCANCODE_MENU = 118,
   230     SDL_SCANCODE_MENU = 118,
   173     SDL_SCANCODE_SELECT = 119,
   231     SDL_SCANCODE_SELECT = 119,
   174     SDL_SCANCODE_STOP = 120,
   232     SDL_SCANCODE_STOP = 120,
   175     SDL_SCANCODE_AGAIN = 121,   /*!< redo */
   233     SDL_SCANCODE_AGAIN = 121,   /**< redo */
   176     SDL_SCANCODE_UNDO = 122,
   234     SDL_SCANCODE_UNDO = 122,
   177     SDL_SCANCODE_CUT = 123,
   235     SDL_SCANCODE_CUT = 123,
   178     SDL_SCANCODE_COPY = 124,
   236     SDL_SCANCODE_COPY = 124,
   179     SDL_SCANCODE_PASTE = 125,
   237     SDL_SCANCODE_PASTE = 125,
   180     SDL_SCANCODE_FIND = 126,
   238     SDL_SCANCODE_FIND = 126,
   186 /*     SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
   244 /*     SDL_SCANCODE_LOCKINGNUMLOCK = 131, */
   187 /*     SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
   245 /*     SDL_SCANCODE_LOCKINGSCROLLLOCK = 132, */
   188     SDL_SCANCODE_KP_COMMA = 133,
   246     SDL_SCANCODE_KP_COMMA = 133,
   189     SDL_SCANCODE_KP_EQUALSAS400 = 134,
   247     SDL_SCANCODE_KP_EQUALSAS400 = 134,
   190 
   248 
   191     SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see footnotes in USB doc */
   249     SDL_SCANCODE_INTERNATIONAL1 = 135, /**< used on Asian keyboards, see 
       
   250                                             footnotes in USB doc */
   192     SDL_SCANCODE_INTERNATIONAL2 = 136,
   251     SDL_SCANCODE_INTERNATIONAL2 = 136,
   193     SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
   252     SDL_SCANCODE_INTERNATIONAL3 = 137, /**< Yen */
   194     SDL_SCANCODE_INTERNATIONAL4 = 138,
   253     SDL_SCANCODE_INTERNATIONAL4 = 138,
   195     SDL_SCANCODE_INTERNATIONAL5 = 139,
   254     SDL_SCANCODE_INTERNATIONAL5 = 139,
   196     SDL_SCANCODE_INTERNATIONAL6 = 140,
   255     SDL_SCANCODE_INTERNATIONAL6 = 140,
   274     SDL_SCANCODE_RCTRL = 228,
   333     SDL_SCANCODE_RCTRL = 228,
   275     SDL_SCANCODE_RSHIFT = 229,
   334     SDL_SCANCODE_RSHIFT = 229,
   276     SDL_SCANCODE_RALT = 230, /**< alt gr, option */
   335     SDL_SCANCODE_RALT = 230, /**< alt gr, option */
   277     SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
   336     SDL_SCANCODE_RGUI = 231, /**< windows, command (apple), meta */
   278 
   337 
   279     SDL_SCANCODE_MODE = 257,    /* 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 */
   338     SDL_SCANCODE_MODE = 257,    /**< I'm not sure if this is really not covered 
   280 
   339                                  *   by any of the above, but since there's a 
   281     /* These values are mapped from usage page 0x0C (USB consumer page) */
   340                                  *   special KMOD_MODE for it I'm adding it here
       
   341                                  */
       
   342     
       
   343     /*@}*//*Usage page 0x07*/
       
   344 
       
   345     /**
       
   346      *  \name Usage page 0x0C
       
   347      *  
       
   348      *  These values are mapped from usage page 0x0C (USB consumer page).
       
   349      */
       
   350     /*@{*/
   282 
   351 
   283     SDL_SCANCODE_AUDIONEXT = 258,
   352     SDL_SCANCODE_AUDIONEXT = 258,
   284     SDL_SCANCODE_AUDIOPREV = 259,
   353     SDL_SCANCODE_AUDIOPREV = 259,
   285     SDL_SCANCODE_AUDIOSTOP = 260,
   354     SDL_SCANCODE_AUDIOSTOP = 260,
   286     SDL_SCANCODE_AUDIOPLAY = 261,
   355     SDL_SCANCODE_AUDIOPLAY = 261,
   295     SDL_SCANCODE_AC_BACK = 270,
   364     SDL_SCANCODE_AC_BACK = 270,
   296     SDL_SCANCODE_AC_FORWARD = 271,
   365     SDL_SCANCODE_AC_FORWARD = 271,
   297     SDL_SCANCODE_AC_STOP = 272,
   366     SDL_SCANCODE_AC_STOP = 272,
   298     SDL_SCANCODE_AC_REFRESH = 273,
   367     SDL_SCANCODE_AC_REFRESH = 273,
   299     SDL_SCANCODE_AC_BOOKMARKS = 274,
   368     SDL_SCANCODE_AC_BOOKMARKS = 274,
   300 
   369     
   301     /* These are values that Christian Walther added (for mac keyboard?) */
   370     /*@}*//*Usage page 0x0C*/
       
   371 
       
   372     /**
       
   373      *  \name Walther keys
       
   374      *  
       
   375      *  These are values that Christian Walther added (for mac keyboard?).
       
   376      */
       
   377     /*@{*/
   302 
   378 
   303     SDL_SCANCODE_BRIGHTNESSDOWN = 275,
   379     SDL_SCANCODE_BRIGHTNESSDOWN = 275,
   304     SDL_SCANCODE_BRIGHTNESSUP = 276,
   380     SDL_SCANCODE_BRIGHTNESSUP = 276,
   305     SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display switch, video mode switch */
   381     SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display 
       
   382                                            switch, video mode switch */
   306     SDL_SCANCODE_KBDILLUMTOGGLE = 278,
   383     SDL_SCANCODE_KBDILLUMTOGGLE = 278,
   307     SDL_SCANCODE_KBDILLUMDOWN = 279,
   384     SDL_SCANCODE_KBDILLUMDOWN = 279,
   308     SDL_SCANCODE_KBDILLUMUP = 280,
   385     SDL_SCANCODE_KBDILLUMUP = 280,
   309     SDL_SCANCODE_EJECT = 281,
   386     SDL_SCANCODE_EJECT = 281,
   310     SDL_SCANCODE_SLEEP = 282,
   387     SDL_SCANCODE_SLEEP = 282,
   311 
   388     
   312     /* Add any other keys here */
   389     /*@}*//*Walther keys*/
   313 
   390 
   314     SDL_NUM_SCANCODES = 512 /**< (not a key, just marks the number of scancodes for array bounds) */
   391     /* Add any other keys here. */
       
   392 
       
   393     SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes 
       
   394                                  for array bounds */
   315 } SDL_scancode;
   395 } SDL_scancode;
   316 
   396 
   317 #endif /* _SDL_scancode_h */
   397 #endif /* _SDL_scancode_h */
   318 
   398 
   319 /* vi: set ts=4 sw=4 expandtab: */
   399 /* vi: set ts=4 sw=4 expandtab: */