SDL: Updated SDL3 scancode list

From 9d816c72ef7309331819bbac98fc55b0cbb27037 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 18 Jun 2024 07:22:39 -0700
Subject: [PATCH] Updated SDL3 scancode list

This adds more app editing and audio control keys and removes keys that launch applications

Work in progress on https://github.com/libsdl-org/SDL/issues/6390
---
 build-scripts/SDL_migration.cocci           |  72 ++++++++++++
 docs/README-migration.md                    |  49 +++++++++
 include/SDL3/SDL_keycode.h                  |  44 ++++----
 include/SDL3/SDL_oldnames.h                 |  40 +++++++
 include/SDL3/SDL_scancode.h                 |  83 ++++++--------
 src/events/SDL_keyboard.c                   | 116 ++++++++++----------
 src/events/scancodes_linux.h                |  66 +++++------
 src/events/scancodes_windows.h              |  18 +--
 src/events/scancodes_xfree86.h              |  58 +++++-----
 src/video/android/SDL_androidkeyboard.c     |  36 +++---
 src/video/emscripten/SDL_emscriptenevents.c |  64 +++++++----
 test/testautomation_keyboard.c              |   8 +-
 12 files changed, 412 insertions(+), 242 deletions(-)

diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci
index e1629916db979..328b359e07b7d 100644
--- a/build-scripts/SDL_migration.cocci
+++ b/build-scripts/SDL_migration.cocci
@@ -3312,3 +3312,75 @@ typedef SDL_Colour, SDL_Color;
 - SDL_SwapBE64
 + SDL_Swap64BE
   (...)
+@@
+@@
+- SDL_SCANCODE_AUDIOMUTE
++ SDL_SCANCODE_MUTE
+@@
+@@
+- SDLK_AUDIOMUTE
++ SDLK_MUTE
+@@
+@@
+- SDL_SCANCODE_EJECT
++ SDL_SCANCODE_MEDIA_EJECT
+@@
+@@
+- SDLK_EJECT
++ SDLK_MEDIA_EJECT
+@@
+@@
+- SDL_SCANCODE_AUDIONEXT
++ SDL_SCANCODE_MEDIA_NEXT_TRACK
+@@
+@@
+- SDLK_AUDIONEXT
++ SDLK_MEDIA_NEXT_TRACK
+@@
+@@
+- SDL_SCANCODE_AUDIOPREV
++ SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
+@@
+@@
+- SDLK_AUDIOPREV
++ SDLK_MEDIA_PREVIOUS_TRACK
+@@
+@@
+- SDL_SCANCODE_AUDIOSTOP
++ SDL_SCANCODE_MEDIA_STOP
+@@
+@@
+- SDLK_AUDIOSTOP
++ SDLK_MEDIA_STOP
+@@
+@@
+- SDL_SCANCODE_AUDIOPLAY
++ SDL_SCANCODE_MEDIA_PLAY
+@@
+@@
+- SDLK_AUDIOPLAY
++ SDLK_MEDIA_PLAY
+@@
+@@
+- SDL_SCANCODE_AUDIOREWIND
++ SDL_SCANCODE_MEDIA_REWIND
+@@
+@@
+- SDLK_AUDIOREWIND
++ SDLK_MEDIA_REWIND
+@@
+@@
+- SDL_SCANCODE_AUDIOFASTFORWARD
++ SDL_SCANCODE_MEDIA_FAST_FORWARD
+@@
+@@
+- SDLK_AUDIOFASTFORWARD
++ SDLK_MEDIA_FAST_FORWARD
+@@
+@@
+- SDL_SCANCODE_MEDIASELECT
++ SDL_SCANCODE_MEDIA_SELECT
+@@
+@@
+- SDLK_MEDIASELECT
++ SDLK_MEDIA_SELECT
diff --git a/docs/README-migration.md b/docs/README-migration.md
index 90d1d040c3cd2..a2ca542d15f4a 100644
--- a/docs/README-migration.md
+++ b/docs/README-migration.md
@@ -904,6 +904,19 @@ SDL_Keycode is now Uint32 and the SDLK_* constants are now defines instead of an
 The following symbols have been removed:
 
 * KMOD_RESERVED - No replacement. A bit named "RESERVED" probably shouldn't be used in an app, but if you need it, this was equivalent to KMOD_SCROLL (0x8000) in SDL2.
+* SDLK_WWW
+* SDLK_MAIL
+* SDLK_CALCULATOR
+* SDLK_COMPUTER
+* SDLK_BRIGHTNESSDOWN
+* SDLK_BRIGHTNESSUP
+* SDLK_DISPLAYSWITCH
+* SDLK_KBDILLUMTOGGLE
+* SDLK_KBDILLUMDOWN
+* SDLK_KBDILLUMUP
+* SDLK_APP1
+* SDLK_APP2
+
 
 The following symbols have been renamed:
 * KMOD_ALT => SDL_KMOD_ALT
@@ -923,7 +936,16 @@ The following symbols have been renamed:
 * KMOD_RSHIFT => SDL_KMOD_RSHIFT
 * KMOD_SCROLL => SDL_KMOD_SCROLL
 * KMOD_SHIFT => SDL_KMOD_SHIFT
+* SDLK_AUDIOFASTFORWARD => SDLK_MEDIA_FAST_FORWARD
+* SDLK_AUDIOMUTE => SDLK_MUTE
+* SDLK_AUDIONEXT => SDLK_MEDIA_NEXT_TRACK
+* SDLK_AUDIOPLAY => SDLK_MEDIA_PLAY
+* SDLK_AUDIOPREV => SDLK_MEDIA_PREVIOUS_TRACK
+* SDLK_AUDIOREWIND => SDLK_MEDIA_REWIND
+* SDLK_AUDIOSTOP => SDLK_MEDIA_STOP
 * SDLK_BACKQUOTE => SDLK_GRAVE
