all repos — openbox @ 137a0c4e596409a1d35f0f6ea1bd6e4fcd5a3831

openbox fork - make it a bit more like ryudo

allow style options in the rc file to override those found in the style
Dana Jansens danakj@orodu.net
commit

137a0c4e596409a1d35f0f6ea1bd6e4fcd5a3831

parent

32c13697524e01a21e5b667188cad73434693ecb

3 files changed, 18 insertions(+), 22 deletions(-)

jump to
M src/Configuration.ccsrc/Configuration.cc

@@ -35,21 +35,21 @@ using std::string;

bool Configuration::m_initialized = False; -Configuration::Configuration(const string &file) { +Configuration::Configuration(const string &file, bool autosave) { setFile(file); m_modified = False; m_database = NULL; - m_autosave = True; + m_autosave = autosave; if (! m_initialized) { XrmInitialize(); m_initialized = True; } } -Configuration::Configuration() { +Configuration::Configuration(bool autosave) { m_modified = False; m_database = NULL; - m_autosave = True; + m_autosave = autosave; if (! m_initialized) { XrmInitialize(); m_initialized = True;

@@ -81,6 +81,15 @@ XrmDestroyDatabase(m_database);

m_modified = False; if (NULL == (m_database = XrmGetFileDatabase(m_file.c_str()))) return False; + return True; +} + +bool Configuration::merge(const string &file, bool overwrite) { + if (XrmCombineFileDatabase(file.c_str(), &m_database, overwrite) == 0) + return False; + m_modified = True; + if (m_autosave) + save(); return True; }
M src/Configuration.hhsrc/Configuration.hh

@@ -37,8 +37,8 @@ * file.

*/ class Configuration { public: - explicit Configuration(const std::string &file); - Configuration(); + explicit Configuration(const std::string &file, bool autosave = True); + Configuration(bool autosave = True); virtual ~Configuration(); inline const std::string &file() const {

@@ -58,6 +58,7 @@ }

void save(); bool load(); + bool merge(const std::string &file, bool overwrite = False); void create(); void setValue(const std::string &rname, bool value);
M src/Screen.ccsrc/Screen.cc

@@ -739,24 +739,10 @@ style.create(); // hardcoded default values will be used.

} } - string s; - - if (config->getValue("rootCommand", s)) - printf("config.rootCommand: %s\n", s.c_str()); - - if (style.getValue("rootCommand", s)) - printf("style.rootCommand: %s\n", s.c_str()); - // merge in the rc file - style.merge(config, True); + style.merge(config->file(), True); - printf("merged databases\n"); - - if (style.getValue("rootCommand", s)) - printf("style.rootCommand: %s\n", s.c_str()); - - if (style.getValue("session.cacheMax", s)) - printf("session.cacheMax: %s\n", s.c_str()); + string s; // load fonts/fontsets if (resource.wstyle.font)