diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.c | 3 | ||||
-rw-r--r-- | app/cwm/calmwm.h | 5 | ||||
-rw-r--r-- | app/cwm/conf.c | 4 | ||||
-rw-r--r-- | app/cwm/cwmrc.5 | 5 | ||||
-rw-r--r-- | app/cwm/font.c | 11 | ||||
-rw-r--r-- | app/cwm/parse.y | 9 |
6 files changed, 26 insertions, 11 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 50ef2f405..7e0df51f9 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.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. * - * $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); diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index c67e6c9fc..ec0fe456c 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -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 *); diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 85e5f0f32..93bac36b8 100644 --- a/app/cwm/conf.c +++ b/app/cwm/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. * - * $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 diff --git a/app/cwm/cwmrc.5 b/app/cwm/cwmrc.5 index 9896e4444..d28605d7b 100644 --- a/app/cwm/cwmrc.5 +++ b/app/cwm/cwmrc.5 @@ -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 diff --git a/app/cwm/font.c b/app/cwm/font.c index 1aa19cb3f..cebb2bdca 100644 --- a/app/cwm/font.c +++ b/app/cwm/font.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. * - * $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"); } diff --git a/app/cwm/parse.y b/app/cwm/parse.y index dd6547c45..1cddf10a6 100644 --- a/app/cwm/parse.y +++ b/app/cwm/parse.y @@ -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}, |