+* SDLK_EJECT => SDLK_MEDIA_EJECT
+* SDLK_MEDIASELECT => SDLK_MEDIA_SELECT
 * SDLK_QUOTE => SDLK_APOSTROPHE
 * SDLK_QUOTEDBL => SDLK_DBLAPOSTROPHE
 
@@ -1415,6 +1437,33 @@ The following functions have been renamed:
 The following structures have been renamed:
 * SDL_RWops => SDL_IOStream
 
+## SDL_scancode.h
+
+The following symbols have been removed:
+* SDL_SCANCODE_WWW
+* SDL_SCANCODE_MAIL
+* SDL_SCANCODE_CALCULATOR
+* SDL_SCANCODE_COMPUTER
+* SDL_SCANCODE_BRIGHTNESSDOWN
+* SDL_SCANCODE_BRIGHTNESSUP
+* SDL_SCANCODE_DISPLAYSWITCH
+* SDL_SCANCODE_KBDILLUMTOGGLE
+* SDL_SCANCODE_KBDILLUMDOWN
+* SDL_SCANCODE_KBDILLUMUP
+* SDL_SCANCODE_APP1
+* SDL_SCANCODE_APP2
+
+The following symbols have been renamed:
+* SDL_SCANCODE_AUDIOFASTFORWARD => SDL_SCANCODE_MEDIA_FAST_FORWARD
+* SDL_SCANCODE_AUDIOMUTE => SDL_SCANCODE_MUTE
+* SDL_SCANCODE_AUDIONEXT => SDL_SCANCODE_MEDIA_NEXT_TRACK
+* SDL_SCANCODE_AUDIOPLAY => SDL_SCANCODE_MEDIA_PLAY
+* SDL_SCANCODE_AUDIOPREV => SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
+* SDL_SCANCODE_AUDIOREWIND => SDL_SCANCODE_MEDIA_REWIND
+* SDL_SCANCODE_AUDIOSTOP => SDL_SCANCODE_MEDIA_STOP
+* SDL_SCANCODE_EJECT => SDL_SCANCODE_MEDIA_EJECT
+* SDL_SCANCODE_MEDIASELECT => SDL_SCANCODE_MEDIA_SELECT
+
 ## SDL_sensor.h
 
 SDL_SensorID has changed from Sint32 to Uint32, with an invalid ID being 0.
diff --git a/include/SDL3/SDL_keycode.h b/include/SDL3/SDL_keycode.h
index 6ceb4cff99359..26c03da20c8d5 100644
--- a/include/SDL3/SDL_keycode.h
+++ b/include/SDL3/SDL_keycode.h
@@ -261,16 +261,28 @@ typedef Uint32 SDL_Keycode;
 #define SDLK_RALT   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RALT)
 #define SDLK_RGUI   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RGUI)
 #define SDLK_MODE   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MODE)
-#define SDLK_AUDIONEXT  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIONEXT)
-#define SDLK_AUDIOPREV  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPREV)
-#define SDLK_AUDIOSTOP  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOSTOP)
-#define SDLK_AUDIOPLAY  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOPLAY)
-#define SDLK_AUDIOMUTE  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOMUTE)
-#define SDLK_MEDIASELECT    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIASELECT)
-#define SDLK_WWW    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WWW)
-#define SDLK_MAIL   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MAIL)
-#define SDLK_CALCULATOR SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALCULATOR)
-#define SDLK_COMPUTER   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_COMPUTER)
+#define SDLK_SLEEP  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
+#define SDLK_WAKE  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_WAKE)
+#define SDLK_CHANNEL_INCREMENT  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_INCREMENT)
+#define SDLK_CHANNEL_DECREMENT  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CHANNEL_DECREMENT)
+#define SDLK_MEDIA_PLAY SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY)
+#define SDLK_MEDIA_PAUSE    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PAUSE)
+#define SDLK_MEDIA_RECORD   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_RECORD)
+#define SDLK_MEDIA_FAST_FORWARD SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_FAST_FORWARD)
+#define SDLK_MEDIA_REWIND   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_REWIND)
+#define SDLK_MEDIA_NEXT_TRACK   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_NEXT_TRACK)
+#define SDLK_MEDIA_PREVIOUS_TRACK   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PREVIOUS_TRACK)
+#define SDLK_MEDIA_STOP SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_STOP)
+#define SDLK_MEDIA_EJECT    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_EJECT)
+#define SDLK_MEDIA_PLAY_PAUSE    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_PLAY_PAUSE)
+#define SDLK_MEDIA_SELECT   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_MEDIA_SELECT)
+#define SDLK_AC_NEW SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_NEW)
+#define SDLK_AC_OPEN    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_OPEN)
+#define SDLK_AC_CLOSE   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_CLOSE)
+#define SDLK_AC_EXIT    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_EXIT)
+#define SDLK_AC_SAVE    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SAVE)
+#define SDLK_AC_PRINT   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PRINT)
+#define SDLK_AC_PROPERTIES  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_PROPERTIES)
 #define SDLK_AC_SEARCH  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_SEARCH)
 #define SDLK_AC_HOME    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_HOME)
 #define SDLK_AC_BACK    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BACK)
@@ -278,18 +290,6 @@ typedef Uint32 SDL_Keycode;
 #define SDLK_AC_STOP    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_STOP)
 #define SDLK_AC_REFRESH SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_REFRESH)
 #define SDLK_AC_BOOKMARKS   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AC_BOOKMARKS)
