From: Holger Schemel Date: Sun, 16 Jul 2017 14:44:19 +0000 (+0200) Subject: added support for 'select' key on certain devices (handled as 'return' key) X-Git-Tag: 4.0.1.0~25 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=d870b82d2c53def1ed6da9fdc46ce6bf3dd1bfae;p=rocksndiamonds.git added support for 'select' key on certain devices (handled as 'return' key) --- diff --git a/src/events.c b/src/events.c index 64fda808..66710416 100644 --- a/src/events.c +++ b/src/events.c @@ -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); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index 9582bdb3..8b37a47d 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -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) */ diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index 838be3ad..590dadc8 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -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 diff --git a/src/tools.c b/src/tools.c index a766c2d6..1ea116ba 100644 --- a/src/tools.c +++ b/src/tools.c @@ -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 */