From 013bf29fff890145fe5202a81377bfdfe2301d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Andr=C3=A9=20Santoni?= Date: Sat, 4 Mar 2017 15:35:05 +0100 Subject: [PATCH] (Menu) A long press will reset a setting to its default value --- menu/menu_input.c | 20 +++++++++++++++++--- menu/menu_input.h | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/menu/menu_input.c b/menu/menu_input.c index 61786152b6..e11adad36b 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -439,6 +439,8 @@ static int menu_input_pointer_post_iterate( video_context_driver_get_metrics(&metrics); + menu_input->pointer.counter++; + if (!pointer_oldpressed[0]) { menu_input->pointer.accel = 0; @@ -507,9 +509,20 @@ static int menu_input_pointer_post_iterate( } else { - menu_driver_ctl(RARCH_MENU_CTL_POINTER_UP, &point); - menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point); - ret = point.retcode; + if (menu_input->pointer.counter > 32) + { + size_t selection; + menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); + if (cbs && cbs->action_start) + return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_START); + + } + else + { + menu_driver_ctl(RARCH_MENU_CTL_POINTER_UP, &point); + menu_driver_ctl(RARCH_MENU_CTL_POINTER_TAP, &point); + ret = point.retcode; + } } } @@ -520,6 +533,7 @@ static int menu_input_pointer_post_iterate( pointer_old_y = 0; menu_input->pointer.dx = 0; menu_input->pointer.dy = 0; + menu_input->pointer.counter = 0; menu_input_ctl(MENU_INPUT_CTL_UNSET_POINTER_DRAGGED, NULL); } diff --git a/menu/menu_input.h b/menu/menu_input.h index cec5559b77..7efac468f3 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -98,6 +98,7 @@ typedef struct menu_input bool pressed[2]; bool back; unsigned ptr; + unsigned counter; } pointer; } menu_input_t;