This commit is contained in:
okan 2012-12-17 02:53:29 +00:00
parent 6900cd3612
commit 96cd288a2a
5 changed files with 28 additions and 25 deletions

View File

@ -317,7 +317,8 @@ __dead void usage(void);
void client_applysizehints(struct client_ctx *);
struct client_ctx *client_current(void);
void client_cycle(struct screen_ctx *, int);
void client_cycle_leave(struct screen_ctx *, struct client_ctx *);
void client_cycle_leave(struct screen_ctx *,
struct client_ctx *);
void client_delete(struct client_ctx *);
void client_draw_border(struct client_ctx *);
struct client_ctx *client_find(Window);
@ -364,8 +365,8 @@ void search_match_client(struct menu_q *, struct menu_q *,
char *);
void search_match_exec(struct menu_q *, struct menu_q *,
char *);
void search_match_exec_path(struct menu_q *, struct menu_q *,
char *);
void search_match_exec_path(struct menu_q *,
struct menu_q *, char *);
void search_match_path_any(struct menu_q *, struct menu_q *,
char *);
void search_match_text(struct menu_q *, struct menu_q *,
@ -475,6 +476,8 @@ void xu_ptr_setpos(Window, int, int);
void xu_ptr_ungrab(void);
void xu_sendmsg(Window, Atom, long);
void xu_setstate(struct client_ctx *, int);
void xu_xorcolor(XRenderColor, XRenderColor,
XRenderColor *);
void xu_ewmh_net_supported(struct screen_ctx *);
void xu_ewmh_net_supported_wm_check(struct screen_ctx *);
@ -487,12 +490,11 @@ void xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *);
void xu_ewmh_net_showing_desktop(struct screen_ctx *);
void xu_ewmh_net_virtual_roots(struct screen_ctx *);
void xu_ewmh_net_current_desktop(struct screen_ctx *, long);
void xu_ewmh_net_desktop_names(struct screen_ctx *, char *, int);
void xu_ewmh_net_desktop_names(struct screen_ctx *, char *,
int);
void xu_ewmh_net_wm_desktop(struct client_ctx *);
void xu_xorcolor(XRenderColor, XRenderColor, XRenderColor *);
void u_exec(char *);
void u_spawn(char *);

10
conf.c
View File

@ -62,14 +62,14 @@ conf_gap(struct conf *c, struct screen_ctx *sc)
void
conf_font(struct conf *c, struct screen_ctx *sc)
{
font_init(sc, c->font, (const char**)c->menucolor);
font_init(sc, c->font, (const char **)c->menucolor);
}
static char *menu_color_binds[CWM_COLOR_MENU_MAX] = {
"black", /* CWM_COLOR_MENU_FG */
"white", /* CWM_COLOR_MENU_BG */
"black", /* CWM_COLOR_MENU_FONT */
"", /* CWM_COLOR_MENU_FONT_SEL */
"black", /* CWM_COLOR_MENU_FG */
"white", /* CWM_COLOR_MENU_BG */
"black", /* CWM_COLOR_MENU_FONT */
"", /* CWM_COLOR_MENU_FONT_SEL */
};
static struct color color_binds[CWM_COLOR_MAX] = {

15
font.c
View File

@ -51,8 +51,8 @@ font_height(struct screen_ctx *sc)
void
font_init(struct screen_ctx *sc, const char *name, const char **color)
{
int i;
XRenderColor c;
int i;
XRenderColor c;
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
@ -62,7 +62,8 @@ font_init(struct screen_ctx *sc, const char *name, const char **color)
sc->font = XftFontOpenName(X_Dpy, sc->which, name);
if (sc->font == NULL)
errx(1, "XftFontOpenName");
for(i = 0; i < CWM_COLOR_MENU_MAX; i++) {
for (i = 0; i < CWM_COLOR_MENU_MAX; i++) {
if (*color[i] == '\0')
break;
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
@ -74,11 +75,11 @@ font_init(struct screen_ctx *sc, const char *name, const char **color)
return;
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_BG].color,
sc->xftcolor[CWM_COLOR_MENU_FG].color, &c);
sc->xftcolor[CWM_COLOR_MENU_FG].color, &c);
xu_xorcolor(sc->xftcolor[CWM_COLOR_MENU_FONT].color, c, &c);
if (!XftColorAllocValue(X_Dpy, DefaultVisual(X_Dpy, sc->which),
DefaultColormap(X_Dpy, sc->which), &c,
&sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
DefaultColormap(X_Dpy, sc->which), &c,
&sc->xftcolor[CWM_COLOR_MENU_FONT_SEL]))
errx(1, "XftColorAllocValue");
}
@ -97,7 +98,7 @@ void
font_draw(struct screen_ctx *sc, const char *text, int len,
Drawable d, int active, int x, int y)
{
int color;
int color;
color = active ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
XftDrawChange(sc->xftdraw, d);

12
menu.c
View File

@ -473,17 +473,16 @@ menu_draw_entry(struct screen_ctx *sc, struct menu_ctx *mc,
TAILQ_FOREACH(mi, resultq, resultentry)
if (entry == i++)
break;
if (mi == NULL)
return;
color = active ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG;
text = mi->print[0] != '\0' ?
mi->print : mi->text;
text = mi->print[0] != '\0' ? mi->print : mi->text;
XftDrawRect(sc->xftdraw, &sc->xftcolor[color], 0,
font_height(sc) * entry, mc->width,
font_height(sc) + font_descent(sc));
font_height(sc) * entry, mc->width,
font_height(sc) + font_descent(sc));
font_draw(sc, text, strlen(text), sc->menuwin, active,
0, font_height(sc) * entry + font_ascent(sc) + 1);
0, font_height(sc) * entry + font_ascent(sc) + 1);
}
static void
@ -503,6 +502,7 @@ menu_handle_move(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc,
menu_draw_entry(sc, mc, resultq, mc->entry, 1);
} else
(void)xu_ptr_regrab(MENUGRABMASK, Cursor_default);
if (mc->hasprompt)
menu_draw_entry(sc, mc, resultq, 1, 1);
}

View File

@ -582,7 +582,7 @@ parse_config(const char *filename, struct conf *xconf)
xconf->color[i].name = conf->color[i].name;
for (i = 0; i < CWM_COLOR_MENU_MAX; i++)
xconf->menucolor[i]= conf->menucolor[i];
xconf->menucolor[i] = conf->menucolor[i];
xconf->font = conf->font;
}