-#define SDLK_BRIGHTNESSDOWN SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSDOWN)
-#define SDLK_BRIGHTNESSUP   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_BRIGHTNESSUP)
-#define SDLK_DISPLAYSWITCH  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DISPLAYSWITCH)
-#define SDLK_KBDILLUMTOGGLE SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMTOGGLE)
-#define SDLK_KBDILLUMDOWN   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN)
-#define SDLK_KBDILLUMUP SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP)
-#define SDLK_EJECT  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT)
-#define SDLK_SLEEP  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP)
-#define SDLK_APP1   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1)
-#define SDLK_APP2   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2)
-#define SDLK_AUDIOREWIND    SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND)
-#define SDLK_AUDIOFASTFORWARD   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD)
 #define SDLK_SOFTLEFT   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTLEFT)
 #define SDLK_SOFTRIGHT  SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SOFTRIGHT)
 #define SDLK_CALL   SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_CALL)
diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h
index cfa4ef1d89402..68c8f4a58e090 100644
--- a/include/SDL3/SDL_oldnames.h
+++ b/include/SDL3/SDL_oldnames.h
@@ -366,7 +366,16 @@
 #define KMOD_RSHIFT SDL_KMOD_RSHIFT
 #define KMOD_SCROLL SDL_KMOD_SCROLL
 #define KMOD_SHIFT SDL_KMOD_SHIFT
+#define SDLK_AUDIOFASTFORWARD SDLK_MEDIA_FAST_FORWARD
+#define SDLK_AUDIOMUTE SDLK_MUTE
+#define SDLK_AUDIONEXT SDLK_MEDIA_NEXT_TRACK
+#define SDLK_AUDIOPLAY SDLK_MEDIA_PLAY
+#define SDLK_AUDIOPREV SDLK_MEDIA_PREVIOUS_TRACK
+#define SDLK_AUDIOREWIND SDLK_MEDIA_REWIND
+#define SDLK_AUDIOSTOP SDLK_MEDIA_STOP
 #define SDLK_BACKQUOTE SDLK_GRAVE
+#define SDLK_EJECT SDLK_MEDIA_EJECT
+#define SDLK_MEDIASELECT SDLK_MEDIA_SELECT
 #define SDLK_QUOTE SDLK_APOSTROPHE
 #define SDLK_QUOTEDBL SDLK_DBLAPOSTROPHE
 
@@ -517,6 +526,17 @@
 #define SDL_WriteLE32 SDL_WriteU32LE
 #define SDL_WriteLE64 SDL_WriteU64LE
 
+/* ##SDL_scancode.h */
+#define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_MEDIA_FAST_FORWARD
+#define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_MUTE
+#define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_MEDIA_NEXT_TRACK
+#define SDL_SCANCODE_AUDIOPLAY SDL_SCANCODE_MEDIA_PLAY
+#define SDL_SCANCODE_AUDIOPREV SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
+#define SDL_SCANCODE_AUDIOREWIND SDL_SCANCODE_MEDIA_REWIND
+#define SDL_SCANCODE_AUDIOSTOP SDL_SCANCODE_MEDIA_STOP
+#define SDL_SCANCODE_EJECT SDL_SCANCODE_MEDIA_EJECT
+#define SDL_SCANCODE_MEDIASELECT SDL_SCANCODE_MEDIA_SELECT
+
 /* ##SDL_sensor.h */
 #define SDL_SensorClose SDL_CloseSensor
 #define SDL_SensorFromInstanceID SDL_GetSensorFromInstanceID
@@ -915,7 +935,16 @@
 #define KMOD_RSHIFT KMOD_RSHIFT_renamed_SDL_KMOD_RSHIFT
 #define KMOD_SCROLL KMOD_SCROLL_renamed_SDL_KMOD_SCROLL
 #define KMOD_SHIFT KMOD_SHIFT_renamed_SDL_KMOD_SHIFT
+#define SDLK_AUDIOFASTFORWARD SDLK_AUDIOFASTFORWARD_renamed_SDLK_MEDIA_FAST_FORWARD
+#define SDLK_AUDIOMUTE SDLK_AUDIOMUTE_renamed_SDLK_MUTE
+#define SDLK_AUDIONEXT SDLK_AUDIONEXT_renamed_SDLK_MEDIA_NEXT_TRACK
+#define SDLK_AUDIOPLAY SDLK_AUDIOPLAY_renamed_SDLK_MEDIA_PLAY
+#define SDLK_AUDIOPREV SDLK_AUDIOPREV_renamed_SDLK_MEDIA_PREVIOUS_TRACK
+#define SDLK_AUDIOREWIND SDLK_AUDIOREWIND_renamed_SDLK_MEDIA_REWIND
+#define SDLK_AUDIOSTOP SDLK_AUDIOSTOP_renamed_SDLK_MEDIA_STOP
 #define SDLK_BACKQUOTE SDLK_BACKQUOTE_renamed_SDLK_GRAVE
+#define SDLK_EJECT SDLK_EJECT_renamed_SDLK_MEDIA_EJECT
+#define SDLK_MEDIASELECT SDLK_MEDIASELECT_renamed_SDLK_MEDIA_SELECT
 #define SDLK_QUOTE SDLK_QUOTE_renamed_SDLK_APOSTROPHE
 #define SDLK_QUOTEDBL SDLK_QUOTEDBL_renamed_SDLK_DBLAPOSTROPHE
 
@@ -1066,6 +1095,17 @@
 #define SDL_WriteLE32 SDL_WriteLE32_renamed_SDL_WriteU32LE
 #define SDL_WriteLE64 SDL_WriteLE64_renamed_SDL_WriteU64LE
 
