Revert "Start passing around menu_driver_data around properly"

This reverts commit 7c314a91650c9b4d74222bbdefa37e014fa4ae0d.
This commit is contained in:
twinaphex 2018-04-11 06:12:14 +02:00
parent b540ae3d4d
commit 1836d08b33
10 changed files with 47 additions and 83 deletions

View File

@ -95,13 +95,7 @@ static int action_select_default(const char *path, const char *label, unsigned t
}
if (action != MENU_ACTION_NOOP)
{
menu_handle_t *menu = NULL;
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
ret = menu_entry_action(&entry, menu, (unsigned)idx, action);
}
ret = menu_entry_action(&entry, (unsigned)idx, action);
menu_entry_free(&entry);

View File

@ -2268,8 +2268,7 @@ static size_t materialui_list_get_selection(void *data)
/* The pointer or the mouse is pressed down. We use this callback to
highlight the entry that has been pressed */
static int materialui_pointer_down(void *data,
void *userdata,
static int materialui_pointer_down(void *userdata,
unsigned x, unsigned y,
unsigned ptr, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
@ -2277,16 +2276,22 @@ static int materialui_pointer_down(void *data,
unsigned width, height;
unsigned header_height;
size_t entries_end = menu_entries_get_size();
materialui_handle_t *mui = (materialui_handle_t*)userdata;
materialui_handle_t *mui = (materialui_handle_t*)userdata;
if (!mui)
return 0;
header_height = menu_display_get_header_height();
header_height = menu_display_get_header_height();
video_driver_get_size(&width, &height);
if (y < header_height) { }
else if (y > height - mui->tabs_height) { }
if (y < header_height)
{
}
else if (y > height - mui->tabs_height)
{
}
else if (ptr <= (entries_end - 1))
{
size_t ii;
@ -2313,8 +2318,7 @@ static int materialui_pointer_down(void *data,
If we clicked on the header, we perform a cancel action.
If we clicked on the tabs, we switch to a new list.
If we clicked on a menu entry, we call the entry action callback. */
static int materialui_pointer_up(void *data,
void *userdata,
static int materialui_pointer_up(void *userdata,
unsigned x, unsigned y,
unsigned ptr, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
@ -2322,7 +2326,7 @@ static int materialui_pointer_up(void *data,
unsigned width, height;
unsigned header_height, i;
size_t entries_end = menu_entries_get_size();
materialui_handle_t *mui = (materialui_handle_t*)userdata;
materialui_handle_t *mui = (materialui_handle_t*)userdata;
if (!mui)
return 0;
@ -2333,7 +2337,7 @@ static int materialui_pointer_up(void *data,
if (y < header_height)
{
size_t selection = menu_navigation_get_selection();
return menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_CANCEL);
return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL);
}
else if (y > height - mui->tabs_height)
{
@ -2372,8 +2376,7 @@ static int materialui_pointer_up(void *data,
)
{
if (ptr == ii && cbs && cbs->action_select)
return menu_entry_action(entry, data,
(unsigned)ii, MENU_ACTION_SELECT);
return menu_entry_action(entry, (unsigned)ii, MENU_ACTION_SELECT);
}
}
}

View File

@ -229,7 +229,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action)
menu_entry_init(&entry);
menu_entry_get(&entry, 0, selection, NULL, false);
ret = menu_entry_action(&entry, menu,
ret = menu_entry_action(&entry,
(unsigned)selection, (enum menu_action)action);
menu_entry_free(&entry);
if (ret)

View File

@ -868,7 +868,6 @@ static int rgui_environ(enum menu_environ_cb type,
}
static int rgui_pointer_tap(void *data,
void *userdata,
unsigned x, unsigned y,
unsigned ptr, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
@ -878,16 +877,14 @@ static int rgui_pointer_tap(void *data,
if (y < header_height)
{
size_t selection = menu_navigation_get_selection();
return menu_entry_action(entry, data,
(unsigned)selection, MENU_ACTION_CANCEL);
return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL);
}
else if (ptr <= (menu_entries_get_size() - 1))
{
size_t selection = menu_navigation_get_selection();
if (ptr == selection && cbs && cbs->action_select)
return menu_entry_action(entry, data,
(unsigned)selection, MENU_ACTION_SELECT);
return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT);
menu_navigation_set_selection(ptr);
menu_driver_navigation_set(false);

View File

@ -5132,8 +5132,7 @@ error:
return false;
}
static int xmb_pointer_tap(void *data,
void *userdata,
static int xmb_pointer_tap(void *userdata,
unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
@ -5143,13 +5142,13 @@ static int xmb_pointer_tap(void *data,
if (y < header_height)
{
size_t selection = menu_navigation_get_selection();
return (unsigned)menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_CANCEL);
return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL);
}
else if (ptr <= (menu_entries_get_size() - 1))
{
size_t selection = menu_navigation_get_selection();
if (ptr == selection && cbs && cbs->action_select)
return (unsigned)menu_entry_action(entry, data, (unsigned)selection, MENU_ACTION_SELECT);
return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT);
menu_navigation_set_selection(ptr);
menu_driver_navigation_set(false);

View File

@ -2119,8 +2119,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
point->retcode = 0;
return false;
}
point->retcode = menu_driver_ctx->pointer_tap(menu_driver_data,
menu_userdata,
point->retcode = menu_driver_ctx->pointer_tap(menu_userdata,
point->x, point->y, point->ptr,
point->cbs, point->entry, point->action);
}
@ -2133,9 +2132,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
point->retcode = 0;
return false;
}
point->retcode = menu_driver_ctx->pointer_down(
menu_driver_data,
menu_userdata,
point->retcode = menu_driver_ctx->pointer_down(menu_userdata,
point->x, point->y, point->ptr,
point->cbs, point->entry, point->action);
}
@ -2148,9 +2145,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
point->retcode = 0;
return false;
}
point->retcode = menu_driver_ctx->pointer_up(
menu_driver_data,
menu_userdata,
point->retcode = menu_driver_ctx->pointer_up(menu_userdata,
point->x, point->y, point->ptr,
point->cbs, point->entry, point->action);
}

View File

@ -486,8 +486,7 @@ typedef struct menu_ctx_driver
bool (*load_image)(void *userdata, void *data, enum menu_image_type type);
const char *ident;
int (*environ_cb)(enum menu_environ_cb type, void *data, void *userdata);
int (*pointer_tap)(void *data, void *userdata,
unsigned x, unsigned y, unsigned ptr,
int (*pointer_tap)(void *data, unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action);
void (*update_thumbnail_path)(void *data, unsigned i, char pos);
@ -497,12 +496,10 @@ typedef struct menu_ctx_driver
int (*osk_ptr_at_pos)(void *data, int x, int y, unsigned width, unsigned height);
void (*update_savestate_thumbnail_path)(void *data, unsigned i);
void (*update_savestate_thumbnail_image)(void *data);
int (*pointer_down)(void *data, void *userdata,
unsigned x, unsigned y, unsigned ptr,
int (*pointer_down)(void *data, unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action);
int (*pointer_up)(void *data, void *userdata,
unsigned x, unsigned y, unsigned ptr,
int (*pointer_up)(void *data, unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action);
} menu_ctx_driver_t;

View File

@ -286,14 +286,8 @@ static int menu_input_mouse_frame(
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_BUTTON_R))
{
size_t selection = menu_navigation_get_selection();
menu_handle_t *menu = NULL;
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
menu_entry_action(entry, menu,
(unsigned)selection,
MENU_ACTION_CANCEL);
size_t selection = menu_navigation_get_selection();
menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL);
}
if (BIT64_GET(mouse_state, MENU_MOUSE_ACTION_WHEEL_DOWN))
@ -527,15 +521,9 @@ static int menu_input_pointer_post_iterate(
{
if (menu_input->pointer.counter > 32)
{
size_t selection = menu_navigation_get_selection();
menu_handle_t *menu = NULL;
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
size_t selection = menu_navigation_get_selection();
if (cbs && cbs->action_start)
return menu_entry_action(entry, menu,
(unsigned)selection,
MENU_ACTION_START);
return menu_entry_action(entry, (unsigned)selection, MENU_ACTION_START);
}
else
@ -564,14 +552,8 @@ static int menu_input_pointer_post_iterate(
{
if (!pointer_oldback)
{
menu_handle_t *menu = NULL;
pointer_oldback = true;
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
menu_entry_action(entry, menu,
(unsigned)menu_navigation_get_selection(),
MENU_ACTION_CANCEL);
pointer_oldback = true;
menu_entry_action(entry, (unsigned)menu_navigation_get_selection(), MENU_ACTION_CANCEL);
}
}

View File

@ -254,15 +254,12 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len)
void menu_entry_reset(uint32_t i)
{
menu_handle_t *menu = NULL;
menu_entry_t entry;
menu_entry_init(&entry);
menu_entry_get(&entry, 0, i, NULL, true);
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
menu_entry_action(&entry, menu, i, MENU_ACTION_START);
menu_entry_action(&entry, i, MENU_ACTION_START);
}
void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len)
@ -411,21 +408,16 @@ bool menu_entry_is_currently_selected(unsigned id)
int menu_entry_select(uint32_t i)
{
menu_entry_t entry;
menu_handle_t *menu = NULL;
menu_navigation_set_selection(i);
menu_entry_init(&entry);
menu_entry_get(&entry, 0, i, NULL, false);
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
return menu_entry_action(&entry, menu, i, MENU_ACTION_SELECT);
return menu_entry_action(&entry, i, MENU_ACTION_SELECT);
}
int menu_entry_action(menu_entry_t *entry,
void *data,
unsigned i, enum menu_action action)
int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action)
{
int ret = 0;
file_list_t *selection_buf =
@ -456,9 +448,15 @@ int menu_entry_action(menu_entry_t *entry,
break;
case MENU_ACTION_OK:
if (cbs && cbs->action_ok)
ret = cbs->action_ok(data, entry->path,
entry->label, entry->type, i, entry->entry_idx);
{
menu_handle_t *menu = NULL;
menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu);
if (cbs && cbs->action_ok)
ret = cbs->action_ok(menu, entry->path,
entry->label, entry->type, i, entry->entry_idx);
}
break;
case MENU_ACTION_START:
if (cbs && cbs->action_start)

View File

@ -113,8 +113,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx,
int menu_entry_select(uint32_t i);
int menu_entry_action(menu_entry_t *entry,
void *data,
unsigned i, enum menu_action action);
unsigned i, enum menu_action action);
void menu_entry_free(menu_entry_t *entry);