wmutils

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

commit 030bbece30686776ce1295b0da3bd03fafc0f329
parent 85b8f17bef4bd6b9680f6184d6ba3dfc5bc11f45
Author: z3bra <willy@mailoo.org>
Date:   Mon Dec 22 23:32:12 2014

formatting, consistency, style(9) and shit

Diffstat:
 pfw.c   |  6 +++---
 wattr.c | 24 +++++++++++-------------
 wmp.c   | 12 ++++++------
 wmv.c   | 24 ++++++++++++++++++------
 wname.c |  9 +++++----
 wrs.c   | 11 ++++++++++-
 wtf.c   |  4 ++--
 wtp.c   |  8 ++++----
 8 files changed, 59 insertions(+), 39 deletions(-)

diff --git a/pfw.c b/pfw.c @@ -9,10 +9,10 @@ static xcb_connection_t *conn; -static xcb_window_t focuswindow(void); +static xcb_window_t focus_window(void); static xcb_window_t -focuswindow(void) +focus_window(void) { xcb_window_t w = 0; xcb_get_input_focus_cookie_t c; @@ -33,7 +33,7 @@ main(int argc, char **argv) { init_xcb(&conn); - printf("0x%08x\n", focuswindow()); + printf("0x%08x\n", focus_window()); kill_xcb(&conn); return 0; diff --git a/wattr.c b/wattr.c @@ -8,11 +8,10 @@ #include "util.h" -char *argv0; static xcb_connection_t *conn; -static void usage(void); -static int getattribute(xcb_window_t, int); +static void usage(char *); +static int get_attribute(xcb_window_t, int); enum { ATTR_W = 1 << 0, @@ -26,14 +25,14 @@ enum { }; static void -usage(void) +usage(char *name) { - fprintf(stderr, "usage: %s [-h] [bmiwhxy] <wid>\n", argv0); + fprintf(stderr, "usage: %s [-h] [bmiwhxy] <wid>\n", name); exit(1); } static int -getattribute(xcb_window_t w, int attr) +get_attribute(xcb_window_t w, int attr) { xcb_get_geometry_cookie_t c; xcb_get_geometry_reply_t *r; @@ -64,8 +63,7 @@ main(int argc, char **argv) xcb_window_t w = 0; if (argc < 2 || (strncmp(argv[1], "-h", 2) == 0)) { - argv0 = argv[0]; - usage(); + usage(argv[0]); } init_xcb(&conn); @@ -82,15 +80,15 @@ main(int argc, char **argv) switch (argv[1][i]) { case 'i': printf("0x%08x", w); break; - case 'b': printf("%d", getattribute(w, ATTR_B)); + case 'b': printf("%d", get_attribute(w, ATTR_B)); break; - case 'h': printf("%d", getattribute(w, ATTR_H)); + case 'h': printf("%d", get_attribute(w, ATTR_H)); break; - case 'x': printf("%d", getattribute(w, ATTR_X)); + case 'x': printf("%d", get_attribute(w, ATTR_X)); break; - case 'y': printf("%d", getattribute(w, ATTR_Y)); + case 'y': printf("%d", get_attribute(w, ATTR_Y)); break; - case 'w': printf("%d", getattribute(w, ATTR_W)); + case 'w': printf("%d", get_attribute(w, ATTR_W)); break; case 'o': ignore(conn, w) ? exit(0) : exit(1); case 'm': mapped(conn, w) ? exit(0) : exit(1); diff --git a/wmp.c b/wmp.c @@ -14,27 +14,27 @@ enum { }; static xcb_connection_t *conn; -static xcb_screen_t *scr; +static xcb_screen_t *scr; -static void usage (char *); -static void warp_cursor (int, int, int); +static void usage(char *); +static void warp_cursor(int, int, int); static void -usage (char *name) +usage(char *name) { fprintf(stderr, "usage: %s -ar <x> <y>\n", name); exit(1); } static void -warp_cursor (int x, int y, int mode) +warp_cursor(int x, int y, int mode) { xcb_warp_pointer(conn, XCB_NONE, mode ? XCB_NONE : scr->root, 0, 0, 0, 0, x, y); } int -main (int argc, char **argv) +main(int argc, char **argv) { char *argv0; int mode = ABSOLUTE; diff --git a/wmv.c b/wmv.c @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include <xcb/xcb.h> +#include <stdio.h> #include <stdlib.h> #include <err.h> @@ -9,11 +10,20 @@ static xcb_connection_t *conn; static xcb_screen_t *scr; -static void move (xcb_window_t, int, int); -static void center_pointer (xcb_window_t); +static void usage(char *); +static void move(xcb_window_t, int, int); +static void center_pointer(xcb_window_t); static void -center_pointer (xcb_window_t win) { +usage(char *name) +{ + fprintf(stderr, "usage: %s <x> <y> <win>", name); + exit(1); +} + +static void +center_pointer(xcb_window_t win) +{ uint32_t values[1]; xcb_get_geometry_reply_t *geom; geom = xcb_get_geometry_reply(conn, xcb_get_geometry(conn, win), NULL); @@ -30,7 +40,8 @@ center_pointer (xcb_window_t win) { } static void -move (xcb_window_t win, int x, int y) { +move(xcb_window_t win, int x, int y) +{ uint32_t values[2]; int real; xcb_get_geometry_reply_t *geom; @@ -72,11 +83,12 @@ move (xcb_window_t win, int x, int y) { } int -main (int argc, char **argv) { +main(int argc, char **argv) +{ xcb_window_t win; if (argc != 4) - errx(1, "usage: %s <x> <y> <win>", argv[0]); + usage(argv[0]); init_xcb(&conn); diff --git a/wname.c b/wname.c @@ -9,8 +9,8 @@ static xcb_connection_t *conn; -static void usage (char *); -static int get_title (xcb_window_t); +static void usage(char *); +static int get_title(xcb_window_t); static void usage (char *name) @@ -20,7 +20,7 @@ usage (char *name) } static int -get_title (xcb_window_t win) +get_title(xcb_window_t win) { int len = 0; xcb_get_property_cookie_t cookie; @@ -44,7 +44,8 @@ get_title (xcb_window_t win) return 1; } -int main (int argc, char **argv) +int +main(int argc, char **argv) { int i, r = 0; diff --git a/wrs.c b/wrs.c @@ -1,6 +1,7 @@ /* See LICENSE file for copyright and license details. */ #include <xcb/xcb.h> +#include <stdio.h> #include <stdlib.h> #include <err.h> @@ -9,9 +10,17 @@ static xcb_connection_t *conn; static xcb_screen_t *scr; +static void usage(char *); static void resize(xcb_window_t, int, int); static void +usage(char *name) +{ + fprintf(stderr, "usage: %s <x> <y> <wid> [wid..]", name); + exit(1); +} + +static void resize(xcb_window_t w, int x, int y) { uint32_t val[3]; @@ -52,7 +61,7 @@ main(int argc, char **argv) { int x, y; if (argc < 4) - errx(1, "usage: %s <x> <y> <wid> [wid..]", argv[0]); + usage(argv[0]); init_xcb(&conn); get_screen(conn, &scr); diff --git a/wtf.c b/wtf.c @@ -12,14 +12,14 @@ static xcb_connection_t *conn; static void usage (char *name); static void -usage (char *name) +usage(char *name) { fprintf(stderr, "usage: %s <wid>\n", name); exit(1); } int -main (int argc, char **argv) +main(int argc, char **argv) { xcb_window_t win; diff --git a/wtp.c b/wtp.c @@ -9,8 +9,8 @@ static xcb_connection_t *conn; -static void usage (char *name); -static void teleport (xcb_window_t, int, int, int, int); +static void usage (char *name); +static void teleport (xcb_window_t, int, int, int, int); static void usage(char *name) @@ -20,7 +20,7 @@ usage(char *name) } static void -teleport (xcb_window_t win, int x, int y, int w, int h) +teleport(xcb_window_t win, int x, int y, int w, int h) { uint32_t values[4]; uint32_t mask = XCB_CONFIG_WINDOW_X @@ -37,7 +37,7 @@ teleport (xcb_window_t win, int x, int y, int w, int h) } int -main (int argc, char **argv) +main(int argc, char **argv) { xcb_window_t win;