From aa6d779fbc3052d0d099c5b0677e1e5ebc26c37c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 25 Sep 2014 04:44:24 +0200 Subject: [PATCH] Added 1-second timeout when binding hotkeys --- driver.h | 1 + frontend/menu/menu_input_line_cb.c | 4 ++++ input/input_common.c | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/driver.h b/driver.h index 68e5976b37..4bd96ec382 100644 --- a/driver.h +++ b/driver.h @@ -481,6 +481,7 @@ typedef struct driver #endif bool stdin_claimed; bool block_hotkey; + unsigned block_hotkey_until; bool block_input; bool block_libretro_input; bool nonblock_state; diff --git a/frontend/menu/menu_input_line_cb.c b/frontend/menu/menu_input_line_cb.c index 0c9ebfe2be..116037a654 100644 --- a/frontend/menu/menu_input_line_cb.c +++ b/frontend/menu/menu_input_line_cb.c @@ -367,6 +367,8 @@ int menu_input_bind_iterate(void *data) menu_poll_bind_state(&binds); + driver.block_hotkey_until = g_extern.frame_count + (60); + if ((binds.skip && !menu->binds.skip) || menu_poll_find_trigger(&menu->binds, &binds)) { @@ -421,6 +423,8 @@ int menu_input_bind_iterate_keyboard(void *data) timed_out = true; } + driver.block_hotkey_until = g_extern.frame_count + (60); + /* binds.begin is updated in keyboard_press callback. */ if (menu->binds.begin > menu->binds.last) { diff --git a/input/input_common.c b/input/input_common.c index e631275535..0bcd257c5a 100644 --- a/input/input_common.c +++ b/input/input_common.c @@ -1658,7 +1658,8 @@ retro_input_t meta_input_keys_pressed(unsigned key, { bool state = false; - if (!driver.block_hotkey) + if (!driver.block_hotkey + && g_extern.frame_count > driver.block_hotkey_until) state = driver.input->key_pressed(driver.input_data, key); #ifdef HAVE_OVERLAY