Config: Move the 'Display' settings from ConfigManager to the layered config system

This commit is contained in:
iwubcode
2019-03-02 22:41:50 -06:00
parent 735a705e4d
commit 840afc2ad4
15 changed files with 83 additions and 100 deletions

View File

@ -7,6 +7,7 @@
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <spawn.h>
#include <string>
#include <sys/wait.h>
@ -14,7 +15,7 @@
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "Core/ConfigManager.h"
#include "Core/Config/MainSettings.h"
#include "Core/Core.h"
extern char** environ;
@ -103,7 +104,8 @@ XRRConfiguration::~XRRConfiguration()
void XRRConfiguration::Update()
{
if (SConfig::GetInstance().strFullscreenResolution == "Auto")
const std::string fullscreen_display_res = Config::Get(Config::MAIN_FULLSCREEN_DISPLAY_RES);
if (fullscreen_display_res == "Auto")
return;
if (!bValid)
@ -125,15 +127,15 @@ void XRRConfiguration::Update()
unsigned int fullWidth, fullHeight;
char* output_name = nullptr;
char auxFlag = '\0';
if (SConfig::GetInstance().strFullscreenResolution.find(':') == std::string::npos)
if (fullscreen_display_res.find(':') == std::string::npos)
{
fullWidth = fb_width;
fullHeight = fb_height;
}
else
{
sscanf(SConfig::GetInstance().strFullscreenResolution.c_str(), "%m[^:]: %ux%u%c", &output_name,
&fullWidth, &fullHeight, &auxFlag);
sscanf(fullscreen_display_res.c_str(), "%m[^:]: %ux%u%c", &output_name, &fullWidth, &fullHeight,
&auxFlag);
}
bool want_interlaced = ('i' == auxFlag);
@ -152,8 +154,9 @@ void XRRConfiguration::Update()
if (!output_name)
{
output_name = strdup(output_info->name);
SConfig::GetInstance().strFullscreenResolution =
StringFromFormat("%s: %ux%u", output_info->name, fullWidth, fullHeight);
Config::SetBaseOrCurrent(
Config::MAIN_FULLSCREEN_DISPLAY_RES,
StringFromFormat("%s: %ux%u", output_info->name, fullWidth, fullHeight));
}
outputInfo = output_info;
crtcInfo = crtc_info;