Regenerate key lists with latest SDL version

Update `SDL_scancode.h` which is used by `gen_keys.py` to generate the list of keys enum (`keys.h`) and the list of key names (`keynames.h`) and regenerate the lists.

This adds support for 6 uncommonly used keys (audiorewind, audiofastforward, softleft, softright, call, endcall).
This commit is contained in:
Robert Müller 2023-05-30 23:39:07 +02:00
parent 8659578798
commit cde1143528
3 changed files with 132 additions and 89 deletions

View file

@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@ -25,8 +25,8 @@
* Defines keyboard scancodes.
*/
#ifndef _SDL_scancode_h
#define _SDL_scancode_h
#ifndef SDL_scancode_h_
#define SDL_scancode_h_
#include "SDL_stdinc.h"
@ -38,7 +38,7 @@
* SDL_Event structure.
*
* The values in this enumeration are based on the USB usage page standard:
* http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf
* https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/
typedef enum
{
@ -225,16 +225,16 @@ typedef enum
SDL_SCANCODE_F23 = 114,
SDL_SCANCODE_F24 = 115,
SDL_SCANCODE_EXECUTE = 116,
SDL_SCANCODE_HELP = 117,
SDL_SCANCODE_MENU = 118,
SDL_SCANCODE_HELP = 117, /**< AL Integrated Help Center */
SDL_SCANCODE_MENU = 118, /**< Menu (show menu) */
SDL_SCANCODE_SELECT = 119,
SDL_SCANCODE_STOP = 120,
SDL_SCANCODE_AGAIN = 121, /**< redo */
SDL_SCANCODE_UNDO = 122,
SDL_SCANCODE_CUT = 123,
SDL_SCANCODE_COPY = 124,
SDL_SCANCODE_PASTE = 125,
SDL_SCANCODE_FIND = 126,
SDL_SCANCODE_STOP = 120, /**< AC Stop */
SDL_SCANCODE_AGAIN = 121, /**< AC Redo/Repeat */
SDL_SCANCODE_UNDO = 122, /**< AC Undo */
SDL_SCANCODE_CUT = 123, /**< AC Cut */
SDL_SCANCODE_COPY = 124, /**< AC Copy */
SDL_SCANCODE_PASTE = 125, /**< AC Paste */
SDL_SCANCODE_FIND = 126, /**< AC Find */
SDL_SCANCODE_MUTE = 127,
SDL_SCANCODE_VOLUMEUP = 128,
SDL_SCANCODE_VOLUMEDOWN = 129,
@ -265,9 +265,9 @@ typedef enum
SDL_SCANCODE_LANG8 = 151, /**< reserved */
SDL_SCANCODE_LANG9 = 152, /**< reserved */
SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
SDL_SCANCODE_ALTERASE = 153, /**< Erase-Eaze */
SDL_SCANCODE_SYSREQ = 154,
SDL_SCANCODE_CANCEL = 155,
SDL_SCANCODE_CANCEL = 155, /**< AC Cancel */
SDL_SCANCODE_CLEAR = 156,
SDL_SCANCODE_PRIOR = 157,
SDL_SCANCODE_RETURN2 = 158,
@ -345,6 +345,11 @@ typedef enum
* \name Usage page 0x0C
*
* These values are mapped from usage page 0x0C (USB consumer page).
* See https://usb.org/sites/default/files/hut1_2.pdf
*
* There are way more keys in the spec than we can represent in the
* current scancode range, so pick the ones that commonly come up in
* real world usage.
*/
/* @{ */
@ -354,17 +359,17 @@ typedef enum
SDL_SCANCODE_AUDIOPLAY = 261,
SDL_SCANCODE_AUDIOMUTE = 262,
SDL_SCANCODE_MEDIASELECT = 263,
SDL_SCANCODE_WWW = 264,
SDL_SCANCODE_WWW = 264, /**< AL Internet Browser */
SDL_SCANCODE_MAIL = 265,
SDL_SCANCODE_CALCULATOR = 266,
SDL_SCANCODE_CALCULATOR = 266, /**< AL Calculator */
SDL_SCANCODE_COMPUTER = 267,
SDL_SCANCODE_AC_SEARCH = 268,
SDL_SCANCODE_AC_HOME = 269,
SDL_SCANCODE_AC_BACK = 270,
SDL_SCANCODE_AC_FORWARD = 271,
SDL_SCANCODE_AC_STOP = 272,
SDL_SCANCODE_AC_REFRESH = 273,
SDL_SCANCODE_AC_BOOKMARKS = 274,
SDL_SCANCODE_AC_SEARCH = 268, /**< AC Search */
SDL_SCANCODE_AC_HOME = 269, /**< AC Home */
SDL_SCANCODE_AC_BACK = 270, /**< AC Back */
SDL_SCANCODE_AC_FORWARD = 271, /**< AC Forward */
SDL_SCANCODE_AC_STOP = 272, /**< AC Stop */
SDL_SCANCODE_AC_REFRESH = 273, /**< AC Refresh */
SDL_SCANCODE_AC_BOOKMARKS = 274, /**< AC Bookmarks */
/* @} *//* Usage page 0x0C */
@ -383,19 +388,51 @@ typedef enum
SDL_SCANCODE_KBDILLUMDOWN = 279,
SDL_SCANCODE_KBDILLUMUP = 280,
SDL_SCANCODE_EJECT = 281,
SDL_SCANCODE_SLEEP = 282,
SDL_SCANCODE_SLEEP = 282, /**< SC System Sleep */
SDL_SCANCODE_APP1 = 283,
SDL_SCANCODE_APP2 = 284,
/* @} *//* Walther keys */
/**
* \name Usage page 0x0C (additional media keys)
*
* These values are mapped from usage page 0x0C (USB consumer page).
*/
/* @{ */
SDL_SCANCODE_AUDIOREWIND = 285,
SDL_SCANCODE_AUDIOFASTFORWARD = 286,
/* @} *//* Usage page 0x0C (additional media keys) */
/**
* \name Mobile keys
*
* These are values that are often used on mobile phones.
*/
/* @{ */
SDL_SCANCODE_SOFTLEFT = 287, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting
a software defined function shown on the bottom left
of the display. */
SDL_SCANCODE_SOFTRIGHT = 288, /**< Usually situated below the display on phones and
used as a multi-function feature key for selecting
a software defined function shown on the bottom right
of the display. */
SDL_SCANCODE_CALL = 289, /**< Used for accepting phone calls. */
SDL_SCANCODE_ENDCALL = 290, /**< Used for rejecting phone calls. */
/* @} *//* Mobile keys */
/* Add any other keys here. */
SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes
for array bounds */
} SDL_Scancode;
#endif /* _SDL_scancode_h */
#endif /* SDL_scancode_h_ */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -291,6 +291,12 @@ const char g_aaKeyStrings[512][20] = // NOLINT(misc-definitions-in-headers)
"sleep",
"app1",
"app2",
"audiorewind",
"audiofastforward",
"softleft",
"softright",
"call",
"endcall",
"mouse1",
"mouse2",
"mouse3",
@ -348,12 +354,6 @@ const char g_aaKeyStrings[512][20] = // NOLINT(misc-definitions-in-headers)
"joy_axis10_right",
"joy_axis11_left",
"joy_axis11_right",
"&342",
"&343",
"&344",
"&345",
"&346",
"&347",
"&348",
"&349",
"&350",