+/* ##SDL_scancode.h */
+#define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_AUDIOFASTFORWARD_renamed_SDL_SCANCODE_MEDIA_FAST_FORWARD
+#define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_AUDIOMUTE_renamed_SDL_SCANCODE_MUTE
+#define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_AUDIONEXT_renamed_SDL_SCANCODE_MEDIA_NEXT_TRACK
+#define SDL_SCANCODE_AUDIOPLAY SDL_SCANCODE_AUDIOPLAY_renamed_SDL_SCANCODE_MEDIA_PLAY
+#define SDL_SCANCODE_AUDIOPREV SDL_SCANCODE_AUDIOPREV_renamed_SDL_SCANCODE_MEDIA_PREVIOUS_TRACK
+#define SDL_SCANCODE_AUDIOREWIND SDL_SCANCODE_AUDIOREWIND_renamed_SDL_SCANCODE_MEDIA_REWIND
+#define SDL_SCANCODE_AUDIOSTOP SDL_SCANCODE_AUDIOSTOP_renamed_SDL_SCANCODE_MEDIA_STOP
+#define SDL_SCANCODE_EJECT SDL_SCANCODE_EJECT_renamed_SDL_SCANCODE_MEDIA_EJECT
+#define SDL_SCANCODE_MEDIASELECT SDL_SCANCODE_MEDIASELECT_renamed_SDL_SCANCODE_MEDIA_SELECT
+
 /* ##SDL_sensor.h */
 #define SDL_SensorClose SDL_SensorClose_renamed_SDL_CloseSensor
 #define SDL_SensorFromInstanceID SDL_SensorFromInstanceID_renamed_SDL_GetSensorFromInstanceID
diff --git a/include/SDL3/SDL_scancode.h b/include/SDL3/SDL_scancode.h
index 1adeff5f2297e..95317332e8179 100644
--- a/include/SDL3/SDL_scancode.h
+++ b/include/SDL3/SDL_scancode.h
@@ -356,59 +356,42 @@ typedef enum SDL_Scancode
      */
     /* @{ */
 
-    SDL_SCANCODE_AUDIONEXT = 258,
-    SDL_SCANCODE_AUDIOPREV = 259,
-    SDL_SCANCODE_AUDIOSTOP = 260,
-    SDL_SCANCODE_AUDIOPLAY = 261,
-    SDL_SCANCODE_AUDIOMUTE = 262,
-    SDL_SCANCODE_MEDIASELECT = 263,
-    SDL_SCANCODE_WWW = 264,             /**< AL Internet Browser */
-    SDL_SCANCODE_MAIL = 265,
-    SDL_SCANCODE_CALCULATOR = 266,      /**< AL Calculator */
-    SDL_SCANCODE_COMPUTER = 267,
-    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 */
+    SDL_SCANCODE_SLEEP = 258,                   /**< Sleep */
+    SDL_SCANCODE_WAKE = 259,                    /**< Wake */
+
+    SDL_SCANCODE_CHANNEL_INCREMENT = 260,       /**< Channel Increment */
+    SDL_SCANCODE_CHANNEL_DECREMENT = 261,       /**< Channel Decrement */
+
+    SDL_SCANCODE_MEDIA_PLAY = 262,          /**< Play */
+    SDL_SCANCODE_MEDIA_PAUSE = 263,         /**< Pause */
+    SDL_SCANCODE_MEDIA_RECORD = 264,        /**< Record */
+    SDL_SCANCODE_MEDIA_FAST_FORWARD = 265,  /**< Fast Forward */
+    SDL_SCANCODE_MEDIA_REWIND = 266,        /**< Rewind */
+    SDL_SCANCODE_MEDIA_NEXT_TRACK = 267,    /**< Next Track */
+    SDL_SCANCODE_MEDIA_PREVIOUS_TRACK = 268, /**< Previous Track */
+    SDL_SCANCODE_MEDIA_STOP = 269,          /**< Stop */
+    SDL_SCANCODE_MEDIA_EJECT = 270,         /**< Eject */
+    SDL_SCANCODE_MEDIA_PLAY_PAUSE = 271,    /**< Play / Pause */
+    SDL_SCANCODE_MEDIA_SELECT = 272,        /* Media Select */
+
+    SDL_SCANCODE_AC_NEW = 273,              /**< AC New */
+    SDL_SCANCODE_AC_OPEN = 274,             /**< AC Open */
+    SDL_SCANCODE_AC_CLOSE = 275,            /**< AC Close */
+    SDL_SCANCODE_AC_EXIT = 276,             /**< AC Exit */
+    SDL_SCANCODE_AC_SAVE = 277,             /**< AC Save */
+    SDL_SCANCODE_AC_PRINT = 278,            /**< AC Print */
+    SDL_SCANCODE_AC_PROPERTIES = 279,       /**< AC Properties */
+
+    SDL_SCANCODE_AC_SEARCH = 280,           /**< AC Search */
+    SDL_SCANCODE_AC_HOME = 281,             /**< AC Home */
+    SDL_SCANCODE_AC_BACK = 282,             /**< AC Back */
+    SDL_SCANCODE_AC_FORWARD = 283,          /**< AC Forward */
+    SDL_SCANCODE_AC_STOP = 284,             /**< AC Stop */
+    SDL_SCANCODE_AC_REFRESH = 285,          /**< AC Refresh */
+    SDL_SCANCODE_AC_BOOKMARKS = 286,        /**< AC Bookmarks */
 
     /* @} *//* Usage page 0x0C */
 
