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 "DolphinNoGUI/Platform.h"
#include "Common/MsgHandler.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/State.h"
@ -48,6 +49,10 @@ private:
#if defined(HAVE_XRANDR) && HAVE_XRANDR
X11Utils::XRRConfiguration* m_xrr_config = nullptr;
#endif
int m_window_x = Config::Get(Config::MAIN_RENDER_WINDOW_XPOS);
int m_window_y = Config::Get(Config::MAIN_RENDER_WINDOW_YPOS);
unsigned int m_window_width = Config::Get(Config::MAIN_RENDER_WINDOW_WIDTH);
unsigned int m_window_height = Config::Get(Config::MAIN_RENDER_WINDOW_HEIGHT);
};
PlatformX11::~PlatformX11()
@ -75,10 +80,8 @@ bool PlatformX11::Init()
return false;
}
m_window = XCreateSimpleWindow(
m_display, DefaultRootWindow(m_display), SConfig::GetInstance().iRenderWindowXPos,
SConfig::GetInstance().iRenderWindowYPos, SConfig::GetInstance().iRenderWindowWidth,
SConfig::GetInstance().iRenderWindowHeight, 0, 0, BlackPixel(m_display, 0));
m_window = XCreateSimpleWindow(m_display, DefaultRootWindow(m_display), m_window_x, m_window_y,
m_window_width, m_window_height, 0, 0, BlackPixel(m_display, 0));
XSelectInput(m_display, m_window, StructureNotifyMask | KeyPressMask | FocusChangeMask);
Atom wmProtocols[1];
wmProtocols[0] = XInternAtom(m_display, "WM_DELETE_WINDOW", True);
@ -98,7 +101,7 @@ bool PlatformX11::Init()
XSync(m_display, True);
ProcessEvents();
if (SConfig::GetInstance().bDisableScreenSaver)
if (Config::Get(Config::MAIN_DISABLE_SCREENSAVER))
X11Utils::InhibitScreensaver(m_window, true);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
@ -118,7 +121,7 @@ bool PlatformX11::Init()
}
// Enter fullscreen if enabled.
if (SConfig::GetInstance().bFullscreen)
if (Config::Get(Config::MAIN_FULLSCREEN))
{
m_window_fullscreen = X11Utils::ToggleFullscreen(m_display, m_window);
#if defined(HAVE_XRANDR) && HAVE_XRANDR
@ -166,11 +169,8 @@ void PlatformX11::UpdateWindowPosition()
Window winDummy;
unsigned int borderDummy, depthDummy;
XGetGeometry(m_display, m_window, &winDummy, &SConfig::GetInstance().iRenderWindowXPos,
&SConfig::GetInstance().iRenderWindowYPos,
reinterpret_cast<unsigned int*>(&SConfig::GetInstance().iRenderWindowWidth),
reinterpret_cast<unsigned int*>(&SConfig::GetInstance().iRenderWindowHeight),
&borderDummy, &depthDummy);
XGetGeometry(m_display, m_window, &winDummy, &m_window_x, &m_window_y, &m_window_width,
&m_window_height, &borderDummy, &depthDummy);
}
void PlatformX11::ProcessEvents()