Add RARCH_MENU_CTL_ENVIRONMENT

This commit is contained in:
twinaphex 2016-02-10 20:19:21 +01:00
parent b5e28cda58
commit f77722a213
3 changed files with 24 additions and 17 deletions

View File

@ -33,7 +33,11 @@
#ifdef HAVE_LIBRETRODB
static void handle_dbscan_finished(void *task_data, void *user_data, const char *err)
{
menu_environment_cb(MENU_ENVIRON_RESET_HORIZONTAL_LIST, NULL);
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_RESET_HORIZONTAL_LIST;
menu_environ.data = NULL;
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
}
int action_scan_file(const char *path,

View File

@ -359,19 +359,6 @@ static void menu_driver_toggle(bool latch)
}
}
bool menu_environment_cb(menu_environ_cb_t type, void *data)
{
if (menu_driver_ctx->environ_cb)
{
int ret = menu_driver_ctx->environ_cb(type, data, menu_userdata);
if (ret == 0)
return true;
}
return false;
}
int menu_driver_pointer_tap(unsigned x, unsigned y, unsigned ptr,
menu_file_list_cbs_t *cbs,
menu_entry_t *entry, unsigned action)
@ -784,6 +771,17 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
return false;
}
break;
case RARCH_MENU_CTL_ENVIRONMENT:
{
menu_ctx_environment_t *menu_environ = (menu_ctx_environment_t*)data;
if (menu_driver_ctx->environ_cb)
{
if (menu_driver_ctx->environ_cb(menu_environ->type, menu_environ->data,
menu_userdata) == 0)
return true;
}
}
return false;
default:
case RARCH_MENU_CTL_NONE:
break;

View File

@ -147,7 +147,8 @@ enum rarch_menu_ctl_state
RARCH_MENU_CTL_LOAD_IMAGE,
RARCH_MENU_CTL_LIST_CACHE,
RARCH_MENU_CTL_LIST_INSERT,
RARCH_MENU_CTL_ITERATE
RARCH_MENU_CTL_ITERATE,
RARCH_MENU_CTL_ENVIRONMENT
};
typedef enum
@ -345,6 +346,12 @@ typedef struct menu_ctx_iterate
enum menu_action action;
} menu_ctx_iterate_t;
typedef struct menu_ctx_environment
{
menu_environ_cb_t type;
void *data;
} menu_ctx_environment_t;
/**
* menu_driver_find_handle:
* @index : index of driver to get handle to.
@ -386,8 +393,6 @@ bool menu_driver_list_push(menu_displaylist_info_t *info, unsigned type);
size_t menu_driver_list_get_selection(void);
bool menu_environment_cb(menu_environ_cb_t type, void *data);
int menu_driver_bind_init(menu_file_list_cbs_t *cbs,
const char *path, const char *label, unsigned type, size_t idx,
const char *elem0, const char *elem1,