Simplify menu_input_post_iterate

This commit is contained in:
twinaphex 2015-05-11 11:48:43 +02:00
parent dd214a7a4b
commit 4229d97e73
3 changed files with 15 additions and 23 deletions

View File

@ -489,20 +489,6 @@ static int action_iterate_switch(const char *label, unsigned action)
return menu_entry_action(&entry, selected, action);
}
static void action_iterate_post(int *ret, const char *label, unsigned action)
{
menu_entry_t entry;
menu_file_list_cbs_t *cbs = NULL;
menu_list_t *menu_list = menu_list_get_ptr();
size_t selected = menu_navigation_get_current_selection();
menu_entry_get(&entry, selected, NULL, false);
cbs = (menu_file_list_cbs_t*)menu_list_get_actiondata_at_offset(menu_list->selection_buf, selected);
menu_input_post_iterate(ret, cbs, entry.path, entry.label, entry.type, action);
}
static int action_iterate_main(const char *label, unsigned action)
{
int ret = 0;
@ -544,7 +530,7 @@ static int action_iterate_main(const char *label, unsigned action)
if (ret)
return ret;
action_iterate_post(&ret, label, action);
menu_input_post_iterate(&ret, action);
menu_driver_render();

View File

@ -24,6 +24,7 @@
#include <string.h>
#include "menu_input.h"
#include "menu.h"
#include "menu_entry.h"
#include "menu_setting.h"
#include "menu_shader.h"
#include "menu_navigation.h"
@ -921,19 +922,25 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
return ret;
}
void menu_input_post_iterate(int *ret, menu_file_list_cbs_t *cbs, const char *path,
const char *label, unsigned type, unsigned action)
void menu_input_post_iterate(int *ret, unsigned action)
{
uint64_t input_mouse = MOUSE_ACTION_NONE;
settings_t *settings = config_get_ptr();
menu_entry_t entry;
menu_list_t *menu_list = menu_list_get_ptr();
uint64_t input_mouse = MOUSE_ACTION_NONE;
settings_t *settings = config_get_ptr();
size_t selected = menu_navigation_get_current_selection();
menu_file_list_cbs_t *cbs = (menu_file_list_cbs_t*)
menu_list_get_actiondata_at_offset(menu_list->selection_buf, selected);
menu_entry_get(&entry, selected, NULL, false);
if (settings->menu.mouse.enable)
*ret = menu_input_mouse_post_iterate (&input_mouse, cbs, path, label, type, action);
*ret = menu_input_mouse_post_iterate (&input_mouse, cbs, entry.path, entry.label, entry.type, action);
menu_input_mouse_frame(input_mouse);
if (settings->menu.pointer.enable)
*ret |= menu_input_pointer_post_iterate(cbs, path, label, type, action);
*ret |= menu_input_pointer_post_iterate(cbs, entry.path, entry.label, entry.type, action);
}
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_input)

View File

@ -74,8 +74,7 @@ int menu_input_bind_iterate_keyboard(void);
unsigned menu_input_frame(retro_input_t input, retro_input_t trigger_state);
void menu_input_post_iterate(int *ret, menu_file_list_cbs_t *cbs, const char *path,
const char *label, unsigned type, unsigned action);
void menu_input_post_iterate(int *ret, unsigned action);
void menu_input_search_start(void);