diff options
Diffstat (limited to '')
-rw-r--r-- | calmwm.c | 3 | ||||
-rw-r--r-- | calmwm.h | 5 | ||||
-rw-r--r-- | conf.c | 4 | ||||
-rw-r--r-- | cwmrc.5 | 5 | ||||
-rw-r--r-- | font.c | 11 | ||||
-rw-r--r-- | parse.y | 9 |
6 files changed, 26 insertions, 11 deletions
@@ -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. * - * $OpenBSD: calmwm.c,v 1.58 2011/07/25 15:10:24 okan Exp $ + * $OpenBSD: calmwm.c,v 1.59 2011/09/08 12:35:33 okan Exp $ */ #include <sys/param.h> @@ -169,7 +169,6 @@ x_setupscreen(struct screen_ctx *sc, u_int which) conf_color(&Conf, sc); group_init(sc); - font_init(sc); conf_font(&Conf, sc); TAILQ_INIT(&sc->mruq); @@ -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. * - * $OpenBSD: calmwm.h,v 1.140 2011/09/04 16:59:31 oga Exp $ + * $OpenBSD: calmwm.h,v 1.141 2011/09/08 12:35:33 okan Exp $ */ #ifndef _CALMWM_H_ @@ -86,6 +86,7 @@ enum cwmcolor { CWM_COLOR_BORDER_UNGROUP, CWM_COLOR_FG_MENU, CWM_COLOR_BG_MENU, + CWM_COLOR_FONT, CWM_COLOR_MAX }; @@ -435,7 +436,7 @@ int font_descent(struct screen_ctx *); void font_draw(struct screen_ctx *, const char *, int, Drawable, int, int); u_int font_height(struct screen_ctx *); -void font_init(struct screen_ctx *); +void font_init(struct screen_ctx *, const char *); int font_width(struct screen_ctx *, const char *, int); XftFont *font_make(struct screen_ctx *, const char *); @@ -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. * - * $OpenBSD: conf.c,v 1.95 2011/09/08 12:00:49 okan Exp $ + * $OpenBSD: conf.c,v 1.96 2011/09/08 12:35:33 okan Exp $ */ #include <sys/param.h> @@ -62,6 +62,7 @@ conf_gap(struct conf *c, struct screen_ctx *sc) void conf_font(struct conf *c, struct screen_ctx *sc) { + font_init(sc, c->color[CWM_COLOR_FONT].name); sc->font = font_make(sc, c->font); } @@ -72,6 +73,7 @@ static struct color color_binds[] = { { "red", 0 }, /* CWM_COLOR_BORDOR_UNGROUP */ { "black", 0 }, /* CWM_COLOR_FG_MENU */ { "white", 0 }, /* CWM_COLOR_BG_MENU */ + { "black", 0 }, /* CWM_COLOR_FONT */ }; void @@ -1,4 +1,4 @@ -.\" $OpenBSD: cwmrc.5,v 1.40 2011/09/08 12:07:03 okan Exp $ +.\" $OpenBSD: cwmrc.5,v 1.41 2011/09/08 12:35:33 okan Exp $ .\" .\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org> .\" @@ -99,6 +99,9 @@ Set the window border width to .It Ic color activeborder Ar color Set the color of the active border. .Pp +.It Ic color font Ar color +Set menu font color. +.Pp .It Ic color groupborder Ar color Set the color of the border while grouping a window. .Pp @@ -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. * - * $OpenBSD: font.c,v 1.16 2011/06/27 12:46:54 okan Exp $ + * $OpenBSD: font.c,v 1.17 2011/09/08 12:35:33 okan Exp $ */ #include <sys/param.h> @@ -49,15 +49,20 @@ font_height(struct screen_ctx *sc) } void -font_init(struct screen_ctx *sc) +font_init(struct screen_ctx *sc, const char *color) { + if (sc->xftdraw) + XftDrawDestroy(sc->xftdraw); sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin, DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which)); if (sc->xftdraw == NULL) errx(1, "XftDrawCreate"); + if (sc->xftcolor.pixel) + XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which), + DefaultColormap(X_Dpy, sc->which), &sc->xftcolor); if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which), - DefaultColormap(X_Dpy, sc->which), "black", &sc->xftcolor)) + DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor)) errx(1, "XftColorAllocName"); } @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.32 2011/09/08 12:07:03 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.33 2011/09/08 12:35:33 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -73,7 +73,7 @@ typedef struct { %token COLOR SNAPDIST %token ACTIVEBORDER INACTIVEBORDER %token GROUPBORDER UNGROUPBORDER -%token MENUBG MENUFG +%token MENUBG MENUFG FONTCOLOR %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -193,6 +193,10 @@ colors : ACTIVEBORDER STRING { free(conf->color[CWM_COLOR_FG_MENU].name); conf->color[CWM_COLOR_FG_MENU].name = $2; } + | FONTCOLOR STRING { + free(conf->color[CWM_COLOR_FONT].name); + conf->color[CWM_COLOR_FONT].name = $2; + } ; %% @@ -232,6 +236,7 @@ lookup(char *s) { "borderwidth", BORDERWIDTH}, { "color", COLOR}, { "command", COMMAND}, + { "font", FONTCOLOR}, { "fontname", FONTNAME}, { "gap", GAP}, { "groupborder", GROUPBORDER}, |