From 96cd288a2a34e90eb617e2225615eeba2ba690fb Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 17 Dec 2012 02:53:29 +0000 Subject: knf --- calmwm.h | 14 ++++++++------ conf.c | 10 +++++----- font.c | 15 ++++++++------- menu.c | 12 ++++++------ parse.y | 2 +- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/calmwm.h b/calmwm.h index bd0dbd7..0d3b92a 100644 --- a/calmwm.h +++ b/calmwm.h @@ -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 *); diff --git a/conf.c b/conf.c index a42be91..5d4ec23 100644 --- a/conf.c +++ b/conf.c @@ -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] = { diff --git a/font.c b/font.c index cbd5b56..fefce3d 100644 --- a/font.c +++ b/font.c @@ -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); diff --git a/menu.c b/menu.c index 8a0ce26..dd6de18 100644 --- a/menu.c +++ b/menu.c @@ -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); } diff --git a/parse.y b/parse.y index b36ee26..2404f4b 100644 --- a/parse.y +++ b/parse.y @@ -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; } -- cgit 1.4.1