From 6dcdd18c5a70881e5d4eacd9ba8a052d51a57f53 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 13 May 2012 15:15:54 +0000 Subject: [PATCH] knf, some from a diff from Tiago Cunha. --- app/cwm/calmwm.c | 4 +++- app/cwm/client.c | 18 ++++++++++-------- app/cwm/conf.c | 4 ++-- app/cwm/xutil.c | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 7e0df51f9..d12ebe5ab 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.c @@ -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. * - * $OpenBSD: calmwm.c,v 1.59 2011/09/08 12:35:33 okan Exp $ + * $OpenBSD: calmwm.c,v 1.60 2012/05/13 15:15:54 okan Exp $ */ #include @@ -159,6 +159,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which) XSetWindowAttributes rootattr; int fake; u_int nwins, i; + sc->which = which; sc->rootwin = RootWindow(X_Dpy, sc->which); @@ -221,6 +222,7 @@ x_wmerrorhandler(Display *dpy, XErrorEvent *e) return (0); } + static int x_errorhandler(Display *dpy, XErrorEvent *e) { diff --git a/app/cwm/client.c b/app/cwm/client.c index 2cb0b1e58..e88b7d498 100644 --- a/app/cwm/client.c +++ b/app/cwm/client.c @@ -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. * - * $OpenBSD: client.c,v 1.91 2011/09/13 08:41:57 okan Exp $ + * $OpenBSD: client.c,v 1.92 2012/05/13 15:15:54 okan Exp $ */ #include @@ -394,7 +394,7 @@ client_horizmaximize(struct client_ctx *cc) cc->geom.height -= cc->bwidth * 2; cc->flags &= ~CLIENT_HMAXIMIZED; goto resize; - } + } cc->savegeom.x = cc->geom.x; cc->savegeom.width = cc->geom.width; @@ -613,7 +613,8 @@ client_cycle(struct screen_ctx *sc, int flags) return; if (oldcc == NULL) - oldcc = (flags & CWM_RCYCLE ? TAILQ_LAST(&sc->mruq, cycle_entry_q) : + oldcc = (flags & CWM_RCYCLE ? + TAILQ_LAST(&sc->mruq, cycle_entry_q) : TAILQ_FIRST(&sc->mruq)); newcc = oldcc; @@ -792,6 +793,7 @@ client_getsizehints(struct client_ctx *cc) cc->size->max_aspect.y; } } + void client_applysizehints(struct client_ctx *cc) { @@ -911,13 +913,13 @@ client_snapcalc(int n, int dn, int nmax, int bwidth, int snapdist) /* possible to snap in both directions */ if (s0 != 0 && s1 != 0) if (abs(s0) < abs(s1)) - return s0; + return (s0); else - return s1; + return (s1); else if (s0 != 0) - return s0; + return (s0); else if (s1 != 0) - return s1; + return (s1); else - return 0; + return (0); } diff --git a/app/cwm/conf.c b/app/cwm/conf.c index f6a332e45..60e49ca66 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.c @@ -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. * - * $OpenBSD: conf.c,v 1.98 2012/05/10 00:39:47 okan Exp $ + * $OpenBSD: conf.c,v 1.99 2012/05/13 15:15:54 okan Exp $ */ #include @@ -642,7 +642,7 @@ conf_grab_mouse(struct client_ctx *cc) TAILQ_FOREACH(mb, &Conf.mousebindingq, entry) { if (mb->context != MOUSEBIND_CTX_WIN) - continue; + continue; switch(mb->button) { case 1: diff --git a/app/cwm/xutil.c b/app/cwm/xutil.c index 859cf512b..8b0704c91 100644 --- a/app/cwm/xutil.c +++ b/app/cwm/xutil.c @@ -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. * - * $OpenBSD: xutil.c,v 1.37 2011/07/25 15:10:24 okan Exp $ + * $OpenBSD: xutil.c,v 1.38 2012/05/13 15:15:54 okan Exp $ */ #include @@ -292,10 +292,10 @@ xu_getcolor(struct screen_ctx *sc, char *name) if (!XAllocNamedColor(X_Dpy, DefaultColormap(X_Dpy, sc->which), name, &color, &tmp)) { warnx("XAllocNamedColor error: '%s'", name); - return 0; + return (0); } - return color.pixel; + return (color.pixel); } void