Don't accept hotkeys until key has been released.

Avoid quitting RetroArch immediately after Quit RetroArch bind.
This commit is contained in:
Themaister 2014-04-13 19:47:32 +02:00
parent 552c0ab495
commit 39ef5d8e03
2 changed files with 15 additions and 3 deletions

View File

@ -623,12 +623,14 @@ static int menu_custom_bind_iterate_keyboard(void *data, unsigned action)
if (driver.video_data && driver.menu_ctx && driver.menu_ctx->render_messagebox)
driver.menu_ctx->render_messagebox(rgui, msg);
bool timed_out = false;
if (timeout <= 0)
{
rgui->binds.begin++;
rgui->binds.target->key = RETROK_UNKNOWN; // Could be unsafe, but whatever.
rgui->binds.target++;
rgui->binds.timeout_end = rarch_get_time_usec() + RGUI_KEYBOARD_BIND_TIMEOUT_SECONDS * 1000000;
timed_out = true;
}
// binds.begin is updated in keyboard_press callback.
@ -639,7 +641,10 @@ static int menu_custom_bind_iterate_keyboard(void *data, unsigned action)
// Avoid new binds triggering things right away.
rgui->trigger_state = 0;
rgui->old_input_state = -1ULL;
input_keyboard_wait_keys_cancel();
// We won't be getting any key events, so just cancel early.
if (timed_out)
input_keyboard_wait_keys_cancel();
}
return 0;
}

View File

@ -130,10 +130,17 @@ void input_keyboard_wait_keys_cancel(void)
void input_keyboard_event(bool down, unsigned code, uint32_t character, uint16_t mod)
{
if (g_keyboard_press_cb)
static bool deferred_wait_keys;
if (deferred_wait_keys)
{
input_keyboard_wait_keys_cancel();
deferred_wait_keys = false;
}
else if (g_keyboard_press_cb)
{
if (down && code != RETROK_UNKNOWN && !g_keyboard_press_cb(g_keyboard_press_data, code))
input_keyboard_wait_keys_cancel();
deferred_wait_keys = true;
}
else if (g_keyboard_line)
{