From 166c0c23110c4d90e4c33c3386d8c87ddc84772f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 17 Feb 2020 16:07:37 +0100 Subject: [PATCH] Cleanups --- gfx/gfx_widgets.c | 13 +++---------- gfx/gfx_widgets.h | 3 ++- retroarch.c | 12 ++++++++++-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/gfx/gfx_widgets.c b/gfx/gfx_widgets.c index 09cbd0285f..a363c85cec 100644 --- a/gfx/gfx_widgets.c +++ b/gfx/gfx_widgets.c @@ -30,10 +30,6 @@ #include "gfx_display.h" #include "font_driver.h" -#ifdef HAVE_ACCESSIBILITY -#include "../accessibility.h" -#endif - #include "../msg_hash.h" #include "../tasks/task_content.h" @@ -346,14 +342,11 @@ void gfx_widgets_msg_queue_push( char *title, enum message_queue_icon icon, enum message_queue_category category, - unsigned prio, bool flush) + unsigned prio, bool flush, + bool menu_is_alive) { menu_widget_msg_t* msg_widget = NULL; -#ifdef HAVE_ACCESSIBILITY - if (is_accessibility_enabled()) - accessibility_speak_priority((char*)msg, 0); -#endif if (fifo_write_avail(msg_queue) > 0) { /* Get current msg if it exists */ @@ -434,7 +427,7 @@ void gfx_widgets_msg_queue_push( * text with expanded width */ unsigned title_length = (unsigned)strlen(title); char *msg = strdup(title); - unsigned width = menu_driver_is_alive() + unsigned width = menu_is_alive ? msg_queue_default_rect_width_menu_alive : msg_queue_default_rect_width; unsigned text_width = font_driver_get_message_width( diff --git a/gfx/gfx_widgets.h b/gfx/gfx_widgets.h index 7938fe02e2..eeb2b3166a 100644 --- a/gfx/gfx_widgets.h +++ b/gfx/gfx_widgets.h @@ -46,7 +46,8 @@ void gfx_widgets_msg_queue_push( char *title, enum message_queue_icon icon, enum message_queue_category category, - unsigned prio, bool flush); + unsigned prio, bool flush, + bool menu_is_alive); void gfx_widgets_volume_update_and_show(float new_volume, bool mute); diff --git a/retroarch.c b/retroarch.c index d8ff98fd78..016a7bbecd 100644 --- a/retroarch.c +++ b/retroarch.c @@ -25958,7 +25958,11 @@ static void runloop_task_msg_queue_push( runloop_msg_queue_lock(); ui_companion_driver_msg_queue_push(msg, prio, task ? duration : duration * 60 / 1000, flush); - gfx_widgets_msg_queue_push(task, msg, duration, NULL, (enum message_queue_icon)MESSAGE_QUEUE_CATEGORY_INFO, (enum message_queue_category)MESSAGE_QUEUE_ICON_DEFAULT, prio, flush); +#ifdef HAVE_ACCESSIBILITY + if (is_accessibility_enabled()) + accessibility_speak_priority((char*)msg, 0); +#endif + gfx_widgets_msg_queue_push(task, msg, duration, NULL, (enum message_queue_icon)MESSAGE_QUEUE_CATEGORY_INFO, (enum message_queue_category)MESSAGE_QUEUE_ICON_DEFAULT, prio, flush, menu_driver_alive); runloop_msg_queue_unlock(); } else @@ -26828,9 +26832,13 @@ void runloop_msg_queue_push(const char *msg, #if defined(HAVE_MENU) && defined(HAVE_MENU_WIDGETS) if (gfx_widgets_inited) { +#ifdef HAVE_ACCESSIBILITY + if (is_accessibility_enabled()) + accessibility_speak_priority((char*)msg, 0); +#endif gfx_widgets_msg_queue_push(NULL, msg, roundf((float)duration / 60.0f * 1000.0f), - title, icon, category, prio, flush); + title, icon, category, prio, flush, menu_driver_alive); duration = duration * 60 / 1000; } else