From 96ea8748502d3e4eb05bf81ef098510f0915f8df Mon Sep 17 00:00:00 2001 From: markwkidd Date: Wed, 2 Jan 2019 18:47:40 -0500 Subject: [PATCH 1/3] unify input bind hold behavior across platforms --- menu/widgets/menu_input_bind_dialog.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index 67e864d976..01b232e461 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -585,8 +585,6 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) input_driver_keyboard_mapping_set_block( true ); menu_input_key_bind_poll_bind_state( &binds, menu_bind_port, timed_out ); -#ifdef ANDROID - /*keep resetting bind during the hold period, or we'll potentially bind joystick and mouse, etc.*/ binds.buffer = *( binds.output ); @@ -615,16 +613,6 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) rarch_timer_begin_new_time( &binds.timer_hold, settings->uints.input_bind_hold ); } -#else - - if ( ( binds.skip && !menu_input_binds.skip ) || - menu_input_key_bind_poll_find_trigger( &menu_input_binds, &binds, &( binds.buffer ) ) ) - { - complete = true; - } - -#endif - if ( complete ) { /*update bind*/ From 79264c72787bcbe1a5815bb4e2776d55f7501aad Mon Sep 17 00:00:00 2001 From: "Mark W. Kidd" Date: Wed, 2 Jan 2019 21:24:33 -0500 Subject: [PATCH 2/3] refactor and restore non-android bind hold behavior --- menu/widgets/menu_input_bind_dialog.c | 51 ++++++++++++++++----------- 1 file changed, 31 insertions(+), 20 deletions(-) diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index 01b232e461..b10df5f55c 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -585,32 +585,43 @@ bool menu_input_key_bind_iterate(menu_input_ctx_bind_t *bind) input_driver_keyboard_mapping_set_block( true ); menu_input_key_bind_poll_bind_state( &binds, menu_bind_port, timed_out ); - /*keep resetting bind during the hold period, or we'll potentially bind joystick and mouse, etc.*/ - binds.buffer = *( binds.output ); + /*keep resetting bind during the hold period, or we'll potentially bind joystick and mouse, etc.*/ + binds.buffer = *( binds.output ); - if ( menu_input_key_bind_poll_find_hold( &binds, &binds.buffer ) ) + if ( settings->uints.input_bind_timeout == 0 ) { - /*inhibit timeout*/ - rarch_timer_begin_new_time( &binds.timer_timeout, settings->uints.input_bind_timeout ); - - /*run hold timer*/ - rarch_timer_tick( &binds.timer_hold ); - - snprintf( bind->s, bind->len, - "[%s]\npress keyboard, mouse or joypad\nand hold ...", - input_config_bind_map_get_desc( - menu_input_binds.begin - MENU_SETTINGS_BIND_BEGIN ) ); - - /*hold complete?*/ - if ( rarch_timer_has_expired( &binds.timer_hold ) ) - { - complete = true; + if ( ( binds.skip && !menu_input_binds.skip ) || + menu_input_key_bind_poll_find_trigger( &menu_input_binds, &binds, &( binds.buffer ) ) ) + { + complete = true; } } else { - /*reset hold countdown*/ - rarch_timer_begin_new_time( &binds.timer_hold, settings->uints.input_bind_hold ); + if ( menu_input_key_bind_poll_find_hold( &binds, &binds.buffer ) ) + { + /*inhibit timeout*/ + rarch_timer_begin_new_time( &binds.timer_timeout, settings->uints.input_bind_timeout ); + + /*run hold timer*/ + rarch_timer_tick( &binds.timer_hold ); + + snprintf( bind->s, bind->len, + "[%s]\npress keyboard, mouse or joypad\nand hold ...", + input_config_bind_map_get_desc( + menu_input_binds.begin - MENU_SETTINGS_BIND_BEGIN ) ); + + /*hold complete?*/ + if ( rarch_timer_has_expired( &binds.timer_hold ) ) + { + complete = true; + } + } + else + { + /*reset hold countdown*/ + rarch_timer_begin_new_time( &binds.timer_hold, settings->uints.input_bind_hold ); + } } if ( complete ) From 975b5738fb97005eff41698d83f877729b1d27a7 Mon Sep 17 00:00:00 2001 From: "Mark W. Kidd" Date: Sat, 16 Feb 2019 11:16:28 -0500 Subject: [PATCH 3/3] set default input bind hold time as 1 --- config.def.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.def.h b/config.def.h index 1515ab3fa9..48a8baa7c7 100644 --- a/config.def.h +++ b/config.def.h @@ -744,7 +744,7 @@ static const unsigned input_poll_type_behavior = 2; static const unsigned input_bind_timeout = 5; -static const unsigned input_bind_hold = 2; +static const unsigned input_bind_hold = 1; static const unsigned menu_thumbnails_default = 3;