diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index cd43a502a3..5cb83f4abb 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -128,9 +128,8 @@ static int action_left_scroll(unsigned type, const char *label, if (selection > fast_scroll_speed) { size_t idx = selection - fast_scroll_speed; - bool scroll = true; menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); } else { diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index 49d8663fb4..ef2e59b106 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -138,10 +138,9 @@ static int action_right_scroll(unsigned type, const char *label, if (selection + fast_scroll_speed < (menu_entries_get_size())) { size_t idx = selection + fast_scroll_speed; - bool scroll = true; menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); } else { diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 0fa3d14b85..f9037c25ba 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -853,14 +853,13 @@ static int rgui_pointer_tap(void *data, } else if (ptr <= (menu_entries_get_size() - 1)) { - bool scroll = false; size_t selection = menu_navigation_get_selection(); if (ptr == selection && cbs && cbs->action_select) return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT); menu_navigation_set_selection(ptr); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(false); } return 0; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 20cae60840..5b7c0158a6 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -4083,13 +4083,12 @@ static int xmb_pointer_tap(void *userdata, } else if (ptr <= (menu_entries_get_size() - 1)) { - bool scroll = false; size_t selection = menu_navigation_get_selection(); if (ptr == selection && cbs && cbs->action_select) return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT); menu_navigation_set_selection(ptr); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(false); } return 0; diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 8d7d72b802..7fb250f8d6 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -504,6 +504,12 @@ bool menu_driver_init(bool video_is_threaded) return false; } +void menu_driver_navigation_set(bool scroll) +{ + if (menu_driver_ctx->navigation_set) + menu_driver_ctx->navigation_set(menu_userdata, scroll); +} + bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) { switch (state) @@ -684,16 +690,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data) case RARCH_MENU_CTL_UNSET_LOAD_NO_CONTENT: menu_driver_load_no_content = false; break; - case RARCH_MENU_CTL_NAVIGATION_SET: - { - bool *scroll = (bool*)data; - - if (!scroll) - return false; - if (menu_driver_ctx->navigation_set) - menu_driver_ctx->navigation_set(menu_userdata, *scroll); - } - break; case RARCH_MENU_CTL_NAVIGATION_SET_LAST: if (menu_driver_ctx->navigation_set_last) menu_driver_ctx->navigation_set_last(menu_userdata); diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 2858292b51..9b737bdc2a 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -82,7 +82,6 @@ enum rarch_menu_ctl_state { RARCH_MENU_CTL_NONE = 0, RARCH_MENU_CTL_REFRESH, - RARCH_MENU_CTL_NAVIGATION_SET, RARCH_MENU_CTL_NAVIGATION_CLEAR, RARCH_MENU_CTL_NAVIGATION_SET_LAST, RARCH_MENU_CTL_NAVIGATION_ASCEND_ALPHABET, @@ -401,6 +400,8 @@ void menu_driver_increment_navigation(void); void menu_driver_decrement_navigation(void); +void menu_driver_navigation_set(bool scroll); + bool menu_driver_init(bool video_is_threaded); extern menu_ctx_driver_t menu_ctx_xui; diff --git a/menu/menu_entries.c b/menu/menu_entries.c index 483144cf29..cd44a11816 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -187,9 +187,8 @@ static bool menu_entries_refresh(void *data) if ((selection >= list_size) && list_size) { size_t idx = list_size - 1; - bool scroll = true; menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); } else if (!list_size) { diff --git a/menu/menu_navigation.c b/menu/menu_navigation.c index 5f68b414d6..713e441892 100644 --- a/menu/menu_navigation.c +++ b/menu/menu_navigation.c @@ -58,9 +58,8 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) break; case MENU_NAVIGATION_CTL_CLEAR: { - bool scroll = true; menu_navigation_set_selection(0); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_CLEAR, data); } break; @@ -81,10 +80,9 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) if ((selection_ptr + (*scroll_speed)) < menu_list_size) { size_t idx = selection_ptr + (*scroll_speed); - bool scroll = true; menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); menu_navigation_ctl(MENU_NAVIGATION_CTL_INCREMENT, NULL); } else @@ -110,7 +108,6 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) case MENU_NAVIGATION_CTL_DECREMENT: { size_t idx = 0; - bool scroll = true; settings_t *settings = config_get_ptr(); unsigned *scroll_speed = (unsigned*)data; size_t menu_list_size = menu_entries_get_size(); @@ -132,7 +129,7 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data) } menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); menu_navigation_ctl(MENU_NAVIGATION_CTL_DECREMENT, NULL); menu_driver_decrement_navigation(); diff --git a/menu/widgets/menu_input_dialog.c b/menu/widgets/menu_input_dialog.c index 0a6f84819a..3cce3a4cfd 100644 --- a/menu/widgets/menu_input_dialog.c +++ b/menu/widgets/menu_input_dialog.c @@ -39,9 +39,8 @@ static void menu_input_search_cb(void *userdata, const char *str) if (str && *str && file_list_search(selection_buf, str, &idx)) { - bool scroll = true; menu_navigation_set_selection(idx); - menu_driver_ctl(RARCH_MENU_CTL_NAVIGATION_SET, &scroll); + menu_driver_navigation_set(true); } menu_input_dialog_end();