Pass userdata pointer to environ callback

This commit is contained in:
twinaphex 2015-12-10 16:23:32 +01:00
parent bd0a427df1
commit 604cbc585f
5 changed files with 7 additions and 8 deletions

View File

@ -1142,7 +1142,7 @@ static void mui_context_reset(void)
menu_display_handle_wallpaper_upload, NULL); menu_display_handle_wallpaper_upload, NULL);
} }
static int mui_environ(menu_environ_cb_t type, void *data) static int mui_environ(menu_environ_cb_t type, void *data, void *userdata)
{ {
switch (type) switch (type)
{ {

View File

@ -787,7 +787,7 @@ static void rgui_populate_entries(const char *path,
rgui_navigation_set(true); rgui_navigation_set(true);
} }
static int rgui_environ(menu_environ_cb_t type, void *data) static int rgui_environ(menu_environ_cb_t type, void *data, void *userdata)
{ {
switch (type) switch (type)
{ {

View File

@ -1115,15 +1115,13 @@ static void xmb_refresh_horizontal_list(xmb_handle_t *xmb)
xmb_context_reset_horizontal_list(xmb, themepath); xmb_context_reset_horizontal_list(xmb, themepath);
} }
static int xmb_environ(menu_environ_cb_t type, void *data) static int xmb_environ(menu_environ_cb_t type, void *data, void *userdata)
{ {
switch (type) switch (type)
{ {
case MENU_ENVIRON_RESET_HORIZONTAL_LIST: case MENU_ENVIRON_RESET_HORIZONTAL_LIST:
{ {
menu_handle_t *menu = menu_driver_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)userdata;
xmb_handle_t *xmb = menu ?
(xmb_handle_t*)menu->userdata : NULL;
if (!xmb) if (!xmb)
return -1; return -1;

View File

@ -340,10 +340,11 @@ bool menu_driver_load_image(void *data, menu_image_type_t type)
bool menu_environment_cb(menu_environ_cb_t type, void *data) bool menu_environment_cb(menu_environ_cb_t type, void *data)
{ {
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr(); const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
menu_handle_t *menu = menu_driver_get_ptr();
if (driver->environ_cb) if (driver->environ_cb)
{ {
int ret = driver->environ_cb(type, data); int ret = driver->environ_cb(type, data, menu->userdata);
if (ret == 0) if (ret == 0)
return true; return true;
} }

View File

@ -283,7 +283,7 @@ typedef struct menu_ctx_driver
uint32_t label_hash, uint32_t menu_label_hash); uint32_t label_hash, uint32_t menu_label_hash);
bool (*load_image)(void *data, menu_image_type_t type); bool (*load_image)(void *data, menu_image_type_t type);
const char *ident; const char *ident;
int (*environ_cb)(menu_environ_cb_t type, void *data); int (*environ_cb)(menu_environ_cb_t type, void *data, void *userdata);
int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr, int (*pointer_tap)(unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs, menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action); menu_entry_t *entry, unsigned action);