wmutils

X windows manipulation utilities
git clone git://z3bra.org/wmutils
Log | Files | Refs | LICENSE

commit 86d98bdd2df7ae4f0fc2166cd98668e102ef2920
parent 4d8d7118beb336f0bf9e18cdbcb415a49e249b7a
Author: z3bra <willy@mailoo.org>
Date:   Tue Dec  9 12:25:37 2014

chwb: util.c refactoring

Diffstat:
 chwb.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/chwb.c b/chwb.c @@ -20,21 +20,14 @@ #include <err.h> #include "arg.h" +#include "util.h" static xcb_connection_t *conn; -static void cleanup (void); static void usage (char *name); static void setborder (int, int, xcb_window_t); static void -cleanup (void) -{ - if (conn) - xcb_disconnect(conn); -} - -static void usage (char *name) { fprintf(stderr, "usage: %s <-sc ...> <wid> [wid...]\n", name); @@ -69,10 +62,8 @@ main (int argc, char **argv) { char *argv0; int color,bw; - atexit(cleanup); - if (xcb_connection_has_error(conn = xcb_connect(NULL, NULL))) - errx(1, "error connecting to X"); + init_xcb(&conn); color = bw = -1; @@ -94,8 +85,9 @@ main (int argc, char **argv) while (*argv) setborder(bw, color, strtoul(*argv++, NULL, 16)); - xcb_flush(conn); + kill_xcb(&conn); + return 0; }