summaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/openbox/Makefile.am1
-rw-r--r--engines/openbox/openbox.c12
-rw-r--r--engines/openbox/theme.c37
3 files changed, 35 insertions, 15 deletions
diff --git a/engines/openbox/Makefile.am b/engines/openbox/Makefile.am
index 512a754c..1cfa3e5b 100644
--- a/engines/openbox/Makefile.am
+++ b/engines/openbox/Makefile.am
@@ -5,6 +5,7 @@ CPPFLAGS=$(XFT_CFLAGS) $(GLIB_CFLAGS) @CPPFLAGS@ \
-DENGINEDIR=\"$(enginedir)\" \
-DTHEMEDIR=\"$(themedir)\" \
-DDEFAULT_THEME=\"nyz\" \
+-DDEFAULT_FONT=\"Sans-6\" \
-DG_LOG_DOMAIN=\"Openbox-Engine\"
engine_LTLIBRARIES=openbox.la
diff --git a/engines/openbox/openbox.c b/engines/openbox/openbox.c
index 0123f474..f9ac31d4 100644
--- a/engines/openbox/openbox.c
+++ b/engines/openbox/openbox.c
@@ -3,7 +3,7 @@
#include "../../kernel/screen.h"
#include "../../kernel/extensions.h"
#include "../../kernel/dispatch.h"
-#include "../../kernel/themerc.h"
+#include "../../kernel/config.h"
#include "../../kernel/frame.h"
#include "../../render/render.h"
#include "../../render/color.h"
@@ -605,12 +605,18 @@ static void layout_title(ObFrame *self)
const char *lc;
int x;
gboolean n, d, i, l, m ,c;
+ ConfigValue layout;
n = d = i = l = m = c = FALSE;
+ if (!config_get("titlebar.layout", Config_String, &layout)) {
+ layout.string = "NDLIMC";
+ config_set("titlebar.layout", Config_String, layout);
+ }
+
/* figure out whats being shown, and the width of the label */
self->label_width = self->width - (s_bevel + 1) * 2;
- for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) {
+ for (lc = layout.string; *lc != '\0'; ++lc) {
switch (*lc) {
case 'N':
if (!(self->frame.client->decorations & Decor_Icon)) break;
@@ -678,7 +684,7 @@ static void layout_title(ObFrame *self)
}
x = s_bevel + 1;
- for (lc = themerc_titlebar_layout; *lc != '\0'; ++lc) {
+ for (lc = layout.string; *lc != '\0'; ++lc) {
switch (*lc) {
case 'N':
if (!n) break;
diff --git a/engines/openbox/theme.c b/engines/openbox/theme.c
index 915ec9b9..3c7c2697 100644
--- a/engines/openbox/theme.c
+++ b/engines/openbox/theme.c
@@ -1,5 +1,5 @@
#include "openbox.h"
-#include "../../kernel/themerc.h"
+#include "../../kernel/config.h"
#include "../../kernel/openbox.h"
#include <glib.h>
@@ -135,10 +135,14 @@ gboolean read_mask(XrmDatabase db, char *rname, pixmap_mask **value)
int hx, hy; /* ignored */
unsigned int w, h;
unsigned char *b;
+ ConfigValue theme;
if (XrmGetResource(db, rname, rclass, &rettype, &retvalue) &&
retvalue.addr != NULL) {
- button_dir = g_strdup_printf("%s_buttons", themerc_theme);
+ if (!config_get("theme", Config_String, &theme))
+ g_assert_not_reached(); /* where's the default!? its not set? */
+
+ button_dir = g_strdup_printf("%s_buttons", theme.string);
s = g_build_filename(g_get_home_dir(), ".openbox", "themes",
"openbox", button_dir, retvalue.addr, NULL);
@@ -153,8 +157,8 @@ gboolean read_mask(XrmDatabase db, char *rname, pixmap_mask **value)
ret = TRUE;
else {
g_free(s);
- s = g_strdup_printf("%s_buttons/%s", themerc_theme,
- themerc_theme);
+ s = g_strdup_printf("%s_buttons/%s", theme.string,
+ theme.string);
if (XReadBitmapFileData(s, &w, &h, &b, &hx, &hy) ==
BitmapSuccess)
ret = TRUE;
@@ -289,11 +293,12 @@ gboolean load()
XrmDatabase db = NULL;
Justify winjust;
char *winjuststr;
+ ConfigValue theme, shadow, offset, font;
- if (themerc_theme != NULL) {
- db = loaddb(themerc_theme);
+ if (config_get("theme", Config_String, &theme)) {
+ db = loaddb(theme.string);
if (db == NULL) {
- g_warning("Failed to load the theme '%s'", themerc_theme);
+ g_warning("Failed to load the theme '%s'", theme.string);
g_message("Falling back to the default: '%s'", DEFAULT_THEME);
}
}
@@ -304,14 +309,22 @@ gboolean load()
return FALSE;
}
/* change to reflect what was actually loaded */
- g_free(themerc_theme);
- themerc_theme = g_strdup(DEFAULT_THEME);
+ theme.string = DEFAULT_THEME;
+ config_set("theme", Config_String, theme);
}
- /* load the font, not from the theme file tho, its in themerc_font */
+ /* load the font, not from the theme file tho, its in the config */
s_winfont_shadow = 1; /* XXX read from themrc */
- s_winfont_shadow_offset = 1; /* XXX read from themerc */
- s_winfont = font_open(themerc_font);
+ if (!config_get("font.shadow.offset", Config_Integer, &offset) ||
+ offset.integer < 0 || offset.integer >= 10) {
+ s_winfont_shadow_offset = 1; /* default */
+ }
+
+ if (!config_get("font", Config_String, &font)) {
+ font.string = DEFAULT_FONT;
+ config_set("font", Config_String, font);
+ }
+ s_winfont = font_open(font.string);
s_winfont_height = font_height(s_winfont, s_winfont_shadow,
s_winfont_shadow_offset);