summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2009-06-20 00:55:41 +0000
committerokan <okan>2009-06-20 00:55:41 +0000
commitbcc0f73bb68bab7bff0e0c969b81fe7547caa58a (patch)
tree9375d5da09799b5501da624a20855a96a23f92b0
parent58d12134b1679a9172a7131abffc27769780b9c5 (diff)
downloadcwm-bcc0f73bb68bab7bff0e0c969b81fe7547caa58a.tar.gz
cwm-bcc0f73bb68bab7bff0e0c969b81fe7547caa58a.tar.xz
cwm-bcc0f73bb68bab7bff0e0c969b81fe7547caa58a.zip
compact a bit by condensing a few if-else's; from Thomas Pfaff
"go on then" oga@
-rw-r--r--client.c12
-rw-r--r--group.c10
-rw-r--r--input.c5
-rw-r--r--kbfunc.c5
-rw-r--r--mousefunc.c6
5 files changed, 7 insertions, 31 deletions
diff --git a/client.c b/client.c
index 05dff6e..cc5914a 100644
--- a/client.c
+++ b/client.c
@@ -113,11 +113,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
 	/* Notify client of its configuration. */
 	xev_reconfig(cc);
 
-	if (state == IconicState)
-		client_hide(cc);
-	else
-		client_unhide(cc);
-
+	(state == IconicState) ? client_hide(cc) : client_unhide(cc);
 	xu_setstate(cc, cc->state);
 
 	XSync(X_Dpy, False);
@@ -345,11 +341,7 @@ client_ptrwarp(struct client_ctx *cc)
 		y = cc->geom.height / 2;
 	}
 
-	if (cc->state == IconicState)
-		client_unhide(cc);
-	else
-		client_raise(cc);
-
+	(cc->state == IconicState) ? client_unhide(cc) : client_raise(cc);
 	xu_ptr_setpos(cc->win, x, y);
 }
 
diff --git a/group.c b/group.c
index 96f2290..d4d08b5 100644
--- a/group.c
+++ b/group.c
@@ -325,10 +325,7 @@ group_menu(XButtonEvent *e)
 
 	gc = (struct group_ctx *)mi->ctx;
 
-	if (gc->hidden)
-		group_show(gc);
-	else
-		group_hide(gc);
+	(gc->hidden) ? group_show(gc) : group_hide(gc);
 
 cleanup:
 	while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
@@ -349,10 +346,7 @@ group_alltoggle(void)
 			group_hide(&Groups[i]);
 	}
 
-	if (Grouphideall)
-		Grouphideall = 0;
-	else
-		Grouphideall = 1;
+	Grouphideall = (Grouphideall) ? 0 : 1;
 }
 
 void
diff --git a/input.c b/input.c
index b94c968..b9c5185 100644
--- a/input.c
+++ b/input.c
@@ -29,10 +29,7 @@ input_keycodetrans(KeyCode kc, u_int state, enum ctltype *ctl, char *chr)
 	*ctl = CTL_NONE;
 	*chr = '\0';
 
-	if (state & ShiftMask)
-		ks = XKeycodeToKeysym(X_Dpy, kc, 1);
-	else
-		ks = XKeycodeToKeysym(X_Dpy, kc, 0);
+	ks = XKeycodeToKeysym(X_Dpy, kc, (state & ShiftMask) ? 1 : 0);
 
 	/* Look for control characters. */
 	switch (ks) {
diff --git a/kbfunc.c b/kbfunc.c
index 1f3b843..125e1f5 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -412,10 +412,7 @@ kbfunc_client_label(struct client_ctx *cc, union arg *arg)
 
 	TAILQ_INIT(&menuq);
 	
-	if (cc->label != NULL)
-		current = cc->label;
-	else
-		current = NULL;
+	current = cc->label;
 
 	if ((mi = menu_filter(&menuq, "label", current, 1,
 	    search_match_text, NULL)) != NULL) {
diff --git a/mousefunc.c b/mousefunc.c
index 00ccab5..fc6c8b9 100644
--- a/mousefunc.c
+++ b/mousefunc.c
@@ -226,11 +226,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg)
 	TAILQ_INIT(&menuq);
 	TAILQ_FOREACH(cc, &Clientq, entry)
 		if (cc->flags & CLIENT_HIDDEN) {
-			if (cc->label != NULL)
-				wname = cc->label;
-			else
-				wname = cc->name;
-
+			wname = (cc->label) ? cc->label : cc->name;
 			if (wname == NULL)
 				continue;