(XMB) Cleanups

This commit is contained in:
twinaphex 2019-06-15 10:07:55 +02:00
parent b26a5badfd
commit 72a35481ea

View File

@ -1078,9 +1078,7 @@ static void xmb_update_thumbnail_image(void *data)
static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i) static unsigned xmb_get_system_tab(xmb_handle_t *xmb, unsigned i)
{ {
if (i <= xmb->system_tab_end) if (i <= xmb->system_tab_end)
{
return xmb->tabs[i]; return xmb->tabs[i];
}
return UINT_MAX; return UINT_MAX;
} }
@ -1092,7 +1090,8 @@ static void xmb_refresh_thumbnail_image(void *data)
return; return;
/* Only refresh thumbnails if thumbnails are enabled */ /* Only refresh thumbnails if thumbnails are enabled */
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)) if ( menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) ||
menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
{ {
unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN);
unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr); unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
@ -1207,7 +1206,8 @@ static void xmb_set_thumbnail_content(void *data, const char *s)
menu_entry_get(&entry, 0, selection, NULL, true); menu_entry_get(&entry, 0, selection, NULL, true);
if (node) if (node)
if (!string_is_empty(entry.path) && !string_is_empty(node->fullpath)) if ( !string_is_empty(entry.path) &&
!string_is_empty(node->fullpath))
menu_thumbnail_set_content_image(xmb->thumbnail_path_data, node->fullpath, entry.path); menu_thumbnail_set_content_image(xmb->thumbnail_path_data, node->fullpath, entry.path);
} }
else if (!string_is_empty(s)) else if (!string_is_empty(s))
@ -1291,9 +1291,12 @@ static void xmb_selection_pointer_changed(
unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr); unsigned xmb_system_tab = xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr);
unsigned entry_type = menu_entry_get_type_new(&entry); unsigned entry_type = menu_entry_get_type_new(&entry);
ia = xmb->items_active_alpha; ia = xmb->items_active_alpha;
iz = xmb->items_active_zoom; iz = xmb->items_active_zoom;
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)) if (
menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) ||
menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)
)
{ {
bool update_thumbnails = false; bool update_thumbnails = false;
@ -1313,7 +1316,9 @@ static void xmb_selection_pointer_changed(
update_thumbnails = true; update_thumbnails = true;
} }
/* Filebrowser image updates */ /* Filebrowser image updates */
else if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE) else if (
entry_type == FILE_TYPE_IMAGEVIEWER ||
entry_type == FILE_TYPE_IMAGE)
{ {
xmb_set_thumbnail_content(xmb, "imageviewer"); xmb_set_thumbnail_content(xmb, "imageviewer");
update_thumbnails = true; update_thumbnails = true;
@ -1530,7 +1535,8 @@ static void xmb_list_open_new(xmb_handle_t *xmb,
if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS) if (xmb_system_tab <= XMB_SYSTEM_TAB_SETTINGS)
{ {
if (menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) || menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT)) if ( menu_thumbnail_is_enabled(MENU_THUMBNAIL_RIGHT) ||
menu_thumbnail_is_enabled(MENU_THUMBNAIL_LEFT))
{ {
/* This code is horrible, full of hacks... /* This code is horrible, full of hacks...
* This hack ensures that thumbnails are not cleared * This hack ensures that thumbnails are not cleared