mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
Create menu_driver_navigation_set
This commit is contained in:
parent
d01b81749d
commit
1fef134f04
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user