summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--client.c8
-rw-r--r--conf.c4
-rw-r--r--menu.c9
-rw-r--r--mousefunc.c6
-rw-r--r--search.c31
-rw-r--r--xevents.c2
6 files changed, 18 insertions, 42 deletions
diff --git a/client.c b/client.c
index de1e8a1..cbf2cb2 100644
--- a/client.c
+++ b/client.c
@@ -655,7 +655,7 @@ client_cycle(struct screen_ctx *sc, int flags)
 
 	oldcc = client_current();
 	if (oldcc == NULL)
-		oldcc = (flags & CWM_RCYCLE ?
+		oldcc = ((flags & CWM_RCYCLE) ?
 		    TAILQ_LAST(&sc->clientq, client_ctx_q) :
 		    TAILQ_FIRST(&sc->clientq));
 
@@ -663,7 +663,7 @@ client_cycle(struct screen_ctx *sc, int flags)
 	while (again) {
 		again = 0;
 
-		newcc = (flags & CWM_RCYCLE ? client_prev(newcc) :
+		newcc = ((flags & CWM_RCYCLE) ? client_prev(newcc) :
 		    client_next(newcc));
 
 		/* Only cycle visible and non-ignored windows. */
@@ -707,7 +707,7 @@ client_next(struct client_ctx *cc)
 	struct screen_ctx	*sc = cc->sc;
 	struct client_ctx	*ccc;
 
-	return((ccc = TAILQ_NEXT(cc, entry)) != NULL ?
+	return(((ccc = TAILQ_NEXT(cc, entry)) != NULL) ?
 	    ccc : TAILQ_FIRST(&sc->clientq));
 }
 
@@ -717,7 +717,7 @@ client_prev(struct client_ctx *cc)
 	struct screen_ctx	*sc = cc->sc;
 	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));
 }
 
diff --git a/conf.c b/conf.c
index 95054d2..d0956a1 100644
--- a/conf.c
+++ b/conf.c
@@ -346,8 +346,8 @@ conf_client(struct client_ctx *cc)
 		}
 	}
 
-	cc->bwidth = ignore ? 0 : Conf.bwidth;
-	cc->flags |= ignore ? CLIENT_IGNORE : 0;
+	cc->bwidth = (ignore) ? 0 : Conf.bwidth;
+	cc->flags |= (ignore) ? CLIENT_IGNORE : 0;
 }
 
 static const struct {
diff --git a/menu.c b/menu.c
index 0151ecf..15d2b7d 100644
--- a/menu.c
+++ b/menu.c
@@ -411,8 +411,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq)
 		n = 0;
 
 	TAILQ_FOREACH(mi, resultq, resultentry) {
-		char *text = mi->print[0] != '\0' ?
-		    mi->print : mi->text;
+		char *text = (mi->print[0] != '\0') ? mi->print : mi->text;
 		int y = n * (sc->xftfont->height + 1) + sc->xftfont->ascent + 1;
 
 		/* 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)
 		return;
 
-	color = active ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG;
-	text = mi->print[0] != '\0' ? mi->print : mi->text;
+	color = (active) ? CWM_COLOR_MENU_FG : CWM_COLOR_MENU_BG;
+	text = (mi->print[0] != '\0') ? mi->print : mi->text;
 	XftDrawRect(sc->xftdraw, &sc->xftcolor[color], 0,
 	    (sc->xftfont->height + 1) * entry, mc->geom.w,
 	    (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,
 	    0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1);
 }
diff --git a/mousefunc.c b/mousefunc.c
index d709a3f..958fee2 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -43,8 +43,8 @@ mousefunc_sweep_calc(struct client_ctx *cc, int x, int y, int mx, int my)
 
 	client_applysizehints(cc);
 
-	cc->geom.x = x <= mx ? x : x - cc->geom.w;
-	cc->geom.y = y <= my ? y : y - cc->geom.h;
+	cc->geom.x = (x <= mx) ? x : x - cc->geom.w;
+	cc->geom.y = (y <= my) ? y : y - cc->geom.h;
 }
 
 static void
@@ -183,7 +183,7 @@ mousefunc_menu_group(struct client_ctx *cc, union arg *arg)
 		if (group_holds_only_sticky(gc))
 			continue;
 		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);
 	}
 
diff --git a/search.c b/search.c
index 9013a9d..6526072 100644
--- a/search.c
+++ b/search.c
@@ -134,7 +134,7 @@ search_print_cmd(struct menu *mi, int i)
 		special = 1;
 
 	(void)snprintf(mi->print, sizeof(mi->print),
-		(special) ? "[%s]" : "%s", cmd->name);
+	    (special) ? "[%s]" : "%s", cmd->name);
 }
 
 void
@@ -148,35 +148,12 @@ search_print_client(struct menu *mi, int list)
 	else if (cc->flags & CLIENT_HIDDEN)
 		flag = '&';
 
-	if (list)
+	if ((list) || (cc->matchname == cc->label))
 		cc->matchname = cc->name;
 
 	(void)snprintf(mi->print, sizeof(mi->print), "(%d) %c[%s] %s",
-	    cc->group ? cc->group->num : 0, flag,
-	    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);
-	}
+	    (cc->group) ? cc->group->num : 0, flag,
+	    (cc->label) ? cc->label : "", cc->matchname);
 }
 
 static void
diff --git a/xevents.c b/xevents.c
index 424a539..f75f8b5 100644
--- a/xevents.c
+++ b/xevents.c
@@ -279,7 +279,7 @@ xev_handle_keypress(XEvent *ee)
 		if ((kb->modmask | modshift) != e->state)
 			continue;
 
-		if (kb->press.keysym == (modshift == 0 ? keysym : skeysym))
+		if (kb->press.keysym == ((modshift == 0) ? keysym : skeysym))
 			break;
 	}