mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
ignore trigger input while binding a new key
This commit is contained in:
parent
950e67b8a2
commit
28c0e78292
@ -90,6 +90,8 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
|
||||
hash = msg_hash_calculate(label);
|
||||
iterate_type = action_iterate_type(hash);
|
||||
|
||||
menu_driver_set_binding_state(iterate_type == ITERATE_TYPE_BIND);
|
||||
|
||||
if ( action != MENU_ACTION_NOOP
|
||||
|| menu_entries_ctl(MENU_ENTRIES_CTL_NEEDS_REFRESH, NULL)
|
||||
|| menu_display_get_update_pending())
|
||||
|
@ -83,12 +83,23 @@ static bool menu_driver_toggled = false;
|
||||
static bool menu_driver_data_own = false;
|
||||
static bool menu_driver_pending_quit = false;
|
||||
static bool menu_driver_pending_shutdown = false;
|
||||
static bool menu_driver_is_binding = false;
|
||||
static playlist_t *menu_driver_playlist = NULL;
|
||||
static struct video_shader *menu_driver_shader = NULL;
|
||||
static menu_handle_t *menu_driver_data = NULL;
|
||||
static const menu_ctx_driver_t *menu_driver_ctx = NULL;
|
||||
static void *menu_userdata = NULL;
|
||||
|
||||
bool menu_driver_is_binding_state()
|
||||
{
|
||||
return menu_driver_is_binding;
|
||||
}
|
||||
|
||||
void menu_driver_set_binding_state(bool on)
|
||||
{
|
||||
menu_driver_is_binding = on;
|
||||
}
|
||||
|
||||
/**
|
||||
* menu_driver_find_handle:
|
||||
* @idx : index of driver to get handle to.
|
||||
|
@ -380,6 +380,9 @@ const char *menu_driver_ident(void);
|
||||
|
||||
bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data);
|
||||
|
||||
bool menu_driver_is_binding_state();
|
||||
void menu_driver_set_binding_state(bool on);
|
||||
|
||||
extern menu_ctx_driver_t menu_ctx_xui;
|
||||
extern menu_ctx_driver_t menu_ctx_rgui;
|
||||
extern menu_ctx_driver_t menu_ctx_mui;
|
||||
|
71
runloop.c
71
runloop.c
@ -833,6 +833,44 @@ static enum runloop_state runloop_check_state(
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||
{
|
||||
menu_ctx_iterate_t iter;
|
||||
bool skip = false;
|
||||
#ifdef HAVE_OVERLAY
|
||||
skip = osk_enable && input_keyboard_return_pressed();
|
||||
#endif
|
||||
|
||||
if (!skip)
|
||||
{
|
||||
enum menu_action action = (enum menu_action)menu_event(current_input, trigger_input);
|
||||
bool focused = settings->pause_nonactive ? video_driver_is_focused() : true;
|
||||
|
||||
focused = focused && !ui_companion_is_on_foreground();
|
||||
|
||||
iter.action = action;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
|
||||
if (focused || !runloop_idle)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
|
||||
|
||||
if (!focused)
|
||||
return RUNLOOP_STATE_SLEEP;
|
||||
|
||||
if (action == MENU_ACTION_QUIT)
|
||||
return RUNLOOP_STATE_QUIT;
|
||||
}
|
||||
|
||||
if (menu_driver_is_binding_state())
|
||||
{
|
||||
trigger_input = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (runloop_cmd_triggered(trigger_input, RARCH_OVERLAY_NEXT))
|
||||
command_event(CMD_EVENT_OVERLAY_NEXT, NULL);
|
||||
|
||||
@ -879,39 +917,6 @@ static enum runloop_state runloop_check_state(
|
||||
runloop_cmd_press(current_input, RARCH_QUIT_KEY)) != 1)
|
||||
return RUNLOOP_STATE_QUIT;
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if (menu_driver_ctl(RARCH_MENU_CTL_IS_ALIVE, NULL))
|
||||
{
|
||||
menu_ctx_iterate_t iter;
|
||||
bool skip = false;
|
||||
#ifdef HAVE_OVERLAY
|
||||
skip = osk_enable && input_keyboard_return_pressed();
|
||||
#endif
|
||||
|
||||
if (!skip)
|
||||
{
|
||||
enum menu_action action = (enum menu_action)menu_event(current_input, trigger_input);
|
||||
bool focused = settings->pause_nonactive ? video_driver_is_focused() : true;
|
||||
|
||||
focused = focused && !ui_companion_is_on_foreground();
|
||||
|
||||
iter.action = action;
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_ITERATE, &iter))
|
||||
rarch_ctl(RARCH_CTL_MENU_RUNNING_FINISHED, NULL);
|
||||
|
||||
if (focused || !runloop_idle)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_RENDER, NULL);
|
||||
|
||||
if (!focused)
|
||||
return RUNLOOP_STATE_SLEEP;
|
||||
|
||||
if (action == MENU_ACTION_QUIT)
|
||||
return RUNLOOP_STATE_QUIT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (runloop_idle)
|
||||
return RUNLOOP_STATE_SLEEP;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user