mirror of
https://github.com/libretro/RetroArch
synced 2025-02-10 03:39:56 +00:00
Combine menu_navigation_ctl and menu_driver_ctl
This commit is contained in:
parent
c0027ae9a1
commit
529349019d
@ -26,7 +26,7 @@ static int action_bind_down_generic(unsigned type, const char *label)
|
|||||||
{
|
{
|
||||||
size_t scroll_accel = 0;
|
size_t scroll_accel = 0;
|
||||||
unsigned scroll_speed = 0;
|
unsigned scroll_speed = 0;
|
||||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
@ -34,7 +34,7 @@ static int action_bind_down_generic(unsigned type, const char *label)
|
|||||||
if (menu_entries_get_size() <= 0)
|
if (menu_entries_get_size() <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_INCREMENT, &scroll_speed);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_INCREMENT, &scroll_speed);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ static int action_left_scroll(unsigned type, const char *label,
|
|||||||
unsigned scroll_speed = 0, fast_scroll_speed = 0;
|
unsigned scroll_speed = 0, fast_scroll_speed = 0;
|
||||||
size_t selection = menu_navigation_get_selection();
|
size_t selection = menu_navigation_get_selection();
|
||||||
|
|
||||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
@ -133,7 +133,7 @@ static int action_left_scroll(unsigned type, const char *label,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool pending_push = false;
|
bool pending_push = false;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -997,7 +997,7 @@ static int generic_action_ok(const char *path,
|
|||||||
if (config_replace(settings->bools.config_save_on_exit, action_path))
|
if (config_replace(settings->bools.config_save_on_exit, action_path))
|
||||||
{
|
{
|
||||||
bool pending_push = false;
|
bool pending_push = false;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ static int action_right_scroll(unsigned type, const char *label,
|
|||||||
unsigned scroll_speed = 0, fast_scroll_speed = 0;
|
unsigned scroll_speed = 0, fast_scroll_speed = 0;
|
||||||
size_t selection = menu_navigation_get_selection();
|
size_t selection = menu_navigation_get_selection();
|
||||||
|
|
||||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
@ -144,7 +144,7 @@ static int action_right_scroll(unsigned type, const char *label,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((menu_entries_get_size() > 0))
|
if ((menu_entries_get_size() > 0))
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -26,7 +26,7 @@ static int action_bind_up_generic(unsigned type, const char *label)
|
|||||||
{
|
{
|
||||||
size_t scroll_accel = 0;
|
size_t scroll_accel = 0;
|
||||||
unsigned scroll_speed = 0;
|
unsigned scroll_speed = 0;
|
||||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
if (!menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1);
|
||||||
@ -34,7 +34,7 @@ static int action_bind_up_generic(unsigned type, const char *label)
|
|||||||
if (menu_entries_get_size() <= 0)
|
if (menu_entries_get_size() <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_DECREMENT, &scroll_speed);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_DECREMENT, &scroll_speed);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3776,7 +3776,7 @@ static bool menu_displaylist_push_list_process(menu_displaylist_info_t *info)
|
|||||||
if (info->need_navigation_clear)
|
if (info->need_navigation_clear)
|
||||||
{
|
{
|
||||||
bool pending_push = true;
|
bool pending_push = true;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->need_entries_refresh)
|
if (info->need_entries_refresh)
|
||||||
|
@ -935,28 +935,6 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
|||||||
menu_driver_ctx->update_savestate_thumbnail_image(menu_userdata);
|
menu_driver_ctx->update_savestate_thumbnail_image(menu_userdata);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case RARCH_MENU_CTL_NONE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t menu_navigation_get_selection(void)
|
|
||||||
{
|
|
||||||
return menu_driver_selection_ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void menu_navigation_set_selection(size_t val)
|
|
||||||
{
|
|
||||||
menu_driver_selection_ptr = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|
||||||
{
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case MENU_NAVIGATION_CTL_CLEAR:
|
case MENU_NAVIGATION_CTL_CLEAR:
|
||||||
{
|
{
|
||||||
bool *pending_push = (bool*)data;
|
bool *pending_push = (bool*)data;
|
||||||
@ -996,10 +974,10 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
if (wraparound_enable)
|
if (wraparound_enable)
|
||||||
{
|
{
|
||||||
bool pending_push = false;
|
bool pending_push = false;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||||
}
|
}
|
||||||
else if (menu_list_size > 0)
|
else if (menu_list_size > 0)
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_LAST, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menu_driver_ctx->navigation_increment)
|
if (menu_driver_ctx->navigation_increment)
|
||||||
@ -1128,9 +1106,20 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
scroll_acceleration = (unsigned)(*sel);
|
scroll_acceleration = (unsigned)(*sel);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MENU_NAVIGATION_CTL_NONE:
|
default:
|
||||||
|
case RARCH_MENU_CTL_NONE:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t menu_navigation_get_selection(void)
|
||||||
|
{
|
||||||
|
return menu_driver_selection_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void menu_navigation_set_selection(size_t val)
|
||||||
|
{
|
||||||
|
menu_driver_selection_ptr = val;
|
||||||
|
}
|
||||||
|
@ -125,7 +125,17 @@ enum rarch_menu_ctl_state
|
|||||||
RARCH_MENU_CTL_SET_THUMBNAIL_SYSTEM,
|
RARCH_MENU_CTL_SET_THUMBNAIL_SYSTEM,
|
||||||
RARCH_MENU_CTL_SET_THUMBNAIL_CONTENT,
|
RARCH_MENU_CTL_SET_THUMBNAIL_CONTENT,
|
||||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH,
|
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_PATH,
|
||||||
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE
|
RARCH_MENU_CTL_UPDATE_SAVESTATE_THUMBNAIL_IMAGE,
|
||||||
|
MENU_NAVIGATION_CTL_CLEAR,
|
||||||
|
MENU_NAVIGATION_CTL_INCREMENT,
|
||||||
|
MENU_NAVIGATION_CTL_DECREMENT,
|
||||||
|
MENU_NAVIGATION_CTL_SET_LAST,
|
||||||
|
MENU_NAVIGATION_CTL_DESCEND_ALPHABET,
|
||||||
|
MENU_NAVIGATION_CTL_ASCEND_ALPHABET,
|
||||||
|
MENU_NAVIGATION_CTL_CLEAR_SCROLL_INDICES,
|
||||||
|
MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX,
|
||||||
|
MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
||||||
|
MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_settings_type
|
enum menu_settings_type
|
||||||
@ -198,21 +208,6 @@ enum menu_settings_type
|
|||||||
MENU_SETTINGS_LAST
|
MENU_SETTINGS_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
enum menu_navigation_ctl_state
|
|
||||||
{
|
|
||||||
MENU_NAVIGATION_CTL_NONE = 0,
|
|
||||||
MENU_NAVIGATION_CTL_CLEAR,
|
|
||||||
MENU_NAVIGATION_CTL_INCREMENT,
|
|
||||||
MENU_NAVIGATION_CTL_DECREMENT,
|
|
||||||
MENU_NAVIGATION_CTL_SET_LAST,
|
|
||||||
MENU_NAVIGATION_CTL_DESCEND_ALPHABET,
|
|
||||||
MENU_NAVIGATION_CTL_ASCEND_ALPHABET,
|
|
||||||
MENU_NAVIGATION_CTL_CLEAR_SCROLL_INDICES,
|
|
||||||
MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX,
|
|
||||||
MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
|
||||||
MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char deferred_path[PATH_MAX_LENGTH];
|
char deferred_path[PATH_MAX_LENGTH];
|
||||||
@ -420,8 +415,6 @@ size_t menu_navigation_get_selection(void);
|
|||||||
|
|
||||||
void menu_navigation_set_selection(size_t val);
|
void menu_navigation_set_selection(size_t val);
|
||||||
|
|
||||||
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data);
|
|
||||||
|
|
||||||
extern menu_ctx_driver_t menu_ctx_xui;
|
extern menu_ctx_driver_t menu_ctx_xui;
|
||||||
extern menu_ctx_driver_t menu_ctx_rgui;
|
extern menu_ctx_driver_t menu_ctx_rgui;
|
||||||
extern menu_ctx_driver_t menu_ctx_mui;
|
extern menu_ctx_driver_t menu_ctx_mui;
|
||||||
|
@ -143,8 +143,8 @@ static void menu_entries_build_scroll_indices(file_list_t *list)
|
|||||||
if (!list || !list->size)
|
if (!list || !list->size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR_SCROLL_INDICES, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR_SCROLL_INDICES, NULL);
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &scroll_value);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &scroll_value);
|
||||||
|
|
||||||
current = menu_entries_elem_get_first_char(list, 0);
|
current = menu_entries_elem_get_first_char(list, 0);
|
||||||
current_is_dir = menu_entries_elem_is_dir(list, 0);
|
current_is_dir = menu_entries_elem_is_dir(list, 0);
|
||||||
@ -155,7 +155,7 @@ static void menu_entries_build_scroll_indices(file_list_t *list)
|
|||||||
bool is_dir = menu_entries_elem_is_dir(list, (unsigned)i);
|
bool is_dir = menu_entries_elem_is_dir(list, (unsigned)i);
|
||||||
|
|
||||||
if ((current_is_dir && !is_dir) || (first > current))
|
if ((current_is_dir && !is_dir) || (first > current))
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &i);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &i);
|
||||||
|
|
||||||
current = first;
|
current = first;
|
||||||
current_is_dir = is_dir;
|
current_is_dir = is_dir;
|
||||||
@ -163,7 +163,7 @@ static void menu_entries_build_scroll_indices(file_list_t *list)
|
|||||||
|
|
||||||
|
|
||||||
scroll_value = list->size - 1;
|
scroll_value = list->size - 1;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &scroll_value);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_ADD_SCROLL_INDEX, &scroll_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -192,7 +192,7 @@ static bool menu_entries_refresh(void *data)
|
|||||||
else if (!list_size)
|
else if (!list_size)
|
||||||
{
|
{
|
||||||
bool pending_push = true;
|
bool pending_push = true;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -161,7 +161,7 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
|||||||
first_held = false;
|
first_held = false;
|
||||||
trigger_input |= input & input_repeat;
|
trigger_input |= input & input_repeat;
|
||||||
|
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
menu_driver_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL,
|
||||||
&new_scroll_accel);
|
&new_scroll_accel);
|
||||||
|
|
||||||
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
new_scroll_accel = MIN(new_scroll_accel + 1, 64);
|
||||||
@ -177,7 +177,7 @@ unsigned menu_event(uint64_t input, uint64_t trigger_input)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (set_scroll)
|
if (set_scroll)
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
menu_driver_ctl(MENU_NAVIGATION_CTL_SET_SCROLL_ACCEL,
|
||||||
&new_scroll_accel);
|
&new_scroll_accel);
|
||||||
|
|
||||||
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
menu_animation_ctl(MENU_ANIMATION_CTL_DELTA_TIME, &delta_time);
|
||||||
|
@ -287,13 +287,13 @@ static int menu_input_mouse_frame(
|
|||||||
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_DOWN))
|
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_DOWN))
|
||||||
{
|
{
|
||||||
unsigned increment_by = 1;
|
unsigned increment_by = 1;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_INCREMENT, &increment_by);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_INCREMENT, &increment_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_UP))
|
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_UP))
|
||||||
{
|
{
|
||||||
unsigned decrement_by = 1;
|
unsigned decrement_by = 1;
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_DECREMENT, &decrement_by);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_DECREMENT, &decrement_by);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_HORIZ_WHEEL_UP))
|
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_HORIZ_WHEEL_UP))
|
||||||
|
@ -502,10 +502,10 @@ int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
|
|||||||
ret = cbs->action_down(entry->type, entry->label);
|
ret = cbs->action_down(entry->type, entry->label);
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_SCROLL_UP:
|
case MENU_ACTION_SCROLL_UP:
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_DESCEND_ALPHABET, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_DESCEND_ALPHABET, NULL);
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_SCROLL_DOWN:
|
case MENU_ACTION_SCROLL_DOWN:
|
||||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_ASCEND_ALPHABET, NULL);
|
menu_driver_ctl(MENU_NAVIGATION_CTL_ASCEND_ALPHABET, NULL);
|
||||||
break;
|
break;
|
||||||
case MENU_ACTION_CANCEL:
|
case MENU_ACTION_CANCEL:
|
||||||
if (cbs && cbs->action_cancel)
|
if (cbs && cbs->action_cancel)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user