-    /**
-     *  \name Walther keys
-     *
-     *  These are values that Christian Walther added (for mac keyboard?).
-     */
-    /* @{ */
-
-    SDL_SCANCODE_BRIGHTNESSDOWN = 275,
-    SDL_SCANCODE_BRIGHTNESSUP = 276,
-    SDL_SCANCODE_DISPLAYSWITCH = 277, /**< display mirroring/dual display
-                                           switch, video mode switch */
-    SDL_SCANCODE_KBDILLUMTOGGLE = 278,
-    SDL_SCANCODE_KBDILLUMDOWN = 279,
-    SDL_SCANCODE_KBDILLUMUP = 280,
-    SDL_SCANCODE_EJECT = 281,
-    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
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index e59844b144917..c96058710d306 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -321,35 +321,35 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = {
     /* 255 */ SDLK_UNKNOWN,
     /* 256 */ SDLK_UNKNOWN,
     /* 257 */ SDLK_MODE,
-    /* 258 */ SDLK_AUDIONEXT,
-    /* 259 */ SDLK_AUDIOPREV,
-    /* 260 */ SDLK_AUDIOSTOP,
-    /* 261 */ SDLK_AUDIOPLAY,
-    /* 262 */ SDLK_AUDIOMUTE,
-    /* 263 */ SDLK_MEDIASELECT,
-    /* 264 */ SDLK_WWW,
-    /* 265 */ SDLK_MAIL,
-    /* 266 */ SDLK_CALCULATOR,
-    /* 267 */ SDLK_COMPUTER,
-    /* 268 */ SDLK_AC_SEARCH,
-    /* 269 */ SDLK_AC_HOME,
-    /* 270 */ SDLK_AC_BACK,
-    /* 271 */ SDLK_AC_FORWARD,
-    /* 272 */ SDLK_AC_STOP,
-    /* 273 */ SDLK_AC_REFRESH,
-    /* 274 */ SDLK_AC_BOOKMARKS,
-    /* 275 */ SDLK_BRIGHTNESSDOWN,
-    /* 276 */ SDLK_BRIGHTNESSUP,
-    /* 277 */ SDLK_DISPLAYSWITCH,
-    /* 278 */ SDLK_KBDILLUMTOGGLE,
-    /* 279 */ SDLK_KBDILLUMDOWN,
-    /* 280 */ SDLK_KBDILLUMUP,
-    /* 281 */ SDLK_EJECT,
-    /* 282 */ SDLK_SLEEP,
-    /* 283 */ SDLK_APP1,
-    /* 284 */ SDLK_APP2,
-    /* 285 */ SDLK_AUDIOREWIND,
-    /* 286 */ SDLK_AUDIOFASTFORWARD,
+    /* 258 */ SDLK_SLEEP,
+    /* 258 */ SDLK_WAKE,
+    /* 260 */ SDLK_CHANNEL_INCREMENT,
+    /* 261 */ SDLK_CHANNEL_DECREMENT,
+    /* 262 */ SDLK_MEDIA_PLAY,
+    /* 263 */ SDLK_MEDIA_PAUSE,
+    /* 264 */ SDLK_MEDIA_RECORD,
+    /* 265 */ SDLK_MEDIA_FAST_FORWARD,
+    /* 266 */ SDLK_MEDIA_REWIND,
+    /* 267 */ SDLK_MEDIA_NEXT_TRACK,
+    /* 268 */ SDLK_MEDIA_PREVIOUS_TRACK,
+    /* 269 */ SDLK_MEDIA_STOP,
+    /* 270 */ SDLK_MEDIA_EJECT,
+    /* 271 */ SDLK_MEDIA_PLAY_PAUSE,
+    /* 272 */ SDLK_MEDIA_SELECT,
+    /* 273 */ SDLK_AC_NEW,
+    /* 274 */ SDLK_AC_OPEN,
+    /* 275 */ SDLK_AC_CLOSE,
+    /* 276 */ SDLK_AC_EXIT,
+    /* 277 */ SDLK_AC_SAVE,
+    /* 278 */ SDLK_AC_PRINT,
+    /* 279 */ SDLK_AC_PROPERTIES,
+    /* 280 */ SDLK_AC_SEARCH,
+    /* 281 */ SDLK_AC_HOME,
+    /* 282 */ SDLK_AC_BACK,
+    /* 283 */ SDLK_AC_FORWARD,
+    /* 284 */ SDLK_AC_STOP,
+    /* 285 */ SDLK_AC_REFRESH,
+    /* 286 */ SDLK_AC_BOOKMARKS,
     /* 287 */ SDLK_SOFTLEFT,
     /* 288 */ SDLK_SOFTRIGHT,
     /* 289 */ SDLK_CALL,
@@ -615,35 +615,35 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = {
     /* 255 */ NULL,
     /* 256 */ NULL,
     /* 257 */ "ModeSwitch",
-    /* 258 */ "AudioNext",
-    /* 259 */ "AudioPrev",
-    /* 260 */ "AudioStop",
-    /* 261 */ "AudioPlay",
-    /* 262 */ "AudioMute",
-    /* 263 */ "MediaSelect",
-    /* 264 */ "WWW",
-    /* 265 */ "Mail",
-    /* 266 */ "Calculator",
-    /* 267 */ "Computer",
-    /* 268 */ "AC Search",
-    /* 269 */ "AC Home",
-    /* 270 */ "AC Back",
-    /* 271 */ "AC Forward",
-    /* 272 */ "AC Stop",
-    /* 273 */ "AC Refresh",
-    /* 274 */ "AC Bookmarks",
-    /* 275 */ "BrightnessDown",
-    /* 276 */ "BrightnessUp",
-    /* 277 */ "DisplaySwitch",
-    /* 278 */ "KBDIllumToggle",
-    /* 279 */ "KBDIllumDown",
-    /* 280 */ "KBDIllumUp",
-    /* 281 */ "Eject",
-    /* 282 */ "Sleep",
-    /* 283 */ "App1",
-    /* 284 */ "App2",
-    /* 285 */ "AudioRewind",
-    /* 286 */ "AudioFastForward",
+    /* 258 */ "Sleep",
+    /* 259 */ "Wake",
+    /* 260 */ "ChannelUp",
+    /* 261 */ "ChannelDown",
+    /* 262 */ "MediaPlay",
+    /* 263 */ "MediaPause",
+    /* 264 */ "MediaRecord",
+    /* 265 */ "MediaFastForward",
+    /* 266 */ "MediaRewind",
+    /* 267 */ "MediaTrackNext",
+    /* 268 */ "MediaTrackPrevious",
+    /* 269 */ "MediaStop",
+    /* 270 */ "Eject",
+    /* 271 */ "MediaPlayPause",
+    /* 272 */ "MediaSelect",
+    /* 273 */ "AC New",
+    /* 274 */ "AC Open",
+    /* 275 */ "AC Close",
+    /* 276 */ "AC Exit",
+    /* 277 */ "AC Save",
+    /* 278 */ "AC Print",
+    /* 279 */ "AC Properties",
+    /* 280 */ "AC Search",
+    /* 281 */ "AC Home",
+    /* 282 */ "AC Back",
+    /* 283 */ "AC Forward",
+    /* 284 */ "AC Stop",
+    /* 285 */ "AC Refresh",
+    /* 286 */ "AC Bookmarks",
     /* 287 */ "SoftLeft",
     /* 288 */ "SoftRight",
     /* 289 */ "Call",
diff --git a/src/events/scancodes_linux.h b/src/events/scancodes_linux.h
index a9869a8d009b1..9c8e2063ade90 100644
--- a/src/events/scancodes_linux.h
+++ b/src/events/scancodes_linux.h
@@ -156,17 +156,17 @@ static SDL_Scancode const linux_scancode_table[] = {
     /* 127, 0x07f */    SDL_SCANCODE_APPLICATION,       /* KEY_COMPOSE */
     /* 128, 0x080 */    SDL_SCANCODE_STOP,              /* KEY_STOP */
     /* 129, 0x081 */    SDL_SCANCODE_AGAIN,             /* KEY_AGAIN */
-    /* 130, 0x082 */    SDL_SCANCODE_UNKNOWN,           /* KEY_PROPS */
+    /* 130, 0x082 */    SDL_SCANCODE_AC_PROPERTIES,     /* KEY_PROPS */
     /* 131, 0x083 */    SDL_SCANCODE_UNDO,              /* KEY_UNDO */
     /* 132, 0x084 */    SDL_SCANCODE_UNKNOWN,           /* KEY_FRONT */
     /* 133, 0x085 */    SDL_SCANCODE_COPY,              /* KEY_COPY */
-    /* 134, 0x086 */    SDL_SCANCODE_UNKNOWN,           /* KEY_OPEN */
+    /* 134, 0x086 */    SDL_SCANCODE_AC_OPEN,           /* KEY_OPEN */
     /* 135, 0x087 */    SDL_SCANCODE_PASTE,             /* KEY_PASTE */
     /* 136, 0x088 */    SDL_SCANCODE_FIND,              /* KEY_FIND */
     /* 137, 0x089 */    SDL_SCANCODE_CUT,               /* KEY_CUT */
     /* 138, 0x08a */    SDL_SCANCODE_HELP,              /* KEY_HELP */
     /* 139, 0x08b */    SDL_SCANCODE_MENU,              /* KEY_MENU */
-    /* 140, 0x08c */    SDL_SCANCODE_CALCULATOR,        /* KEY_CALC */
+    /* 140, 0x08c */    SDL_SCANCODE_UNKNOWN,           /* KEY_CALC */
     /* 141, 0x08d */    SDL_SCANCODE_UNKNOWN,           /* KEY_SETUP */
     /* 142, 0x08e */    SDL_SCANCODE_SLEEP,             /* KEY_SLEEP */
     /* 143, 0x08f */    SDL_SCANCODE_UNKNOWN,           /* KEY_WAKEUP */
@@ -174,40 +174,40 @@ static SDL_Scancode const linux_scancode_table[] = {
     /* 145, 0x091 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SENDFILE */
     /* 146, 0x092 */    SDL_SCANCODE_UNKNOWN,           /* KEY_DELETEFILE */
     /* 147, 0x093 */    SDL_SCANCODE_UNKNOWN,           /* KEY_XFER */
-    /* 148, 0x094 */    SDL_SCANCODE_APP1,              /* KEY_PROG1 */
-    /* 149, 0x095 */    SDL_SCANCODE_APP2,              /* KEY_PROG2 */
-    /* 150, 0x096 */    SDL_SCANCODE_WWW,               /* KEY_WWW */
+    /* 148, 0x094 */    SDL_SCANCODE_UNKNOWN,           /* KEY_PROG1 */
+    /* 149, 0x095 */    SDL_SCANCODE_UNKNOWN,           /* KEY_PROG2 */
+    /* 150, 0x096 */    SDL_SCANCODE_UNKNOWN,           /* KEY_WWW */
     /* 151, 0x097 */    SDL_SCANCODE_UNKNOWN,           /* KEY_MSDOS */
     /* 152, 0x098 */    SDL_SCANCODE_UNKNOWN,           /* KEY_COFFEE */
     /* 153, 0x099 */    SDL_SCANCODE_UNKNOWN,           /* KEY_ROTATE_DISPLAY */
     /* 154, 0x09a */    SDL_SCANCODE_UNKNOWN,           /* KEY_CYCLEWINDOWS */
-    /* 155, 0x09b */    SDL_SCANCODE_MAIL,              /* KEY_MAIL */
+    /* 155, 0x09b */    SDL_SCANCODE_UNKNOWN,           /* KEY_MAIL */
     /* 156, 0x09c */    SDL_SCANCODE_AC_BOOKMARKS,      /* KEY_BOOKMARKS */
-    /* 157, 0x09d */    SDL_SCANCODE_COMPUTER,          /* KEY_COMPUTER */
+    /* 157, 0x09d */    SDL_SCANCODE_UNKNOWN,           /* KEY_COMPUTER */
     /* 158, 0x09e */    SDL_SCANCODE_AC_BACK,           /* KEY_BACK */
     /* 159, 0x09f */    SDL_SCANCODE_AC_FORWARD,        /* KEY_FORWARD */
     /* 160, 0x0a0 */    SDL_SCANCODE_UNKNOWN,           /* KEY_CLOSECD */
-    /* 161, 0x0a1 */    SDL_SCANCODE_EJECT,             /* KEY_EJECTCD */
-    /* 162, 0x0a2 */    SDL_SCANCODE_EJECT,             /* KEY_EJECTCLOSECD */
-    /* 163, 0x0a3 */    SDL_SCANCODE_AUDIONEXT,         /* KEY_NEXTSONG */
-    /* 164, 0x0a4 */    SDL_SCANCODE_AUDIOPLAY,         /* KEY_PLAYPAUSE */
-    /* 165, 0x0a5 */    SDL_SCANCODE_AUDIOPREV,         /* KEY_PREVIOUSSONG */
-    /* 166, 0x0a6 */    SDL_SCANCODE_AUDIOSTOP,         /* KEY_STOPCD */
-    /* 167, 0x0a7 */    SDL_SCANCODE_UNKNOWN,           /* KEY_RECORD */
-    /* 168, 0x0a8 */    SDL_SCANCODE_AUDIOREWIND,       /* KEY_REWIND */
+    /* 161, 0x0a1 */    SDL_SCANCODE_MEDIA_EJECT,       /* KEY_EJECTCD */
+    /* 162, 0x0a2 */    SDL_SCANCODE_MEDIA_EJECT,       /* KEY_EJECTCLOSECD */
+    /* 163, 0x0a3 */    SDL_SCANCODE_MEDIA_NEXT_TRACK,  /* KEY_NEXTSONG */
+    /* 164, 0x0a4 */    SDL_SCANCODE_MEDIA_PLAY_PAUSE,   /* KEY_PLAYPAUSE */
+    /* 165, 0x0a5 */    SDL_SCANCODE_MEDIA_PREVIOUS_TRACK, /* KEY_PREVIOUSSONG */
+    /* 166, 0x0a6 */    SDL_SCANCODE_MEDIA_STOP,        /* KEY_STOPCD */
+    /* 167, 0x0a7 */    SDL_SCANCODE_MEDIA_RECORD,      /* KEY_RECORD */
+    /* 168, 0x0a8 */    SDL_SCANCODE_MEDIA_REWIND,      /* KEY_REWIND */
     /* 169, 0x0a9 */    SDL_SCANCODE_UNKNOWN,           /* KEY_PHONE */
     /* 170, 0x0aa */    SDL_SCANCODE_UNKNOWN,           /* KEY_ISO */
     /* 171, 0x0ab */    SDL_SCANCODE_UNKNOWN,           /* KEY_CONFIG */
     /* 172, 0x0ac */    SDL_SCANCODE_AC_HOME,           /* KEY_HOMEPAGE */
     /* 173, 0x0ad */    SDL_SCANCODE_AC_REFRESH,        /* KEY_REFRESH */
-    /* 174, 0x0ae */    SDL_SCANCODE_UNKNOWN,           /* KEY_EXIT */
+    /* 174, 0x0ae */    SDL_SCANCODE_AC_EXIT,           /* KEY_EXIT */
     /* 175, 0x0af */    SDL_SCANCODE_UNKNOWN,           /* KEY_MOVE */
     /* 176, 0x0b0 */    SDL_SCANCODE_UNKNOWN,           /* KEY_EDIT */
     /* 177, 0x0b1 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SCROLLUP */
     /* 178, 0x0b2 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SCROLLDOWN */
     /* 179, 0x0b3 */    SDL_SCANCODE_KP_LEFTPAREN,      /* KEY_KPLEFTPAREN */
     /* 180, 0x0b4 */    SDL_SCANCODE_KP_RIGHTPAREN,     /* KEY_KPRIGHTPAREN */
-    /* 181, 0x0b5 */    SDL_SCANCODE_UNKNOWN,           /* KEY_NEW */
+    /* 181, 0x0b5 */    SDL_SCANCODE_AC_NEW,            /* KEY_NEW */
     /* 182, 0x0b6 */    SDL_SCANCODE_AGAIN,             /* KEY_REDO */
     /* 183, 0x0b7 */    SDL_SCANCODE_F13,               /* KEY_F13 */
     /* 184, 0x0b8 */    SDL_SCANCODE_F14,               /* KEY_F14 */
@@ -226,22 +226,22 @@ static SDL_Scancode const linux_scancode_table[] = {
     /* 197, 0x0c5 */    SDL_SCANCODE_UNKNOWN,
     /* 198, 0x0c6 */    SDL_SCANCODE_UNKNOWN,
     /* 199, 0x0c7 */    SDL_SCANCODE_UNKNOWN,
-    /* 200, 0x0c8 */    SDL_SCANCODE_AUDIOPLAY,         /* KEY_PLAYCD */
-    /* 201, 0x0c9 */    SDL_SCANCODE_UNKNOWN,           /* KEY_PAUSECD */
+    /* 200, 0x0c8 */    SDL_SCANCODE_MEDIA_PLAY,        /* KEY_PLAYCD */
+    /* 201, 0x0c9 */    SDL_SCANCODE_MEDIA_PAUSE,       /* KEY_PAUSECD */
     /* 202, 0x0ca */    SDL_SCANCODE_UNKNOWN,           /* KEY_PROG3 */
     /* 203, 0x0cb */    SDL_SCANCODE_UNKNOWN,           /* KEY_PROG4 */
     /* 204, 0x0cc */    SDL_SCANCODE_UNKNOWN,           /* KEY_ALL_APPLICATIONS */
     /* 205, 0x0cd */    SDL_SCANCODE_UNKNOWN,           /* KEY_SUSPEND */
-    /* 206, 0x0ce */    SDL_SCANCODE_UNKNOWN,           /* KEY_CLOSE */
-    /* 207, 0x0cf */    SDL_SCANCODE_AUDIOPLAY,         /* KEY_PLAY */
-    /* 208, 0x0d0 */    SDL_SCANCODE_AUDIOFASTFORWARD,  /* KEY_FASTFORWARD */
+    /* 206, 0x0ce */    SDL_SCANCODE_AC_CLOSE,          /* KEY_CLOSE */
+    /* 207, 0x0cf */    SDL_SCANCODE_MEDIA_PLAY,        /* KEY_PLAY */
+    /* 208, 0x0d0 */    SDL_SCANCODE_MEDIA_FAST_FORWARD, /* KEY_FASTFORWARD */
     /* 209, 0x0d1 */    SDL_SCANCODE_UNKNOWN,           /* KEY_BASSBOOST */
     /* 210, 0x0d2 */    SDL_SCANCODE_PRINTSCREEN,       /* KEY_PRINT */
     /* 211, 0x0d3 */    SDL_SCANCODE_UNKNOWN,           /* KEY_HP */
     /* 212, 0x0d4 */    SDL_SCANCODE_UNKNOWN,           /* KEY_CAMERA */
     /* 213, 0x0d5 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SOUND */
     /* 214, 0x0d6 */    SDL_SCANCODE_UNKNOWN,           /* KEY_QUESTION */
-    /* 215, 0x0d7 */    SDL_SCANCODE_MAIL,              /* KEY_EMAIL */
+    /* 215, 0x0d7 */    SDL_SCANCODE_UNKNOWN,           /* KEY_EMAIL */
     /* 216, 0x0d8 */    SDL_SCANCODE_UNKNOWN,           /* KEY_CHAT */
     /* 217, 0x0d9 */    SDL_SCANCODE_AC_SEARCH,         /* KEY_SEARCH */
     /* 218, 0x0da */    SDL_SCANCODE_UNKNOWN,           /* KEY_CONNECT */
@@ -250,17 +250,17 @@ static SDL_Scancode const linux_scancode_table[] = {
     /* 221, 0x0dd */    SDL_SCANCODE_UNKNOWN,           /* KEY_SHOP */
     /* 222, 0x0de */    SDL_SCANCODE_ALTERASE,          /* KEY_ALTERASE */
     /* 223, 0x0df */    SDL_SCANCODE_CANCEL,            /* KEY_CANCEL */
-    /* 224, 0x0e0 */    SDL_SCANCODE_BRIGHTNESSDOWN,    /* KEY_BRIGHTNESSDOWN */
-    /* 225, 0x0e1 */    SDL_SCANCODE_BRIGHTNESSUP,      /* KEY_BRIGHTNESSUP */
-    /* 226, 0x0e2 */    SDL_SCANCODE_MEDIASELECT,       /* KEY_MEDIA */
-    /* 227, 0x0e3 */    SDL_SCANCODE_DISPLAYSWITCH,     /* KEY_SWITCHVIDEOMODE */
-    /* 228, 0x0e4 */    SDL_SCANCODE_KBDILLUMTOGGLE,    /* KEY_KBDILLUMTOGGLE */
-    /* 229, 0x0e5 */    SDL_SCANCODE_KBDILLUMDOWN,      /* KEY_KBDILLUMDOWN */
-    /* 230, 0x0e6 */    SDL_SCANCODE_KBDILLUMUP,        /* KEY_KBDILLUMUP */
+    /* 224, 0x0e0 */    SDL_SCANCODE_UNKNOWN,           /* KEY_BRIGHTNESSDOWN */
+    /* 225, 0x0e1 */    SDL_SCANCODE_UNKNOWN,           /* KEY_BRIGHTNESSUP */
+    /* 226, 0x0e2 */    SDL_SCANCODE_MEDIA_SELECT,      /* KEY_MEDIA */
+    /* 227, 0x0e3 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SWITCHVIDEOMODE */
+    /* 228, 0x0e4 */    SDL_SCANCODE_UNKNOWN,           /* KEY_KBDILLUMTOGGLE */
+    /* 229, 0x0e5 */    SDL_SCANCODE_UNKNOWN,           /* KEY_KBDILLUMDOWN */
+    /* 230, 0x0e6 */    SDL_SCANCODE_UNKNOWN,           /* KEY_KBDILLUMUP */
     /* 231, 0x0e7 */    SDL_SCANCODE_UNKNOWN,           /* KEY_SEND */
     /* 232, 0x0e8 */    SDL_SCANCODE_UNKNOWN,           /* KEY_REPLY */
     /* 233, 0x0e9 */    SDL_SCANCODE_UNKNOWN,           /* KEY_FORWARDMAIL */
-    /* 234, 0x0ea */    SDL_SCANCODE_UNKNOWN,           /* KEY_SAVE */
+    /* 234, 0x0ea */    SDL_SCANCODE_AC_SAVE,           /* KEY_SAVE */
     /* 235, 0x0eb */    SDL_SCANCODE_UNKNOWN,           /* KEY_DOCUMENTS */
     /* 236, 0x0ec */    SDL_SCANCODE_UNKNOWN,           /* KEY_BATTERY */
     /* 237, 0x0ed */    SDL_SCANCODE_UNKNOWN,           /* KEY_BLUETOOTH */
@@ -829,7 +829,7 @@ done
 #!/bin/bash
 
 function get_comment
-{   
+{
     name=$(echo "$1" | awk '{print $7}')
     if [ "$name" != "" ]; then
         grep -E "$name\s" /usr/include/linux/input-event-codes.h | grep -F "/*" | sed 's,[^/]*/,/,'
diff --git a/src/events/scancodes_windows.h b/src/events/scancodes_windows.h
index 60fc842f65658..92157b33a8f81 100644
--- a/src/events/s

(Patch may be truncated, please check the link at the top of this post.)