mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
(Ozone) Add 'Use System Preferred Color Theme' (enabled for Switch)
This commit is contained in:
parent
624698d2d9
commit
689e612af8
@ -266,6 +266,12 @@ static const float default_input_overlay_opacity = 0.7f;
|
||||
|
||||
static bool default_block_config_read = true;
|
||||
|
||||
#ifdef HAVE_LIBNX
|
||||
static bool menu_use_preferred_system_color_theme = true;
|
||||
#else
|
||||
static bool menu_use_preferred_system_color_theme = false;
|
||||
#endif
|
||||
|
||||
static bool quick_menu_show_take_screenshot = true;
|
||||
static bool quick_menu_show_save_load_state = true;
|
||||
static bool quick_menu_show_undo_save_load_state = true;
|
||||
|
@ -1387,6 +1387,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
|
||||
SETTING_BOOL("quick_menu_show_save_content_dir_overrides", &settings->bools.quick_menu_show_save_content_dir_overrides, true, quick_menu_show_save_content_dir_overrides, false);
|
||||
SETTING_BOOL("quick_menu_show_information", &settings->bools.quick_menu_show_information, true, quick_menu_show_information, false);
|
||||
SETTING_BOOL("kiosk_mode_enable", &settings->bools.kiosk_mode_enable, true, kiosk_mode_enable, false);
|
||||
SETTING_BOOL("menu_use_preferred_system_color_theme", &settings->bools.menu_use_preferred_system_color_theme, true, menu_use_preferred_system_color_theme, false);
|
||||
SETTING_BOOL("content_show_settings", &settings->bools.menu_content_show_settings, true, content_show_settings, false);
|
||||
SETTING_BOOL("content_show_favorites", &settings->bools.menu_content_show_favorites, true, content_show_favorites, false);
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
|
@ -175,6 +175,8 @@ typedef struct settings
|
||||
bool menu_content_show_history;
|
||||
bool menu_content_show_add;
|
||||
bool menu_content_show_playlists;
|
||||
bool menu_use_preferred_system_color_theme;
|
||||
bool menu_preferred_system_color_theme_set;
|
||||
bool menu_unified_controls;
|
||||
bool quick_menu_show_take_screenshot;
|
||||
bool quick_menu_show_save_load_state;
|
||||
|
@ -3692,3 +3692,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -4711,3 +4711,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3468,3 +3468,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3604,3 +3604,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -7695,3 +7695,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3343,3 +3343,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -7633,3 +7633,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3502,3 +3502,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3562,3 +3562,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -4011,3 +4011,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3463,3 +3463,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -1725,3 +1725,5 @@ MSG_HASH(MENU_ENUM_LABEL_STREAMING_TITLE,
|
||||
"streaming_title")
|
||||
MSG_HASH(MENU_ENUM_LABEL_RESET_TO_DEFAULT_CONFIG,
|
||||
"reset_to_default_config")
|
||||
MSG_HASH(MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"menu_use_preferred_system_color_theme")
|
||||
|
@ -3349,3 +3349,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3765,3 +3765,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -7727,3 +7727,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3429,3 +3429,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3632,3 +3632,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -7727,3 +7727,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -3502,3 +3502,7 @@ MSG_HASH(
|
||||
MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME,
|
||||
"Select a different color theme."
|
||||
)
|
||||
MSG_HASH(MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use preferred system color theme")
|
||||
MSG_HASH(MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
"Use your operating system's default color theme (if one is set).")
|
||||
|
@ -375,6 +375,7 @@ default_sublabel_macro(action_bind_sublabel_xmb_shadows_enable,
|
||||
default_sublabel_macro(action_bind_sublabel_xmb_vertical_thumbnails, MENU_ENUM_SUBLABEL_XMB_VERTICAL_THUMBNAILS)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_color_theme, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME)
|
||||
default_sublabel_macro(action_bind_sublabel_ozone_menu_color_theme, MENU_ENUM_SUBLABEL_OZONE_MENU_COLOR_THEME)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_use_preferred_system_color_theme, MENU_ENUM_SUBLABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_wallpaper_opacity, MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_framebuffer_opacity, MENU_ENUM_SUBLABEL_MENU_FRAMEBUFFER_OPACITY)
|
||||
default_sublabel_macro(action_bind_sublabel_menu_ribbon_enable, MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE)
|
||||
@ -1076,6 +1077,9 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs,
|
||||
case MENU_ENUM_LABEL_MENU_WALLPAPER_OPACITY:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_wallpaper_opacity);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_use_preferred_system_color_theme);
|
||||
break;
|
||||
case MENU_ENUM_LABEL_OZONE_MENU_COLOR_THEME:
|
||||
BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_ozone_menu_color_theme);
|
||||
break;
|
||||
|
@ -1135,17 +1135,14 @@ static void ozone_set_color_theme(ozone_handle_t *ozone, unsigned color_theme)
|
||||
|
||||
static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
{
|
||||
#ifdef HAVE_LIBNX
|
||||
Result rc;
|
||||
ColorSetId theme;
|
||||
#endif
|
||||
bool fallback_color_theme = false;
|
||||
unsigned width, height, color_theme = 0;
|
||||
ozone_handle_t *ozone = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
menu_handle_t *menu = (menu_handle_t*)calloc(1, sizeof(*menu));
|
||||
|
||||
if (!menu)
|
||||
goto error;
|
||||
return false;
|
||||
|
||||
if (!menu_display_init_first_driver(video_is_threaded))
|
||||
goto error;
|
||||
@ -1196,18 +1193,26 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
|
||||
menu_display_allocate_white_texture();
|
||||
|
||||
/* Theme */
|
||||
/* TODO Add theme override in settings */
|
||||
#ifdef HAVE_LIBNX
|
||||
rc = setsysInitialize();
|
||||
if (R_SUCCEEDED(rc))
|
||||
if (settings->bools.menu_use_preferred_system_color_theme)
|
||||
{
|
||||
color_theme = (theme == ColorSetId_Dark) ? 1 : 0;
|
||||
setsysGetColorSetId(&theme);
|
||||
ozone_set_color_theme(ozone, color_theme);
|
||||
setsysExit();
|
||||
#ifdef HAVE_LIBNX
|
||||
if (R_SUCCEEDED(setsysInitialize()))
|
||||
{
|
||||
ColorSetId theme;
|
||||
setsysGetColorSetId(&theme);
|
||||
color_theme = (theme == ColorSetId_Dark) ? 1 : 0;
|
||||
ozone_set_color_theme(ozone, color_theme);
|
||||
settings->bools.menu_preferred_system_color_theme_set = true;
|
||||
setsysExit();
|
||||
}
|
||||
else
|
||||
fallback_color_theme = true;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
#endif
|
||||
fallback_color_theme = true;
|
||||
|
||||
if (fallback_color_theme)
|
||||
{
|
||||
color_theme = settings->uints.menu_ozone_color_theme;
|
||||
ozone_set_color_theme(ozone, color_theme);
|
||||
|
@ -5988,6 +5988,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, menu_displaylist
|
||||
MENU_ENUM_LABEL_MATERIALUI_MENU_FOOTER_OPACITY,
|
||||
PARSE_ONLY_FLOAT, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
PARSE_ONLY_BOOL, false) == 0)
|
||||
count++;
|
||||
if (menu_displaylist_parse_settings_enum(menu, info,
|
||||
MENU_ENUM_LABEL_THUMBNAILS,
|
||||
PARSE_ONLY_UINT, false) == 0)
|
||||
|
@ -776,9 +776,13 @@ static void setting_get_string_representation_uint_ozone_menu_color_theme(
|
||||
rarch_setting_t *setting,
|
||||
char *s, size_t len)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
if (!setting)
|
||||
return;
|
||||
|
||||
if (settings->bools.menu_preferred_system_color_theme_set)
|
||||
strlcpy(s, "System default", len);
|
||||
|
||||
switch (*setting->value.target.unsigned_integer)
|
||||
{
|
||||
case 1:
|
||||
@ -7916,6 +7920,24 @@ static bool setting_append_list(
|
||||
menu_settings_list_current_add_range(list, list_info, 0, XMB_THEME_LAST-1, 1, true, true);
|
||||
}
|
||||
#endif
|
||||
if (string_is_equal(settings->arrays.menu_driver, "ozone"))
|
||||
{
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.menu_use_preferred_system_color_theme,
|
||||
MENU_ENUM_LABEL_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
MENU_ENUM_LABEL_VALUE_MENU_USE_PREFERRED_SYSTEM_COLOR_THEME,
|
||||
menu_show_load_core,
|
||||
MENU_ENUM_LABEL_VALUE_OFF,
|
||||
MENU_ENUM_LABEL_VALUE_ON,
|
||||
&group_info,
|
||||
&subgroup_info,
|
||||
parent_group,
|
||||
general_write_handler,
|
||||
general_read_handler,
|
||||
SD_FLAG_NONE);
|
||||
}
|
||||
|
||||
CONFIG_BOOL(
|
||||
list, list_info,
|
||||
&settings->bools.menu_show_load_core,
|
||||
|
@ -460,6 +460,7 @@ enum msg_hash_enums
|
||||
|
||||
MENU_LABEL(MENU_WALLPAPER_OPACITY),
|
||||
MENU_LABEL(MENU_FRAMEBUFFER_OPACITY),
|
||||
MENU_LABEL(MENU_USE_PREFERRED_SYSTEM_COLOR_THEME),
|
||||
|
||||
MENU_ENUM_LABEL_VALUE_CONFIG,
|
||||
MENU_ENUM_LABEL_VALUE_OVERLAY,
|
||||
|
Loading…
x
Reference in New Issue
Block a user