From 599ed62849dda637befba5c98a87cf31cbe98c1e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 12 Jul 2015 07:03:39 +0200 Subject: [PATCH] (Overlay) Refactor some more code --- input/input_overlay.c | 5 +++-- input/input_overlay.h | 2 ++ menu/menu_input.c | 7 +++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/input/input_overlay.c b/input/input_overlay.c index 20e35b6dd4..edb27bba15 100644 --- a/input/input_overlay.c +++ b/input/input_overlay.c @@ -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); } -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) return false; return ol->alive; @@ -1437,7 +1438,7 @@ void input_poll_overlay(float opacity) input_overlay_t *ol = input_overlay_get_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; memcpy(old_key_state.keys, ol_state->keys, diff --git a/input/input_overlay.h b/input/input_overlay.h index 932961e187..c890c16a3b 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -244,6 +244,8 @@ void input_state_overlay(int16_t *ret, bool input_overlay_key_pressed(int key); +bool input_overlay_is_alive(void); + #ifdef __cplusplus } #endif diff --git a/menu/menu_input.c b/menu/menu_input.c index 00118a7894..7e4ef2777f 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -595,11 +595,10 @@ static int menu_input_mouse(unsigned *action) menu_input_t *menu_input = menu_input_get_ptr(); menu_framebuf_t *frame_buf= menu_display_fb_get_ptr(); settings_t *settings = config_get_ptr(); - input_overlay_t *overlay = input_overlay_get_ptr(); if (!settings->menu.mouse.enable #ifdef HAVE_OVERLAY - || (settings->input.overlay_enable && driver && overlay) + || (settings->input.overlay_enable && input_overlay_is_alive()) #endif ) { @@ -767,7 +766,7 @@ static int menu_input_mouse_post_iterate(uint64_t *input_mouse, if (!settings->menu.mouse.enable #ifdef HAVE_OVERLAY - || (settings->input.overlay_enable && driver && overlay) + || (settings->input.overlay_enable && input_overlay_is_alive()) #endif ) { @@ -883,7 +882,7 @@ static int menu_input_pointer_post_iterate(menu_file_list_cbs_t *cbs, if (!settings->menu.pointer.enable #ifdef HAVE_OVERLAY - || (settings->input.overlay_enable && driver && overlay) + || (settings->input.overlay_enable && input_overlay_is_alive()) #endif ) return 0;