Added 1-second timeout when binding hotkeys

This commit is contained in:
twinaphex 2014-09-25 04:44:24 +02:00
parent 8015061720
commit aa6d779fbc
3 changed files with 7 additions and 1 deletions

View File

@ -481,6 +481,7 @@ typedef struct driver
#endif #endif
bool stdin_claimed; bool stdin_claimed;
bool block_hotkey; bool block_hotkey;
unsigned block_hotkey_until;
bool block_input; bool block_input;
bool block_libretro_input; bool block_libretro_input;
bool nonblock_state; bool nonblock_state;

View File

@ -367,6 +367,8 @@ int menu_input_bind_iterate(void *data)
menu_poll_bind_state(&binds); menu_poll_bind_state(&binds);
driver.block_hotkey_until = g_extern.frame_count + (60);
if ((binds.skip && !menu->binds.skip) || if ((binds.skip && !menu->binds.skip) ||
menu_poll_find_trigger(&menu->binds, &binds)) menu_poll_find_trigger(&menu->binds, &binds))
{ {
@ -421,6 +423,8 @@ int menu_input_bind_iterate_keyboard(void *data)
timed_out = true; timed_out = true;
} }
driver.block_hotkey_until = g_extern.frame_count + (60);
/* binds.begin is updated in keyboard_press callback. */ /* binds.begin is updated in keyboard_press callback. */
if (menu->binds.begin > menu->binds.last) if (menu->binds.begin > menu->binds.last)
{ {

View File

@ -1658,7 +1658,8 @@ retro_input_t meta_input_keys_pressed(unsigned key,
{ {
bool state = false; 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); state = driver.input->key_pressed(driver.input_data, key);
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY