Allow more keyboard actions with menu osk (#15662)

This commit is contained in:
sonninnos 2023-09-02 01:48:55 +03:00 committed by GitHub
parent 078df8ba39
commit ea1bdade61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6307,8 +6307,27 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
&& current_input
&& current_input->input_state)
{
/* Set RetroPad Select bit when pressing Escape while keyboard
* is open in order to clear the input window and close it */
/* Allow arrows, LCtrl as OK, character map switches,
* and set RetroPad Select bit when pressing Escape
* in order to clear the input window and close it. */
unsigned i;
unsigned ids[][2] =
{
{RETROK_LCTRL, RETRO_DEVICE_ID_JOYPAD_A },
{RETROK_UP, RETRO_DEVICE_ID_JOYPAD_UP },
{RETROK_DOWN, RETRO_DEVICE_ID_JOYPAD_DOWN },
{RETROK_LEFT, RETRO_DEVICE_ID_JOYPAD_LEFT },
{RETROK_RIGHT, RETRO_DEVICE_ID_JOYPAD_RIGHT },
{RETROK_PAGEUP, RETRO_DEVICE_ID_JOYPAD_L },
{RETROK_PAGEDOWN, RETRO_DEVICE_ID_JOYPAD_R },
{RETROK_ESCAPE, RETRO_DEVICE_ID_JOYPAD_SELECT },
};
if (settings->bools.input_menu_swap_ok_cancel_buttons)
ids[0][1] = RETRO_DEVICE_ID_JOYPAD_B;
for (i = 0; i < ARRAY_SIZE(ids); i++)
{
if (current_input->input_state(
input_st->current_data,
joypad,
@ -6317,8 +6336,9 @@ void input_driver_collect_system_input(input_driver_state_t *input_st,
(const retro_keybind_set *)input_config_binds,
(input_st->flags & INP_FLAG_KB_MAPPING_BLOCKED) ? true : false,
0,
RETRO_DEVICE_KEYBOARD, 0, RETROK_ESCAPE))
BIT256_SET_PTR(current_bits, RETRO_DEVICE_ID_JOYPAD_SELECT);
RETRO_DEVICE_KEYBOARD, 0, ids[i][0]))
BIT256_SET_PTR(current_bits, ids[i][1]);
}
}
}
else