Settings cleanups

This commit is contained in:
twinaphex 2020-03-06 02:52:21 +01:00
parent 70d0c1ce6f
commit bd5f151077
4 changed files with 57 additions and 44 deletions

View File

@ -767,19 +767,21 @@ static void gl_core_set_viewport(gl_core_t *gl,
bool force_full, bool allow_rotate)
{
gfx_ctx_aspect_t aspect_data;
unsigned height = gl->video_height;
int x = 0;
int y = 0;
settings_t *settings = config_get_ptr();
float device_aspect = (float)viewport_width / viewport_height;
unsigned height = gl->video_height;
int x = 0;
int y = 0;
settings_t *settings = config_get_ptr();
float device_aspect = (float)viewport_width / viewport_height;
bool video_scale_integer = settings->bools.video_scale_integer;
unsigned video_aspect_ratio_idx = settings->uints.video_aspect_ratio_idx;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
aspect_data.aspect = &device_aspect;
aspect_data.width = viewport_width;
aspect_data.height = viewport_height;
video_context_driver_translate_aspect(&aspect_data);
if (settings->bools.video_scale_integer && !force_full)
if (video_scale_integer && !force_full)
{
video_viewport_get_scaled_integer(&gl->vp,
viewport_width, viewport_height,
@ -792,7 +794,7 @@ static void gl_core_set_viewport(gl_core_t *gl,
float desired_aspect = video_driver_get_aspect_ratio();
#if defined(HAVE_MENU)
if (settings->uints.video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
if (video_aspect_ratio_idx == ASPECT_RATIO_CUSTOM)
{
const struct video_viewport *custom = video_viewport_get_custom();
/* GL has bottom-left origin viewport. */

View File

@ -269,16 +269,17 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
XEvent event;
EGLint egl_attribs[16];
EGLint vid, num_visuals;
EGLint *attr = NULL;
bool true_full = false;
int x_off = 0;
int y_off = 0;
XVisualInfo temp = {0};
XSetWindowAttributes swa = {0};
XVisualInfo *vi = NULL;
char *wm_name = NULL;
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
settings_t *settings = config_get_ptr();
EGLint *attr = NULL;
bool true_full = false;
int x_off = 0;
int y_off = 0;
XVisualInfo temp = {0};
XSetWindowAttributes swa = {0};
XVisualInfo *vi = NULL;
char *wm_name = NULL;
xegl_ctx_data_t *xegl = (xegl_ctx_data_t*)data;
settings_t *settings = config_get_ptr();
bool video_disable_composition = settings ? settings->bools.video_disable_composition : false;
int (*old_handler)(Display*, XErrorEvent*) = NULL;
@ -364,7 +365,7 @@ static bool gfx_ctx_xegl_set_video_mode(void *data,
&swa);
XSetWindowBackground(g_x11_dpy, g_x11_win, 0);
if (fullscreen && settings && settings->bools.video_disable_composition)
if (fullscreen && video_disable_composition)
{
uint32_t value = 1;
Atom cardinal = XInternAtom(g_x11_dpy, "CARDINAL", False);

View File

@ -131,14 +131,14 @@ static void ozone_menu_animation_update_time(
static void *ozone_init(void **userdata, bool video_is_threaded)
{
char xmb_path[PATH_MAX_LENGTH];
char monochrome_path[PATH_MAX_LENGTH];
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));
char xmb_path[PATH_MAX_LENGTH];
char monochrome_path[PATH_MAX_LENGTH];
const char *directory_assets = settings->paths.directory_assets;
if (!menu)
return NULL;
@ -239,8 +239,10 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
setsysGetColorSetId(&theme);
color_theme = (theme == ColorSetId_Dark) ? 1 : 0;
ozone_set_color_theme(ozone, color_theme);
settings->uints.menu_ozone_color_theme = color_theme;
settings->bools.menu_preferred_system_color_theme_set = true;
configuration_set_uint(settings,
settings->uints.menu_ozone_color_theme, color_theme);
configuration_set_bool(settings,
settings->bools.menu_preferred_system_color_theme_set, true);
setsysExit();
}
else
@ -268,7 +270,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
/* Assets path */
fill_pathname_join(
ozone->assets_path,
settings->paths.directory_assets,
directory_assets,
"ozone",
sizeof(ozone->assets_path)
);
@ -292,7 +294,7 @@ static void *ozone_init(void **userdata, bool video_is_threaded)
/* XMB monochrome */
fill_pathname_join(
xmb_path,
settings->paths.directory_assets,
directory_assets,
"xmb",
sizeof(xmb_path)
);
@ -394,10 +396,12 @@ unsigned ozone_count_lines(const char *str)
static void ozone_update_thumbnail_image(void *data)
{
ozone_handle_t *ozone = (ozone_handle_t*)data;
size_t selection = menu_navigation_get_selection();
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
ozone_handle_t *ozone = (ozone_handle_t*)data;
size_t selection = menu_navigation_get_selection();
settings_t *settings = config_get_ptr();
playlist_t *playlist = playlist_get_cached();
unsigned gfx_thumbnail_upscale_threshold = settings->uints.gfx_thumbnail_upscale_threshold;
bool network_on_demand_thumbnails = settings->bools.network_on_demand_thumbnails;
if (!ozone)
return;
@ -415,8 +419,8 @@ static void ozone_update_thumbnail_image(void *data)
playlist,
selection,
&ozone->thumbnails.right,
settings->uints.gfx_thumbnail_upscale_threshold,
settings->bools. network_on_demand_thumbnails
gfx_thumbnail_upscale_threshold,
network_on_demand_thumbnails
);
/* Left thumbnail is simply reset */
@ -431,8 +435,8 @@ static void ozone_update_thumbnail_image(void *data)
playlist,
selection,
&ozone->thumbnails.right,
settings->uints.gfx_thumbnail_upscale_threshold,
settings->bools. network_on_demand_thumbnails);
gfx_thumbnail_upscale_threshold,
network_on_demand_thumbnails);
/* Left thumbnail */
gfx_thumbnail_request(
@ -441,8 +445,8 @@ static void ozone_update_thumbnail_image(void *data)
playlist,
selection,
&ozone->thumbnails.left,
settings->uints.gfx_thumbnail_upscale_threshold,
settings->bools. network_on_demand_thumbnails);
gfx_thumbnail_upscale_threshold,
network_on_demand_thumbnails);
}
}
@ -867,7 +871,9 @@ static int ozone_list_push(void *data, void *userdata,
{
case DISPLAYLIST_LOAD_CONTENT_LIST:
{
settings_t *settings = config_get_ptr();
settings_t *settings = config_get_ptr();
bool menu_content_show_playlists = settings->bools.menu_content_show_playlists;
bool kiosk_mode_enable = settings->bools.kiosk_mode_enable;
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list);
@ -887,7 +893,7 @@ static int ozone_list_push(void *data, void *userdata,
MENU_SETTING_ACTION, 0, 0);
}
if (settings->bools.menu_content_show_playlists)
if (menu_content_show_playlists)
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLISTS_TAB),
msg_hash_to_str(MENU_ENUM_LABEL_PLAYLISTS_TAB),
@ -900,7 +906,7 @@ static int ozone_list_push(void *data, void *userdata,
MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR,
MENU_SETTING_ACTION, 0, 0);
if (!settings->bools.kiosk_mode_enable)
if (!kiosk_mode_enable)
{
menu_entries_append_enum(info->list,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MENU_FILE_BROWSER_SETTINGS),
@ -2046,7 +2052,8 @@ static void ozone_frame(void *data, video_frame_info_t *video_info)
if (use_preferred_system_color_theme)
{
color_theme = ozone_get_system_theme();
settings->uints.menu_ozone_color_theme = color_theme;
configuration_set_uint(settings,
settings->uints.menu_ozone_color_theme, color_theme);
}
ozone_set_color_theme(ozone, color_theme);

View File

@ -204,13 +204,16 @@ int menu_dialog_iterate(char *s, size_t len,
case MENU_DIALOG_HELP_EXTRACT:
{
settings_t *settings = config_get_ptr();
bool bundle_finished = settings->bools.bundle_finished;
menu_hash_get_help_enum(
MENU_ENUM_LABEL_VALUE_EXTRACTING_PLEASE_WAIT,
s, len);
if (settings->bools.bundle_finished)
if (bundle_finished)
{
settings->bools.bundle_finished = false;
configuration_set_bool(settings,
settings->bools.bundle_finished, false);
menu_dialog_current_type = MENU_DIALOG_NONE;
return 1;
}