Refactor away menu_navigation_clear

This commit is contained in:
twinaphex 2015-09-25 15:15:31 +02:00
parent ee7ce4feaa
commit 6b79c937d9
5 changed files with 24 additions and 34 deletions

View File

@ -105,7 +105,10 @@ static int action_left_scroll(unsigned type, const char *label,
if (selection > fast_scroll_speed)
menu_navigation_set(nav, selection - fast_scroll_speed, true);
else
menu_navigation_clear(nav, false);
{
bool pending_push = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
return 0;
}

View File

@ -563,7 +563,8 @@ static int generic_action_ok(const char *path,
if (rarch_replace_config(action_path))
{
menu_navigation_clear(nav, false);
bool pending_push = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
ret = -1;
}
break;

View File

@ -222,7 +222,10 @@ static void menu_list_refresh(file_list_t *list)
if ((nav->selection_ptr >= list_size) && list_size)
menu_navigation_set(nav, list_size - 1, true);
else if (!list_size)
menu_navigation_clear(nav, true);
{
bool pending_push = true;
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
}
static void menu_displaylist_push_perfcounter(
@ -2372,7 +2375,6 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
bool need_push = false;
rarch_setting_t *setting = NULL;
menu_handle_t *menu = menu_driver_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
global_t *global = global_get_ptr();
settings_t *settings = config_get_ptr();
rarch_system_info_t *system = rarch_system_info_get_ptr();
@ -2444,11 +2446,14 @@ int menu_displaylist_push_list(menu_displaylist_info_t *info, unsigned type)
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr, 0);
break;
case DISPLAYLIST_GENERIC:
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
{
bool pending_push = true;
menu_driver_list_cache(MENU_LIST_PLAIN, 0);
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr, 0);
menu_navigation_clear(nav, true);
menu_entries_set_refresh(false);
menu_list_push(info->list, info->path, info->label, info->type, info->directory_ptr, 0);
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
menu_entries_set_refresh(false);
}
break;
case DISPLAYLIST_HELP_SCREEN_LIST:
menu_list_push(info->list,
@ -3009,9 +3014,9 @@ int menu_displaylist_push(file_list_t *list, file_list_t *menu_list)
**/
bool menu_displaylist_init(void *data)
{
bool pending_push = true;
menu_handle_t *menu = (menu_handle_t*)data;
menu_list_t *menu_list = menu_list_get_ptr();
menu_navigation_t *nav = menu_navigation_get_ptr();
menu_displaylist_info_t info = {0};
if (!menu || !menu_list)
return false;
@ -3024,7 +3029,7 @@ bool menu_displaylist_init(void *data)
menu_list_push(menu_list->menu_stack,
info.path, info.label, info.type, info.flags, 0);
menu_displaylist_push_list(&info, DISPLAYLIST_MAIN_MENU);
menu_navigation_clear(nav, true);
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
return true;
}

View File

@ -44,6 +44,7 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
if (!pending_push)
return false;
menu_navigation_set(nav, 0, true);
if (driver->navigation_clear)
driver->navigation_clear(*pending_push);
}
@ -64,7 +65,10 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
else
{
if (settings->menu.navigation.wraparound.vertical_enable)
menu_navigation_clear(nav, false);
{
bool pending_push = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
else
{
if ((menu_list_get_size(menu_list) > 0))
@ -153,21 +157,6 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
return false;
}
/**
* menu_navigation_clear:
* @pending_push : pending push ?
*
* Clears the navigation pointer.
**/
void menu_navigation_clear(menu_navigation_t *nav, bool pending_push)
{
if (!nav)
return;
menu_navigation_set(nav, 0, true);
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
}
/**
* menu_navigation_set:
* @idx : index to set navigation pointer to.

View File

@ -56,14 +56,6 @@ enum menu_navigation_ctl_state
MENU_NAVIGATION_CTL_GET_SELECTION
};
/**
* menu_navigation_clear:
* @pending_push : pending push ?
*
* Clears the navigation pointer.
**/
void menu_navigation_clear(menu_navigation_t *nav, bool pending_push);
/**
* menu_navigation_set:
* @idx : index to set navigation pointer to.