mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-24 08:30:16 +00:00
Added 1-second timeout when binding hotkeys
This commit is contained in:
parent
8015061720
commit
aa6d779fbc
1
driver.h
1
driver.h
@ -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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user