(RGUI) Fix delayed info/help/search screens

This commit is contained in:
Higor Eurípedes 2015-06-23 22:22:53 -03:00
parent d188f4e261
commit 71f025c2b6

View File

@ -52,6 +52,10 @@
#define TITLE_COLOR(settings) (argb32_to_rgba4444(settings->menu.title_color))
#endif
typedef struct {
char msgbox[4096];
} rgui_t;
static INLINE uint16_t argb32_to_rgba4444(uint32_t col)
{
unsigned a = ((col >> 24) & 0xff) >> 4;
@ -253,6 +257,18 @@ static void rgui_render_background(void)
green_filler);
}
static void rgui_set_message(const char *message)
{
menu_handle_t *menu = menu_driver_get_ptr();
rgui_t *rgui = NULL;
if (!menu || !menu->userdata)
return;
rgui = (rgui_t*)menu->userdata;
strlcpy(rgui->msgbox, message, sizeof(rgui->msgbox));
}
static void rgui_render_messagebox(const char *message)
{
size_t i;
@ -359,6 +375,7 @@ static void rgui_render(void)
settings_t *settings = config_get_ptr();
menu_animation_t *anim = menu_animation_get_ptr();
uint64_t frame_count = video_driver_get_frame_count();
rgui_t *rgui = NULL;
title[0] = '\0';
title_buf[0] = '\0';
@ -367,16 +384,17 @@ static void rgui_render(void)
(void)driver;
if (!menu)
if (!menu || !menu->userdata)
return;
if (menu_entries_needs_refresh() && menu_driver_alive() && !disp->msg_force)
return;
rgui = menu->userdata;
if (runloop->is_idle)
return;
if (!menu_display_update_pending())
if (menu_entries_needs_refresh()
&& menu_driver_alive()
&& !disp->msg_force
&& runloop->is_idle
&& !menu_display_update_pending()
&& rgui->msgbox[0] == '\0')
return;
/* ensures the framebuffer will be rendered on the screen */
@ -384,6 +402,7 @@ static void rgui_render(void)
anim->is_active = false;
anim->label.is_updated = false;
if (settings->menu.pointer.enable)
{
menu_input->pointer.ptr = menu_input->pointer.y / 11 - 2 + menu_entries_get_start();
@ -530,6 +549,12 @@ static void rgui_render(void)
rgui_render_messagebox(msg);
}
if (rgui->msgbox[0] != '\0')
{
rgui_render_messagebox(rgui->msgbox);
rgui->msgbox[0] = '\0';
}
if (settings->menu.mouse.enable)
rgui_blit_cursor(menu);
}
@ -539,10 +564,16 @@ static void *rgui_init(void)
bool ret = false;
menu_framebuf_t *frame_buf = NULL;
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
rgui_t *rgui = NULL;
if (!menu)
return NULL;
menu->userdata = rgui = (rgui_t*)calloc(1, sizeof(rgui_t));
if (!rgui)
goto error;
frame_buf = &menu->display.frame_buf;
/* 4 extra lines to cache the checked background */
@ -687,7 +718,7 @@ static void rgui_populate_entries(const char *path,
menu_ctx_driver_t menu_ctx_rgui = {
rgui_set_texture,
rgui_render_messagebox,
rgui_set_message,
rgui_render,
NULL,
rgui_init,