added support for 'select' key on certain devices (handled as 'return' key)
authorHolger Schemel <info@artsoft.org>
Sun, 16 Jul 2017 14:44:19 +0000 (16:44 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 16 Jul 2017 14:44:19 +0000 (16:44 +0200)
src/events.c
src/libgame/misc.c
src/libgame/sdl.h
src/tools.c

index 64fda80..6671041 100644 (file)
@@ -1540,9 +1540,11 @@ void HandleKey(Key key, int key_status)
   int i;
 
 #if defined(TARGET_SDL2)
-  /* map special "play/pause" media key to default key for play/pause actions */
+  /* map special keys (media keys / remote control buttons) to default keys */
   if (key == KSYM_PlayPause)
     key = KSYM_space;
+  else if (key == KSYM_Select)
+    key = KSYM_Return;
 #endif
 
   HandleSpecialGameControllerKeys(key, key_status);
index 9582bdb..8b37a47 100644 (file)
@@ -1611,8 +1611,14 @@ void translate_keyname(Key *keysym, char **x11name, char **name, int mode)
     { KSYM_Page_Down,  "XK_Page_Down",         "page down" },
 
 #if defined(TARGET_SDL2)
+    { KSYM_Select,     "XK_Select",            "select" },
     { KSYM_Menu,       "XK_Menu",              "menu" },        /* menu key */
     { KSYM_Back,       "XK_Back",              "back" },        /* back key */
+    { KSYM_PlayPause,  "XK_PlayPause",         "play/pause" },
+#if defined(PLATFORM_ANDROID)
+    { KSYM_Rewind,     "XK_Rewind",            "rewind" },
+    { KSYM_FastForward,        "XK_FastForward",       "fast forward" },
+#endif
 #endif
 
     /* ASCII 0x20 to 0x40 keys (except numbers) */
index 838be3a..590dadc 100644 (file)
@@ -199,6 +199,7 @@ struct MouseCursorInfo
 #define KSYM_Page_Down         SDLK_PAGEDOWN
 
 #if defined(TARGET_SDL2)
+#define KSYM_Select            SDLK_SELECT
 #define KSYM_Menu              SDLK_MENU
 #define KSYM_Back              SDLK_AC_BACK
 #define KSYM_PlayPause         SDLK_AUDIOPLAY
index a766c2d..1ea116b 100644 (file)
@@ -3912,6 +3912,7 @@ static int RequestHandleEvents(unsigned int req_state)
 
              case KSYM_Return:
 #if defined(TARGET_SDL2)
+             case KSYM_Select:
              case KSYM_Menu:
 #if defined(KSYM_Rewind)
              case KSYM_Rewind:         /* for Amazon Fire TV remote */