This commit is contained in:
okan 2015-07-01 14:36:42 +00:00
parent 8efaf33cfb
commit cb900def7f
6 changed files with 18 additions and 42 deletions

View File

@ -655,7 +655,7 @@ client_cycle(struct screen_ctx *sc, int flags)
oldcc = client_current(); oldcc = client_current();
if (oldcc == NULL) if (oldcc == NULL)
oldcc = (flags & CWM_RCYCLE ? oldcc = ((flags & CWM_RCYCLE) ?
TAILQ_LAST(&sc->clientq, client_ctx_q) : TAILQ_LAST(&sc->clientq, client_ctx_q) :
TAILQ_FIRST(&sc->clientq)); TAILQ_FIRST(&sc->clientq));
@ -663,7 +663,7 @@ client_cycle(struct screen_ctx *sc, int flags)
while (again) { while (again) {
again = 0; again = 0;
newcc = (flags & CWM_RCYCLE ? client_prev(newcc) : newcc = ((flags & CWM_RCYCLE) ? client_prev(newcc) :
client_next(newcc)); client_next(newcc));
/* Only cycle visible and non-ignored windows. */ /* Only cycle visible and non-ignored windows. */
@ -707,7 +707,7 @@ client_next(struct client_ctx *cc)
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
struct client_ctx *ccc; struct client_ctx *ccc;
return((ccc = TAILQ_NEXT(cc, entry)) != NULL ? return(((ccc = TAILQ_NEXT(cc, entry)) != NULL) ?
ccc : TAILQ_FIRST(&sc->clientq)); ccc : TAILQ_FIRST(&sc->clientq));
} }
@ -717,7 +717,7 @@ client_prev(struct client_ctx *cc)
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
struct client_ctx *ccc; struct client_ctx *ccc;
return((ccc = TAILQ_PREV(cc, client_ctx_q, entry)) != NULL ? return(((ccc = TAILQ_PREV(cc, client_ctx_q, entry)) != NULL) ?
ccc : TAILQ_LAST(&sc->clientq, client_ctx_q)); ccc : TAILQ_LAST(&sc->clientq, client_ctx_q));
} }

4
conf.c
View File

@ -346,8 +346,8 @@ conf_client(struct client_ctx *cc)
} }
} }
cc->bwidth = ignore ? 0 : Conf.bwidth; cc->bwidth = (ignore) ? 0 : Conf.bwidth;
cc->flags |= ignore ? CLIENT_IGNORE : 0; cc->flags |= (ignore) ? CLIENT_IGNORE : 0;
} }
static const struct { static const struct {

9
menu.c
View File

@ -411,8 +411,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
n = 0; n = 0;
TAILQ_FOREACH(mi, resultq, resultentry) { TAILQ_FOREACH(mi, resultq, resultentry) {
char *text = mi->print[0] != '\0' ? char *text = (mi->print[0] != '\0') ? mi->print : mi->text;
mi->print : mi->text;
int y = n * (sc->xftfont->height + 1) + sc->xftfont->ascent + 1; int y = n * (sc->xftfont->height + 1) + sc->xftfont->ascent + 1;
/* Stop drawing when menu doesn't fit inside the screen. */ /* Stop drawing when menu doesn't fit inside the screen. */
@ -444,12 +443,12 @@ menu_draw_entry(struct menu_ctx *mc, struct menu_q *resultq,
if (mi == NULL) if (mi == NULL)
return; return;
color = active ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG; 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, XftDrawRect(sc->xftdraw, &sc->xftcolor[color], 0,
(sc->xftfont->height + 1) * entry, mc->geom.w, (sc->xftfont->height + 1) * entry, mc->geom.w,
(sc->xftfont->height + 1) + sc->xftfont->descent); (sc->xftfont->height + 1) + sc->xftfont->descent);
color = active ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT; color = (active) ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
xu_xft_draw(sc, text, color, xu_xft_draw(sc, text, color,
0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1); 0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1);
} }

View File

@ -43,8 +43,8 @@ mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
client_applysizehints(cc); client_applysizehints(cc);
cc->geom.x = x <= mx ? x : x - cc->geom.w; cc->geom.x = (x <= mx) ? x : x - cc->geom.w;
cc->geom.y = y <= my ? y : y - cc->geom.h; cc->geom.y = (y <= my) ? y : y - cc->geom.h;
} }
static void static void
@ -183,7 +183,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
if (group_holds_only_sticky(gc)) if (group_holds_only_sticky(gc))
continue; continue;
menuq_add(&menuq, gc, menuq_add(&menuq, gc,
group_holds_only_hidden(gc) ? "%d: [%s]" : "%d: %s", (group_holds_only_hidden(gc)) ? "%d: [%s]" : "%d: %s",
gc->num, gc->name); gc->num, gc->name);
} }

View File

@ -134,7 +134,7 @@ search_print_cmd(struct menu *mi, int i)
special = 1; special = 1;
(void)snprintf(mi->print, sizeof(mi->print), (void)snprintf(mi->print, sizeof(mi->print),
(special) ? "[%s]" : "%s", cmd->name); (special) ? "[%s]" : "%s", cmd->name);
} }
void void
@ -148,35 +148,12 @@ search_print_client(struct menu *mi, int list)
else if (cc->flags & CLIENT_HIDDEN) else if (cc->flags & CLIENT_HIDDEN)
flag = '&'; flag = '&';
if (list) if ((list) || (cc->matchname == cc->label))
cc->matchname = cc->name; cc->matchname = cc->name;
(void)snprintf(mi->print, sizeof(mi->print), "(%d) %c[%s] %s", (void)snprintf(mi->print, sizeof(mi->print), "(%d) %c[%s] %s",
cc->group ? cc->group->num : 0, flag, (cc->group) ? cc->group->num : 0, flag,
cc->label ? cc->label : "", cc->matchname); (cc->label) ? cc->label : "", cc->matchname);
if (!list && cc->matchname != cc->name &&
strlen(mi->print) < sizeof(mi->print) - 1) {
const char *marker = "";
char buf[MENU_MAXENTRY + 1];
int diff;
diff = sizeof(mi->print) - 1 - strlen(mi->print);
/* One for the ':' */
diff -= 1;
if (strlen(cc->name) > diff) {
marker = "..";
diff -= 2;
} else {
diff = strlen(cc->name);
}
(void)strlcpy(buf, mi->print, sizeof(buf));
(void)snprintf(mi->print, sizeof(mi->print),
"%s:%.*s%s", buf, diff, cc->name, marker);
}
} }
static void static void

View File

@ -279,7 +279,7 @@ xev_handle_keypress(XEvent *ee)
if ((kb->modmask | modshift) != e->state) if ((kb->modmask | modshift) != e->state)
continue; continue;
if (kb->press.keysym == (modshift == 0 ? keysym : skeysym)) if (kb->press.keysym == ((modshift == 0) ? keysym : skeysym))
break; break;
} }