Merge pull request #8261 from jdgleaver/rgui-glui-title-fix

(RGUI/GLUI) Ensure menu title is set correctly when displaying message boxes
This commit is contained in:
Twinaphex 2019-02-12 17:23:33 +01:00 committed by GitHub
commit 8ac4e6c72f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 14 deletions

View File

@ -171,6 +171,8 @@ typedef struct materialui_handle
char *box_message;
char menu_title[255];
struct
{
menu_texture_item bg;
@ -1063,7 +1065,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
menu_animation_ctx_ticker_t ticker;
menu_display_ctx_draw_t draw;
char msg[255];
char title[255];
char title_buf[255];
char title_msg[255];
@ -1168,7 +1169,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
mui->frame_count++;
msg[0] = title[0] = title_buf[0] = title_msg[0] = '\0';
msg[0] = title_buf[0] = title_msg[0] = '\0';
switch (video_info->materialui_color_theme)
{
@ -1384,8 +1385,6 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
}
}
menu_entries_get_title(title, sizeof(title));
selection = menu_navigation_get_selection();
if (background_rendered || libretro_running)
@ -1522,7 +1521,7 @@ static void materialui_frame(void *data, video_frame_info_t *video_info)
ticker.s = title_buf;
ticker.len = ticker_limit;
ticker.idx = mui->frame_count / 100;
ticker.str = title;
ticker.str = mui->menu_title;
ticker.selected = true;
menu_animation_ticker(&ticker);
@ -1685,6 +1684,8 @@ static void *materialui_init(void **userdata, bool video_is_threaded)
mui->cursor_size = scale_factor / 3;
mui->need_compute = false;
mui->menu_title[0] = '\0';
return menu;
error:
if (menu)
@ -1845,6 +1846,7 @@ static void materialui_populate_entries(
if (!mui)
return;
menu_entries_get_title(mui->menu_title, sizeof(mui->menu_title));
mui->need_compute = true;
mui->scroll_y = materialui_get_scroll(mui);
}

View File

@ -427,6 +427,7 @@ typedef struct
uint32_t thumbnail_queue_size;
bool show_wallpaper;
char theme_preset_path[PATH_MAX_LENGTH]; /* Must be a fixed length array... */
char menu_title[255]; /* Must be a fixed length array... */
struct scaler_ctx image_scaler;
} rgui_t;
@ -1616,20 +1617,17 @@ static void rgui_render(void *data, bool is_idle)
else
{
/* No thumbnail - render usual text */
char title[255];
char title_buf[255];
unsigned timedate_x = RGUI_TERM_WIDTH(fb_width) * FONT_WIDTH_STRIDE - RGUI_TERM_START_X(fb_width);
unsigned core_name_len = ((timedate_x - RGUI_TERM_START_X(fb_width)) / FONT_WIDTH_STRIDE) - 3;
bool show_core_name = settings->bools.menu_core_enable;
/* Print title */
title[0] = title_buf[0] = '\0';
menu_entries_get_title(title, sizeof(title));
title_buf[0] = '\0';
ticker.s = title_buf;
ticker.len = RGUI_TERM_WIDTH(fb_width) - 10;
ticker.str = title;
ticker.str = rgui->menu_title;
ticker.selected = true;
menu_animation_ticker(&ticker);
@ -1844,6 +1842,8 @@ static void *rgui_init(void **userdata, bool video_is_threaded)
*userdata = rgui;
rgui->menu_title[0] = '\0';
/* Prepare RGUI colors, to improve performance */
rgui->theme_preset_path[0] = '\0';
prepare_rgui_colors(rgui, settings);
@ -2081,7 +2081,6 @@ static void rgui_update_thumbnail_content(void *userdata)
{
rgui_t *rgui = (rgui_t*)userdata;
playlist_t *playlist = NULL;
char title[255];
size_t selection = menu_navigation_get_selection();
if (!rgui)
@ -2090,11 +2089,9 @@ static void rgui_update_thumbnail_content(void *userdata)
/* Check whether current selection is a playlist entry
* (i.e. whether we should be looking for a thumbnail image) */
rgui->is_playlist_entry = false;
title[0] = '\0';
menu_entries_get_title(title, sizeof(title));
if (!string_is_empty(rgui->thumbnail_playlist))
{
if (string_is_equal(path_basename(title), rgui->thumbnail_playlist))
if (string_is_equal(path_basename(rgui->menu_title), rgui->thumbnail_playlist))
{
/* Get label of currently selected playlist entry
* > This is pretty nasty, but I can't see any other way of doing
@ -2212,6 +2209,12 @@ static void rgui_populate_entries(void *data,
const char *path,
const char *label, unsigned k)
{
rgui_t *rgui = (rgui_t*)data;
if (!rgui)
return;
menu_entries_get_title(rgui->menu_title, sizeof(rgui->menu_title));
rgui_navigation_set(data, true);
}