View file

@ -248,67 +248,73 @@ enum
KEY_SLEEP = 282,
KEY_APP1 = 283,
KEY_APP2 = 284,
KEY_AUDIOREWIND = 285,
KEY_AUDIOFASTFORWARD = 286,
KEY_SOFTLEFT = 287,
KEY_SOFTRIGHT = 288,
KEY_CALL = 289,
KEY_ENDCALL = 290,
KEY_MOUSE_1 = 285,
KEY_MOUSE_2 = 286,
KEY_MOUSE_3 = 287,
KEY_MOUSE_4 = 288,
KEY_MOUSE_5 = 289,
KEY_MOUSE_6 = 290,
KEY_MOUSE_7 = 291,
KEY_MOUSE_8 = 292,
KEY_MOUSE_9 = 293,
KEY_MOUSE_WHEEL_UP = 294,
KEY_MOUSE_WHEEL_DOWN = 295,
KEY_MOUSE_WHEEL_LEFT = 296,
KEY_MOUSE_WHEEL_RIGHT = 297,
KEY_MOUSE_1 = 291,
KEY_MOUSE_2 = 292,
KEY_MOUSE_3 = 293,
KEY_MOUSE_4 = 294,
KEY_MOUSE_5 = 295,
KEY_MOUSE_6 = 296,
KEY_MOUSE_7 = 297,
KEY_MOUSE_8 = 298,
KEY_MOUSE_9 = 299,
KEY_MOUSE_WHEEL_UP = 300,
KEY_MOUSE_WHEEL_DOWN = 301,
KEY_MOUSE_WHEEL_LEFT = 302,
KEY_MOUSE_WHEEL_RIGHT = 303,
KEY_JOYSTICK_BUTTON_0 = 298,
KEY_JOYSTICK_BUTTON_1 = 299,
KEY_JOYSTICK_BUTTON_2 = 300,
KEY_JOYSTICK_BUTTON_3 = 301,
KEY_JOYSTICK_BUTTON_4 = 302,
KEY_JOYSTICK_BUTTON_5 = 303,
KEY_JOYSTICK_BUTTON_6 = 304,
KEY_JOYSTICK_BUTTON_7 = 305,
KEY_JOYSTICK_BUTTON_8 = 306,
KEY_JOYSTICK_BUTTON_9 = 307,
KEY_JOYSTICK_BUTTON_10 = 308,
KEY_JOYSTICK_BUTTON_11 = 309,
KEY_JOYSTICK_BUTTON_0 = 304,
KEY_JOYSTICK_BUTTON_1 = 305,
KEY_JOYSTICK_BUTTON_2 = 306,
KEY_JOYSTICK_BUTTON_3 = 307,
KEY_JOYSTICK_BUTTON_4 = 308,
KEY_JOYSTICK_BUTTON_5 = 309,
KEY_JOYSTICK_BUTTON_6 = 310,
KEY_JOYSTICK_BUTTON_7 = 311,
KEY_JOYSTICK_BUTTON_8 = 312,
KEY_JOYSTICK_BUTTON_9 = 313,
KEY_JOYSTICK_BUTTON_10 = 314,
KEY_JOYSTICK_BUTTON_11 = 315,
KEY_JOY_HAT0_UP = 310,
KEY_JOY_HAT0_LEFT = 311,
KEY_JOY_HAT0_RIGHT = 312,
KEY_JOY_HAT0_DOWN = 313,
KEY_JOY_HAT1_UP = 314,
KEY_JOY_HAT1_LEFT = 315,
KEY_JOY_HAT1_RIGHT = 316,
KEY_JOY_HAT1_DOWN = 317,
KEY_JOY_HAT0_UP = 316,
KEY_JOY_HAT0_LEFT = 317,
KEY_JOY_HAT0_RIGHT = 318,
KEY_JOY_HAT0_DOWN = 319,
KEY_JOY_HAT1_UP = 320,
KEY_JOY_HAT1_LEFT = 321,
KEY_JOY_HAT1_RIGHT = 322,
KEY_JOY_HAT1_DOWN = 323,
KEY_JOY_AXIS_0_LEFT = 318,
KEY_JOY_AXIS_0_RIGHT = 319,
KEY_JOY_AXIS_1_LEFT = 320,
KEY_JOY_AXIS_1_RIGHT = 321,
KEY_JOY_AXIS_2_LEFT = 322,
KEY_JOY_AXIS_2_RIGHT = 323,
KEY_JOY_AXIS_3_LEFT = 324,
KEY_JOY_AXIS_3_RIGHT = 325,
KEY_JOY_AXIS_4_LEFT = 326,
KEY_JOY_AXIS_4_RIGHT = 327,
KEY_JOY_AXIS_5_LEFT = 328,
KEY_JOY_AXIS_5_RIGHT = 329,
KEY_JOY_AXIS_6_LEFT = 330,
KEY_JOY_AXIS_6_RIGHT = 331,
KEY_JOY_AXIS_7_LEFT = 332,
KEY_JOY_AXIS_7_RIGHT = 333,
KEY_JOY_AXIS_8_LEFT = 334,
KEY_JOY_AXIS_8_RIGHT = 335,
KEY_JOY_AXIS_9_LEFT = 336,
KEY_JOY_AXIS_9_RIGHT = 337,
KEY_JOY_AXIS_10_LEFT = 338,
KEY_JOY_AXIS_10_RIGHT = 339,
KEY_JOY_AXIS_11_LEFT = 340,
KEY_JOY_AXIS_11_RIGHT = 341,
KEY_JOY_AXIS_0_LEFT = 324,
KEY_JOY_AXIS_0_RIGHT = 325,
KEY_JOY_AXIS_1_LEFT = 326,
KEY_JOY_AXIS_1_RIGHT = 327,
KEY_JOY_AXIS_2_LEFT = 328,
KEY_JOY_AXIS_2_RIGHT = 329,
KEY_JOY_AXIS_3_LEFT = 330,
KEY_JOY_AXIS_3_RIGHT = 331,
KEY_JOY_AXIS_4_LEFT = 332,
KEY_JOY_AXIS_4_RIGHT = 333,
KEY_JOY_AXIS_5_LEFT = 334,
KEY_JOY_AXIS_5_RIGHT = 335,
KEY_JOY_AXIS_6_LEFT = 336,
KEY_JOY_AXIS_6_RIGHT = 337,
KEY_JOY_AXIS_7_LEFT = 338,
KEY_JOY_AXIS_7_RIGHT = 339,
KEY_JOY_AXIS_8_LEFT = 340,
KEY_JOY_AXIS_8_RIGHT = 341,
KEY_JOY_AXIS_9_LEFT = 342,
KEY_JOY_AXIS_9_RIGHT = 343,
KEY_JOY_AXIS_10_LEFT = 344,
KEY_JOY_AXIS_10_RIGHT = 345,
KEY_JOY_AXIS_11_LEFT = 346,
KEY_JOY_AXIS_11_RIGHT = 347,
KEY_LAST = 512,