all repos — openbox @ 456cf2d5065b6939516194c896ccc6f443c08a8c

openbox fork - make it a bit more like ryudo

real_reconfigure now using obResource instead of teh XrmDatabase calls.
obResource class calls XrmInitialize().
Dana Jansens danakj@orodu.net
commit

456cf2d5065b6939516194c896ccc6f443c08a8c

parent

8d3c97389f23271c7b44a726111c97d34bc2ced2

3 files changed, 14 insertions(+), 13 deletions(-)

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

@@ -35,17 +35,27 @@ #endif // HAVE_STDIO_H

#include <assert.h> +bool obResource::m_initialized = false; + obResource::obResource(const std::string &file) { setFile(file); m_modified = false; m_database = NULL; m_autosave = true; + if (!m_initialized) { + XrmInitialize(); + m_initialized = true; + } } obResource::obResource() { m_modified = false; m_database = NULL; m_autosave = true; + if (!m_initialized) { + XrmInitialize(); + m_initialized = true; + } } obResource::~obResource() {
M src/Resource.hsrc/Resource.h

@@ -65,6 +65,7 @@ bool getValue(const std::string &rname, const std::string &rclass,

std::string &value) const; private: + static bool m_initialized; std::string m_file; bool m_modified; bool m_autosave;
M src/openbox.ccsrc/openbox.cc

@@ -197,7 +197,6 @@ groupSearchList = new LinkedList<WindowSearch>;

menuTimestamps = new LinkedList<MenuTimestamp>; - XrmInitialize(); load_rc(); #ifdef HAVE_GETPID

@@ -1491,18 +1490,9 @@

void Openbox::real_reconfigure(void) { grab(); - XrmDatabase new_openboxrc = (XrmDatabase) 0; - char style[MAXPATHLEN + 64]; - - sprintf(style, "session.styleFile: %s", resource.style_file); - XrmPutLineResource(&new_openboxrc, style); - - XrmDatabase old_openboxrc = XrmGetFileDatabase(rc_file); - - XrmMergeDatabases(new_openboxrc, &old_openboxrc); - XrmPutFileDatabase(old_openboxrc, rc_file); - if (old_openboxrc) XrmDestroyDatabase(old_openboxrc); - + config.load(); + config.setValue("session.styleFile", resource.style_file); // autosave's + for (int i = 0, n = menuTimestamps->count(); i < n; i++) { MenuTimestamp *ts = menuTimestamps->remove(0);