mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Merge pull request #10342 from jdgleaver/thumb-swap-fix
(XMB/Ozone) Fix thumbnail switching via 'scan' button functionality
This commit is contained in:
commit
e639d2b09a
@ -108,63 +108,53 @@ int action_switch_thumbnail(const char *path,
|
|||||||
{
|
{
|
||||||
const char *menu_ident = menu_driver_ident();
|
const char *menu_ident = menu_driver_ident();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
bool special_case = false;
|
bool switch_enabled = true;
|
||||||
#ifdef HAVE_RGUI
|
#ifdef HAVE_RGUI
|
||||||
special_case = !string_is_equal(menu_ident, "rgui");
|
switch_enabled = !string_is_equal(menu_ident, "rgui");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MATERIALUI
|
#ifdef HAVE_MATERIALUI
|
||||||
special_case = special_case && !string_is_equal(menu_ident, "glui");
|
switch_enabled = switch_enabled && !string_is_equal(menu_ident, "glui");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!settings)
|
if (!settings)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* RGUI is a special case where thumbnail 'switch' corresponds to
|
||||||
|
* toggling thumbnail view on/off.
|
||||||
|
* GLUI is a special case where thumbnail 'switch' corresponds to
|
||||||
|
* changing thumbnail view mode.
|
||||||
|
* For other menu drivers, we cycle through available thumbnail
|
||||||
|
* types. */
|
||||||
|
if (!switch_enabled)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (settings->uints.gfx_thumbnails == 0)
|
if (settings->uints.gfx_thumbnails == 0)
|
||||||
{
|
{
|
||||||
/* RGUI is a special case where thumbnail 'switch' corresponds to
|
configuration_set_uint(settings,
|
||||||
* toggling thumbnail view on/off.
|
settings->uints.menu_left_thumbnails,
|
||||||
* GLUI is a special case where thumbnail 'switch' corresponds to
|
settings->uints.menu_left_thumbnails + 1);
|
||||||
* changing thumbnail view mode.
|
|
||||||
* For other menu drivers, we cycle through available thumbnail
|
|
||||||
* types. */
|
|
||||||
if (special_case)
|
|
||||||
{
|
|
||||||
configuration_set_uint(settings,
|
|
||||||
settings->uints.menu_left_thumbnails,
|
|
||||||
settings->uints.menu_left_thumbnails + 1);
|
|
||||||
|
|
||||||
if (settings->uints.menu_left_thumbnails > 3)
|
if (settings->uints.menu_left_thumbnails > 3)
|
||||||
{
|
|
||||||
configuration_set_uint(settings,
|
|
||||||
settings->uints.menu_left_thumbnails, 1);
|
|
||||||
}
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* RGUI is a special case where thumbnail 'switch' corresponds to
|
|
||||||
* toggling thumbnail view on/off.
|
|
||||||
* GLUI is a special case where thumbnail 'switch' corresponds to
|
|
||||||
* changing thumbnail view mode.
|
|
||||||
* For other menu drivers, we cycle through available thumbnail
|
|
||||||
* types. */
|
|
||||||
if (special_case)
|
|
||||||
{
|
|
||||||
configuration_set_uint(settings,
|
configuration_set_uint(settings,
|
||||||
settings->uints.menu_left_thumbnails,
|
settings->uints.menu_left_thumbnails, 1);
|
||||||
settings->uints.menu_left_thumbnails + 1);
|
|
||||||
|
|
||||||
if (settings->uints.gfx_thumbnails > 3)
|
|
||||||
{
|
|
||||||
configuration_set_uint(settings,
|
|
||||||
settings->uints.gfx_thumbnails, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
||||||
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
configuration_set_uint(settings,
|
||||||
|
settings->uints.gfx_thumbnails,
|
||||||
|
settings->uints.gfx_thumbnails + 1);
|
||||||
|
|
||||||
|
if (settings->uints.gfx_thumbnails > 3)
|
||||||
|
configuration_set_uint(settings,
|
||||||
|
settings->uints.gfx_thumbnails, 1);
|
||||||
|
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_PATH, NULL);
|
||||||
|
menu_driver_ctl(RARCH_MENU_CTL_UPDATE_THUMBNAIL_IMAGE, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4698,7 +4698,7 @@ static void rgui_scan_selected_entry_thumbnail(rgui_t *rgui, bool force_load)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rgui_update_thumbnail_image(void *userdata)
|
static void rgui_toggle_fs_thumbnail(void *userdata)
|
||||||
{
|
{
|
||||||
rgui_t *rgui = (rgui_t*)userdata;
|
rgui_t *rgui = (rgui_t*)userdata;
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
@ -4961,6 +4961,11 @@ static int rgui_environ(enum menu_environ_cb type,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Forward declaration */
|
||||||
|
static int rgui_menu_entry_action(
|
||||||
|
void *userdata, menu_entry_t *entry,
|
||||||
|
size_t i, enum menu_action action);
|
||||||
|
|
||||||
static int rgui_pointer_up(void *data,
|
static int rgui_pointer_up(void *data,
|
||||||
unsigned x, unsigned y, unsigned ptr,
|
unsigned x, unsigned y, unsigned ptr,
|
||||||
enum menu_input_pointer_gesture gesture,
|
enum menu_input_pointer_gesture gesture,
|
||||||
@ -4993,20 +4998,20 @@ static int rgui_pointer_up(void *data,
|
|||||||
* - A normal mouse press should just select the current
|
* - A normal mouse press should just select the current
|
||||||
* entry (for which the thumbnail is being shown) */
|
* entry (for which the thumbnail is being shown) */
|
||||||
if (y < header_height)
|
if (y < header_height)
|
||||||
rgui_update_thumbnail_image(rgui);
|
rgui_toggle_fs_thumbnail(rgui);
|
||||||
else
|
else
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
return rgui_menu_entry_action(rgui, entry, selection, MENU_ACTION_SELECT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (y < header_height)
|
if (y < header_height)
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_CANCEL);
|
return rgui_menu_entry_action(rgui, entry, selection, MENU_ACTION_CANCEL);
|
||||||
else if (ptr <= (menu_entries_get_size() - 1))
|
else if (ptr <= (menu_entries_get_size() - 1))
|
||||||
{
|
{
|
||||||
/* If currently selected item matches 'pointer' value,
|
/* If currently selected item matches 'pointer' value,
|
||||||
* perform a MENU_ACTION_SELECT on it */
|
* perform a MENU_ACTION_SELECT on it */
|
||||||
if (ptr == selection)
|
if (ptr == selection)
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_SELECT);
|
return rgui_menu_entry_action(rgui, entry, selection, MENU_ACTION_SELECT);
|
||||||
|
|
||||||
/* Otherwise, just move the current selection to the
|
/* Otherwise, just move the current selection to the
|
||||||
* 'pointer' value */
|
* 'pointer' value */
|
||||||
@ -5020,7 +5025,7 @@ static int rgui_pointer_up(void *data,
|
|||||||
/* 'Reset to default' action */
|
/* 'Reset to default' action */
|
||||||
if ((ptr <= (menu_entries_get_size() - 1)) &&
|
if ((ptr <= (menu_entries_get_size() - 1)) &&
|
||||||
(ptr == selection))
|
(ptr == selection))
|
||||||
return menu_entry_action(entry, selection, MENU_ACTION_START);
|
return rgui_menu_entry_action(rgui, entry, selection, MENU_ACTION_START);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Ignore input */
|
/* Ignore input */
|
||||||
@ -5265,6 +5270,43 @@ static void rgui_context_destroy(void *data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static enum menu_action rgui_parse_menu_entry_action(
|
||||||
|
rgui_t *rgui, enum menu_action action)
|
||||||
|
{
|
||||||
|
enum menu_action new_action = action;
|
||||||
|
|
||||||
|
/* Scan user inputs */
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case MENU_ACTION_SCAN:
|
||||||
|
/* 'Scan' command is used to toggle
|
||||||
|
* fullscreen thumbnail view */
|
||||||
|
rgui_toggle_fs_thumbnail(rgui);
|
||||||
|
new_action = MENU_ACTION_NOOP;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* In all other cases, pass through input
|
||||||
|
* menu action without intervention */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new_action;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Menu entry action callback */
|
||||||
|
static int rgui_menu_entry_action(
|
||||||
|
void *userdata, menu_entry_t *entry,
|
||||||
|
size_t i, enum menu_action action)
|
||||||
|
{
|
||||||
|
rgui_t *rgui = (rgui_t*)userdata;
|
||||||
|
|
||||||
|
/* Process input action */
|
||||||
|
enum menu_action new_action = rgui_parse_menu_entry_action(rgui, action);
|
||||||
|
|
||||||
|
/* Call standard generic_menu_entry_action() function */
|
||||||
|
return generic_menu_entry_action(userdata, entry, i, new_action);
|
||||||
|
}
|
||||||
|
|
||||||
menu_ctx_driver_t menu_ctx_rgui = {
|
menu_ctx_driver_t menu_ctx_rgui = {
|
||||||
rgui_set_texture,
|
rgui_set_texture,
|
||||||
rgui_set_message,
|
rgui_set_message,
|
||||||
@ -5305,7 +5347,7 @@ menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
"rgui",
|
"rgui",
|
||||||
rgui_environ,
|
rgui_environ,
|
||||||
NULL, /* update_thumbnail_path */
|
NULL, /* update_thumbnail_path */
|
||||||
rgui_update_thumbnail_image,
|
NULL, /* update_thumbnail_image */
|
||||||
rgui_refresh_thumbnail_image,
|
rgui_refresh_thumbnail_image,
|
||||||
rgui_set_thumbnail_system,
|
rgui_set_thumbnail_system,
|
||||||
rgui_get_thumbnail_system,
|
rgui_get_thumbnail_system,
|
||||||
@ -5316,5 +5358,5 @@ menu_ctx_driver_t menu_ctx_rgui = {
|
|||||||
NULL, /* pointer_down */
|
NULL, /* pointer_down */
|
||||||
rgui_pointer_up,
|
rgui_pointer_up,
|
||||||
NULL, /* get_load_content_animation_data */
|
NULL, /* get_load_content_animation_data */
|
||||||
generic_menu_entry_action
|
rgui_menu_entry_action
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user