Skip to content

Commit cf3c678

Browse files
authored
Fix Enter not working in menu on Android keyboards (#18405)
1 parent acd3fa1 commit cf3c678

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

input/drivers/android_input.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,17 @@ static INLINE void android_input_poll_event_type_key(
915915
{
916916
uint8_t *buf = android_key_state[port];
917917
int action = AKeyEvent_getAction(event);
918+
int keysym = keycode;
918919

920+
/* Handle 'duplicate' inputs that correspond
921+
* to the same RETROK_* key */
922+
switch (keycode)
923+
{
924+
case AKEYCODE_DPAD_CENTER:
925+
keysym = AKEYCODE_ENTER;
926+
default:
927+
break;
928+
}
919929
/* some controllers send both the up and down events at once
920930
* when the button is released for "special" buttons, like menu buttons
921931
* work around that by only using down events for meta keys (which get
@@ -924,10 +934,10 @@ static INLINE void android_input_poll_event_type_key(
924934
switch (action)
925935
{
926936
case AKEY_EVENT_ACTION_UP:
927-
BIT_CLEAR(buf, keycode);
937+
BIT_CLEAR(buf, keysym);
928938
break;
929939
case AKEY_EVENT_ACTION_DOWN:
930-
BIT_SET(buf, keycode);
940+
BIT_SET(buf, keysym);
931941
break;
932942
}
933943

input/input_keymaps.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,7 +1395,7 @@ const struct rarch_key_map rarch_key_map_android[] = {
13951395
{ AKEYCODE_TAB, RETROK_TAB },
13961396
{ AKEYCODE_CLEAR, RETROK_CLEAR },
13971397
{ AKEYCODE_ENTER, RETROK_RETURN },
1398-
{ AKEYCODE_DPAD_CENTER, RETROK_RETURN },
1398+
/* { AKEYCODE_DPAD_CENTER, RETROK_RETURN }, */ /* Duplicate - skip */
13991399
{ AKEYCODE_BREAK, RETROK_PAUSE },
14001400
{ AKEYCODE_ESCAPE, RETROK_ESCAPE },
14011401
{ AKEYCODE_SPACE, RETROK_SPACE },

0 commit comments

Comments
 (0)