entry(key, value);
}
+/*
+ * We generally use Openbox defaults, but if no theme file can be found it's
+ * better to populate the theme variables with some sane values as no-one
+ * wants to use openbox without a theme - it'll all just be black and white.
+ *
+ * Openbox doesn't actual start if it can't find a theme. As it's normally
+ * packaged with Clearlooks, this is not a problem, but for labwc I thought
+ * this was a bit hard-line. People might want to try labwc without having
+ * Openbox (and associated themes) installed.
+ */
+void theme_builtin(void)
+{
+ parse_hexstr("#589bda", theme.window_active_title_bg_color);
+ parse_hexstr("#3c7cb7", theme.window_active_handle_bg_color);
+ parse_hexstr("#efece6", theme.window_inactive_title_bg_color);
+ parse_hexstr("#ffffff", theme.window_active_button_unpressed_image_color);
+}
+
void theme_read(const char *theme_name)
{
FILE *stream;
info("reading themerc (%s)", themerc);
stream = fopen(themerc, "r");
if (!stream) {
- warn("cannot read (%s)", themerc);
+ warn("cannot read (%s) - load built-in theme", themerc);
+ theme_builtin();
return;
}
while (getline(&line, &len, stream) != -1) {
*texture = texture_from_builtin(renderer, button);
}
+/* clang-format off */
void xbm_load(struct wlr_renderer *r)
{
parse_set_color(theme.window_active_button_unpressed_image_color);
load_button(r, "max.xbm", &theme.xbm_maximize, max_button_normal);
load_button(r, "iconify.xbm", &theme.xbm_iconify, iconify_button_normal);
}
+/* clang-format on */