mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Refactor menu_navigation.c
This commit is contained in:
parent
4c41899e28
commit
4aa96ab2f0
@ -198,6 +198,7 @@ void menu_free(menu_handle_t *menu)
|
|||||||
menu_shader_free(menu);
|
menu_shader_free(menu);
|
||||||
|
|
||||||
menu_input_free();
|
menu_input_free();
|
||||||
|
menu_navigation_free();
|
||||||
menu_driver_free(menu);
|
menu_driver_free(menu);
|
||||||
|
|
||||||
#ifdef HAVE_DYNAMIC
|
#ifdef HAVE_DYNAMIC
|
||||||
|
@ -27,7 +27,6 @@ struct menu_entries
|
|||||||
size_t begin;
|
size_t begin;
|
||||||
menu_list_t *menu_list;
|
menu_list_t *menu_list;
|
||||||
rarch_setting_t *list_settings;
|
rarch_setting_t *list_settings;
|
||||||
menu_navigation_t navigation;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static menu_entries_t *menu_entries_get_ptr(void)
|
static menu_entries_t *menu_entries_get_ptr(void)
|
||||||
@ -56,14 +55,6 @@ menu_list_t *menu_list_get_ptr(void)
|
|||||||
return entries->menu_list;
|
return entries->menu_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_navigation_t *menu_navigation_get_ptr(void)
|
|
||||||
{
|
|
||||||
menu_entries_t *entries = menu_entries_get_ptr();
|
|
||||||
if (!entries)
|
|
||||||
return NULL;
|
|
||||||
return &entries->navigation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sets the starting index of the menu entry list. */
|
/* Sets the starting index of the menu entry list. */
|
||||||
void menu_entries_set_start(size_t i)
|
void menu_entries_set_start(size_t i)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include <boolean.h>
|
#include <boolean.h>
|
||||||
|
|
||||||
#include "menu_navigation.h"
|
|
||||||
#include "menu_list.h"
|
#include "menu_list.h"
|
||||||
#include "menu_setting.h"
|
#include "menu_setting.h"
|
||||||
#include "menu_entry.h"
|
#include "menu_entry.h"
|
||||||
@ -48,8 +47,6 @@ int menu_entries_get_core_title(char *title_msg, size_t title_msg_len);
|
|||||||
|
|
||||||
rarch_setting_t *menu_setting_get_ptr(void);
|
rarch_setting_t *menu_setting_get_ptr(void);
|
||||||
|
|
||||||
menu_navigation_t *menu_navigation_get_ptr(void);
|
|
||||||
|
|
||||||
bool menu_entries_needs_refresh(void);
|
bool menu_entries_needs_refresh(void);
|
||||||
|
|
||||||
void menu_entries_set_refresh(bool nonblocking);
|
void menu_entries_set_refresh(bool nonblocking);
|
||||||
|
@ -18,6 +18,11 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <direct.h>
|
||||||
|
#else
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
@ -25,6 +30,29 @@
|
|||||||
|
|
||||||
#include "../configuration.h"
|
#include "../configuration.h"
|
||||||
|
|
||||||
|
typedef struct menu_navigation
|
||||||
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
/* Quick jumping indices with L/R.
|
||||||
|
* Rebuilt when parsing directory. */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
size_t list[2 * (26 + 2) + 1];
|
||||||
|
unsigned size;
|
||||||
|
} indices;
|
||||||
|
unsigned acceleration;
|
||||||
|
} scroll;
|
||||||
|
size_t selection_ptr;
|
||||||
|
} menu_navigation_t;
|
||||||
|
|
||||||
|
static menu_navigation_t menu_navigation_state;
|
||||||
|
|
||||||
|
static menu_navigation_t *menu_navigation_get_ptr(void)
|
||||||
|
{
|
||||||
|
return &menu_navigation_state;
|
||||||
|
}
|
||||||
|
|
||||||
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
||||||
{
|
{
|
||||||
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
const menu_ctx_driver_t *driver = menu_ctx_driver_get_ptr();
|
||||||
@ -229,3 +257,8 @@ bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void menu_navigation_free(void)
|
||||||
|
{
|
||||||
|
memset(&menu_navigation_state, 0, sizeof(menu_navigation_t));
|
||||||
|
}
|
||||||
|
@ -18,32 +18,11 @@
|
|||||||
#define _MENU_NAVIGATION_H
|
#define _MENU_NAVIGATION_H
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#ifdef _WIN32
|
|
||||||
#include <direct.h>
|
|
||||||
#else
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct menu_navigation
|
|
||||||
{
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
/* Quick jumping indices with L/R.
|
|
||||||
* Rebuilt when parsing directory. */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
size_t list[2 * (26 + 2) + 1];
|
|
||||||
unsigned size;
|
|
||||||
} indices;
|
|
||||||
unsigned acceleration;
|
|
||||||
} scroll;
|
|
||||||
size_t selection_ptr;
|
|
||||||
} menu_navigation_t;
|
|
||||||
|
|
||||||
enum menu_navigation_ctl_state
|
enum menu_navigation_ctl_state
|
||||||
{
|
{
|
||||||
MENU_NAVIGATION_CTL_CLEAR = 0,
|
MENU_NAVIGATION_CTL_CLEAR = 0,
|
||||||
@ -63,6 +42,8 @@ enum menu_navigation_ctl_state
|
|||||||
|
|
||||||
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data);
|
bool menu_navigation_ctl(enum menu_navigation_ctl_state state, void *data);
|
||||||
|
|
||||||
|
void menu_navigation_free(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user