diff options
author | okan | 2009-06-20 00:55:41 +0000 |
---|---|---|
committer | okan | 2009-06-20 00:55:41 +0000 |
commit | c54416ae163702858ce97808753af16c8c9b5921 (patch) | |
tree | e9d3394584e6cb28ee5e25f556f7ce000bb9cdc6 | |
parent | c6af5e9b967797d315037b26aa05fec5b3e6ef44 (diff) | |
download | cwm-c54416ae163702858ce97808753af16c8c9b5921.tar.gz |
compact a bit by condensing a few if-else's; from Thomas Pfaff
"go on then" oga@
Diffstat (limited to '')
-rw-r--r-- | client.c | 14 | ||||
-rw-r--r-- | group.c | 12 | ||||
-rw-r--r-- | input.c | 7 | ||||
-rw-r--r-- | kbfunc.c | 7 | ||||
-rw-r--r-- | mousefunc.c | 8 |
5 files changed, 12 insertions, 36 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: client.c,v 1.54 2009/06/20 00:22:39 okan Exp $ + * $Id: client.c,v 1.55 2009/06/20 00:55:41 okan Exp $ */ #include "headers.h" @@ -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); } @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: group.c,v 1.31 2009/06/20 00:22:39 okan Exp $ + * $Id: group.c,v 1.32 2009/06/20 00:55:42 okan Exp $ */ #include "headers.h" @@ -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 @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: input.c,v 1.7 2008/07/11 14:21:28 okan Exp $ + * $Id: input.c,v 1.8 2009/06/20 00:55:42 okan Exp $ */ #include "headers.h" @@ -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) { @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: kbfunc.c,v 1.39 2009/06/20 00:22:39 okan Exp $ + * $Id: kbfunc.c,v 1.40 2009/06/20 00:55:42 okan Exp $ */ #include <paths.h> @@ -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 ff6ddeb..b58c82c 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: mousefunc.c,v 1.11 2009/06/20 00:22:39 okan Exp $ + * $Id: mousefunc.c,v 1.12 2009/06/20 00:55:42 okan Exp $ */ #include "headers.h" @@ -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; |