mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
allow configurable menu font color; from Alexander Polakov with a tweak
from me. ok oga@
This commit is contained in:
parent
a262f8e80c
commit
82d31aec1d
1
calmwm.c
1
calmwm.c
@ -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);
|
||||
|
3
calmwm.h
3
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 *);
|
||||
|
||||
|
2
conf.c
2
conf.c
@ -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
|
||||
|
5
cwmrc.5
5
cwmrc.5
@ -14,7 +14,7 @@
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: September 3 2011 $
|
||||
.Dd $Mdocdate: September 8 2011 $
|
||||
.Dt CWMRC 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -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
|
||||
|
9
font.c
9
font.c
@ -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");
|
||||
}
|
||||
|
||||
|
7
parse.y
7
parse.y
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user