aboutsummaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorokan2009-05-17 23:40:57 +0000
committerokan2009-05-17 23:40:57 +0000
commita83ec02263f57eac22f091d37c7e678aed7b8d38 (patch)
tree4b34676783c097eb00c55658b30e6c56c0fc8267 /conf.c
parent915104a67e5e6fc2c55c6a44b9360c290ea2e61d (diff)
downloadcwm-a83ec02263f57eac22f091d37c7e678aed7b8d38.tar.gz
a long time coming - re-work the way we deal with colors: since we're
using Xft(3), use it to select the font color as well instead of trying to build one; properly allocate and free colors at-will, e.g. we now have configurable colors. feedback and ok's todd@ and oga@
Diffstat (limited to '')
-rw-r--r--conf.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/conf.c b/conf.c
index 6898515..4c17b06 100644
--- a/conf.c
+++ b/conf.c
@@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
- * $Id: conf.c,v 1.60 2009/05/17 17:04:59 sthen Exp $
+ * $Id: conf.c,v 1.61 2009/05/17 23:40:57 okan Exp $
*/
#include "headers.h"
@@ -62,6 +62,21 @@ conf_font(struct conf *c)
}
void
+conf_color(struct conf *c)
+{
+ struct screen_ctx *sc;
+ int i;
+
+ sc = screen_current();
+
+
+ for (i = 0; i < CWM_COLOR_MAX; i++) {
+ xu_freecolor(sc, sc->color[i].pixel);
+ sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
+ }
+}
+
+void
conf_reload(struct conf *c)
{
if (parse_config(c->conf_path, c) == -1) {
@@ -69,6 +84,7 @@ conf_reload(struct conf *c)
return;
}
+ conf_color(c);
conf_font(c);
}
@@ -157,6 +173,19 @@ conf_init(struct conf *c)
strlcpy(c->termpath, "xterm", sizeof(c->termpath));
strlcpy(c->lockpath, "xlock", sizeof(c->lockpath));
+ c->color[CWM_COLOR_BORDOR_ACTIVE].name =
+ xstrdup(CONF_COLOR_ACTIVEBORDER);
+ c->color[CWM_COLOR_BORDER_INACTIVE].name =
+ xstrdup(CONF_COLOR_INACTIVEBORDER);
+ c->color[CWM_COLOR_BORDER_GROUP].name =
+ xstrdup(CONF_COLOR_GROUPBORDER);
+ c->color[CWM_COLOR_BORDER_UNGROUP].name =
+ xstrdup(CONF_COLOR_UNGROUPBORDER);
+ c->color[CWM_COLOR_FG_MENU].name =
+ xstrdup(CONF_COLOR_MENUFG);
+ c->color[CWM_COLOR_BG_MENU].name =
+ xstrdup(CONF_COLOR_MENUBG);
+
c->DefaultFontName = xstrdup(DEFAULTFONTNAME);
}
@@ -168,6 +197,7 @@ conf_clear(struct conf *c)
struct winmatch *wm;
struct cmd *cmd;
struct mousebinding *mb;
+ int i;
while ((cmd = TAILQ_FIRST(&c->cmdq)) != NULL) {
TAILQ_REMOVE(&c->cmdq, cmd, entry);
@@ -198,6 +228,9 @@ conf_clear(struct conf *c)
xfree(mb);
}
+ for (i = 0; i < CWM_COLOR_MAX; i++)
+ xfree(c->color[i].name);
+
xfree(c->DefaultFontName);
}