move osk_ptr global state to rarch_state

This commit is contained in:
twinaphex 2020-06-10 18:07:20 +02:00
parent e0090010f4
commit 8daa90da23
3 changed files with 14 additions and 20 deletions

View File

@ -33,7 +33,6 @@
/* TODO/FIXME - static public global variables */ /* TODO/FIXME - static public global variables */
static char *osk_grid[45] = {NULL}; static char *osk_grid[45] = {NULL};
static int osk_ptr = 0;
#ifdef HAVE_LANGEXTRA #ifdef HAVE_LANGEXTRA
/* This file has a UTF8 BOM, we assume HAVE_LANGEXTRA is only enabled for compilers that can support this. */ /* This file has a UTF8 BOM, we assume HAVE_LANGEXTRA is only enabled for compilers that can support this. */
@ -59,16 +58,6 @@ static const char *lowercase_grid[] = {
"z","x","c","v","b","n","m"," ","-",".","Next"}; "z","x","c","v","b","n","m"," ","-",".","Next"};
#endif #endif
int input_event_get_osk_ptr(void)
{
return osk_ptr;
}
void input_event_set_osk_ptr(int i)
{
osk_ptr = i;
}
void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui) void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui)
{ {
#ifdef HAVE_LANGEXTRA #ifdef HAVE_LANGEXTRA

View File

@ -49,8 +49,6 @@ enum osk_type
int input_event_get_osk_ptr(void); int input_event_get_osk_ptr(void);
void input_event_set_osk_ptr(int a);
void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui); void input_event_osk_append(enum osk_type *osk_idx, int ptr, bool is_rgui);
void input_event_osk_iterate(enum osk_type osk_idx); void input_event_osk_iterate(enum osk_type osk_idx);

View File

@ -1762,6 +1762,7 @@ typedef struct discord_state discord_state_t;
struct rarch_state struct rarch_state
{ {
enum osk_type osk_idx; enum osk_type osk_idx;
int osk_ptr;
enum rarch_core_type current_core_type; enum rarch_core_type current_core_type;
enum rarch_core_type explicit_current_core_type; enum rarch_core_type explicit_current_core_type;
enum rotation initial_screen_orientation; enum rotation initial_screen_orientation;
@ -3615,6 +3616,12 @@ static const menu_ctx_driver_t *menu_ctx_drivers[] = {
NULL NULL
}; };
int input_event_get_osk_ptr(void)
{
struct rarch_state *p_rarch = &rarch_st;
return p_rarch->osk_ptr;
}
gfx_thumbnail_state_t *gfx_thumb_get_ptr(void) gfx_thumbnail_state_t *gfx_thumb_get_ptr(void)
{ {
struct rarch_state *p_rarch = &rarch_st; struct rarch_state *p_rarch = &rarch_st;
@ -22917,29 +22924,29 @@ static unsigned menu_event(
{ {
int old_osk_ptr = input_event_get_osk_ptr(); int old_osk_ptr = input_event_get_osk_ptr();
if (old_osk_ptr < 33) if (old_osk_ptr < 33)
input_event_set_osk_ptr(old_osk_ptr + OSK_CHARS_PER_LINE); p_rarch->osk_ptr = old_osk_ptr + OSK_CHARS_PER_LINE;
} }
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP)) if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_UP))
{ {
int old_osk_ptr = input_event_get_osk_ptr(); int old_osk_ptr = input_event_get_osk_ptr();
if (old_osk_ptr >= OSK_CHARS_PER_LINE) if (old_osk_ptr >= OSK_CHARS_PER_LINE)
input_event_set_osk_ptr(old_osk_ptr p_rarch->osk_ptr = old_osk_ptr
- OSK_CHARS_PER_LINE); - OSK_CHARS_PER_LINE;
} }
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT)) if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_RIGHT))
{ {
int old_osk_ptr = input_event_get_osk_ptr(); int old_osk_ptr = input_event_get_osk_ptr();
if (old_osk_ptr < 43) if (old_osk_ptr < 43)
input_event_set_osk_ptr(old_osk_ptr + 1); p_rarch->osk_ptr = old_osk_ptr + 1;
} }
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT)) if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_LEFT))
{ {
int old_osk_ptr = input_event_get_osk_ptr(); int old_osk_ptr = input_event_get_osk_ptr();
if (old_osk_ptr >= 1) if (old_osk_ptr >= 1)
input_event_set_osk_ptr(old_osk_ptr - 1); p_rarch->osk_ptr = old_osk_ptr - 1;
} }
if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L)) if (BIT256_GET_PTR(p_trigger_input, RETRO_DEVICE_ID_JOYPAD_L))
@ -23344,7 +23351,7 @@ static int menu_input_pointer_post_iterate(
menu_driver_ctl(RARCH_MENU_CTL_OSK_PTR_AT_POS, &point); menu_driver_ctl(RARCH_MENU_CTL_OSK_PTR_AT_POS, &point);
if (point.retcode > -1) if (point.retcode > -1)
input_event_set_osk_ptr(point.retcode); p_rarch->osk_ptr = point.retcode;
} }
/* Select + X/Y position */ /* Select + X/Y position */
@ -23636,7 +23643,7 @@ static int menu_input_pointer_post_iterate(
menu->driver_ctx && menu->driver_ctx &&
menu->driver_ctx->set_texture); menu->driver_ctx->set_texture);
input_event_set_osk_ptr(point.retcode); p_rarch->osk_ptr = point.retcode;
input_event_osk_append(&p_rarch->osk_idx, input_event_osk_append(&p_rarch->osk_idx,
point.retcode, point.retcode,
menu_has_fb); menu_has_fb);