Move another function to menu_driver.c

This commit is contained in:
twinaphex 2021-09-07 07:14:27 +02:00
parent 722166cb15
commit a0856c9847
3 changed files with 48 additions and 44 deletions

View File

@ -2212,3 +2212,46 @@ bool rarch_menu_init(
return true;
}
void menu_input_set_pointer_visibility(
menu_input_pointer_hw_state_t *pointer_hw_state,
menu_input_t *menu_input,
retro_time_t current_time)
{
static bool cursor_shown = false;
static bool cursor_hidden = false;
static retro_time_t end_time = 0;
/* Ensure that mouse cursor is hidden when not in use */
if ((menu_input->pointer.type == MENU_POINTER_MOUSE)
&& pointer_hw_state->active)
{
/* Show cursor */
if ((current_time > end_time) && !cursor_shown)
{
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_ENABLE_MOUSE_CURSOR;
menu_environ.data = NULL;
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
cursor_shown = true;
cursor_hidden = false;
}
end_time = current_time + MENU_INPUT_HIDE_CURSOR_DELAY;
}
else
{
/* Hide cursor */
if ((current_time > end_time) && !cursor_hidden)
{
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_DISABLE_MOUSE_CURSOR;
menu_environ.data = NULL;
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
cursor_shown = false;
cursor_hidden = true;
}
}
}

View File

@ -286,6 +286,11 @@ bool menu_input_key_bind_poll_find_hold(
struct menu_bind_state *new_state,
struct retro_keybind * output);
void menu_input_set_pointer_visibility(
menu_input_pointer_hw_state_t *pointer_hw_state,
menu_input_t *menu_input,
retro_time_t current_time);
RETRO_END_DECLS
#endif

View File

@ -949,50 +949,6 @@ static void get_current_menu_sublabel(struct menu_state *menu_st,
}
#endif
static void menu_input_set_pointer_visibility(
menu_input_pointer_hw_state_t *pointer_hw_state,
menu_input_t *menu_input,
retro_time_t current_time)
{
static bool cursor_shown = false;
static bool cursor_hidden = false;
static retro_time_t end_time = 0;
/* Ensure that mouse cursor is hidden when not in use */
if ((menu_input->pointer.type == MENU_POINTER_MOUSE)
&& pointer_hw_state->active)
{
/* Show cursor */
if ((current_time > end_time) && !cursor_shown)
{
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_ENABLE_MOUSE_CURSOR;
menu_environ.data = NULL;
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
cursor_shown = true;
cursor_hidden = false;
}
end_time = current_time + MENU_INPUT_HIDE_CURSOR_DELAY;
}
else
{
/* Hide cursor */
if ((current_time > end_time) && !cursor_hidden)
{
menu_ctx_environment_t menu_environ;
menu_environ.type = MENU_ENVIRON_DISABLE_MOUSE_CURSOR;
menu_environ.data = NULL;
menu_driver_ctl(RARCH_MENU_CTL_ENVIRONMENT, &menu_environ);
cursor_shown = false;
cursor_hidden = true;
}
}
}
/**
* menu_iterate:
* @input : input sample for this frame