(Overlay) Refactor some more code

This commit is contained in:
twinaphex 2015-07-12 07:03:39 +02:00
parent 86e7f34666
commit 599ed62849
3 changed files with 8 additions and 6 deletions

View File

@ -1408,8 +1408,9 @@ void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod)
ol->iface->set_alpha(ol->iface_data, i, mod); ol->iface->set_alpha(ol->iface_data, i, mod);
} }
static bool input_overlay_is_alive(input_overlay_t *ol) bool input_overlay_is_alive(void)
{ {
input_overlay_t *ol = input_overlay_get_ptr();
if (!ol) if (!ol)
return false; return false;
return ol->alive; return ol->alive;
@ -1437,7 +1438,7 @@ void input_poll_overlay(float opacity)
input_overlay_t *ol = input_overlay_get_ptr(); input_overlay_t *ol = input_overlay_get_ptr();
input_overlay_state_t *ol_state = input_overlay_get_state_ptr(); input_overlay_state_t *ol_state = input_overlay_get_state_ptr();
if (!input_overlay_is_alive(ol) || !ol_state) if (!input_overlay_is_alive() || !ol_state)
return; return;
memcpy(old_key_state.keys, ol_state->keys, memcpy(old_key_state.keys, ol_state->keys,

View File

@ -244,6 +244,8 @@ void input_state_overlay(int16_t *ret,
bool input_overlay_key_pressed(int key); bool input_overlay_key_pressed(int key);
bool input_overlay_is_alive(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -595,11 +595,10 @@ static int menu_input_mouse(unsigned *action)
menu_input_t *menu_input = menu_input_get_ptr(); menu_input_t *menu_input = menu_input_get_ptr();
menu_framebuf_t *frame_buf= menu_display_fb_get_ptr(); menu_framebuf_t *frame_buf= menu_display_fb_get_ptr();
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
input_overlay_t *overlay = input_overlay_get_ptr();
if (!settings->menu.mouse.enable if (!settings->menu.mouse.enable
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
|| (settings->input.overlay_enable && driver && overlay) || (settings->input.overlay_enable && input_overlay_is_alive())
#endif #endif
) )
{ {
@ -767,7 +766,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse,
if (!settings->menu.mouse.enable if (!settings->menu.mouse.enable
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
|| (settings->input.overlay_enable && driver && overlay) || (settings->input.overlay_enable && input_overlay_is_alive())
#endif #endif
) )
{ {
@ -883,7 +882,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs,
if (!settings->menu.pointer.enable if (!settings->menu.pointer.enable
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
|| (settings->input.overlay_enable && driver && overlay) || (settings->input.overlay_enable && input_overlay_is_alive())
#endif #endif
) )
return 0; return 0;