wmutils

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

commit 65ae614db39d37afa1df5091cbb158f6520ad08b
parent 69df5f3dd6b64cf3c99e2c4ad3913a047a99ca7b
Author: z3bra <willyatmailoodotorg>
Date:   Mon Sep 21 00:01:26 2015

Remove implicit connection/screen arguments

Diffstat:
 lsw.c   |  2 +-
 mapw.c  |  2 +-
 wattr.c |  6 +++---
 wmlib.c | 52 ++++++++++++++++++++++++++--------------------------
 wmlib.h | 14 +++++++-------
 5 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/lsw.c b/lsw.c @@ -27,7 +27,7 @@ list_windows(xcb_window_t w, int listmask) int i, wn; xcb_window_t *wc; - wn = get_windows(conn, w, &wc); + wn = get_windows(w, &wc); if (wc == NULL) errx(1, "0x%08x: unable to retrieve children", w); diff --git a/mapw.c b/mapw.c @@ -50,7 +50,7 @@ main(int argc, char **argv) xcb_unmap_window(conn, w); break; case TOGGLE: - if (is_mapped(conn, w)) + if (is_mapped(w)) xcb_unmap_window(conn, w); else xcb_map_window(conn, w); diff --git a/wattr.c b/wattr.c @@ -35,7 +35,7 @@ main(int argc, char **argv) if (argc == 2) { w = strtoul(argv[1], NULL, 16); - ret = is_alive(conn, w) ? 0 : 1; + ret = is_alive(w) ? 0 : 1; goto end; } @@ -63,10 +63,10 @@ main(int argc, char **argv) printf("%d", get_attribute(w, ATTR_W)); break; case 'o': - ret = is_ignored(conn, w) ? 0 : 1; + ret = is_ignored(w) ? 0 : 1; goto end; case 'm': - ret = is_mapped(conn, w) ? 0 : 1; + ret = is_mapped(w) ? 0 : 1; goto end; default: kill_xcb(&conn); usage(argv[0]); } diff --git a/wmlib.c b/wmlib.c @@ -6,32 +6,32 @@ #include "wmlib.h" int -init_xcb(xcb_connection_t **con) +init_xcb() { - *con = xcb_connect(NULL, NULL); - if (xcb_connection_has_error(*con)) + conn = xcb_connect(NULL, NULL); + if (xcb_connection_has_error(conn)) return 0; return 1; } int -kill_xcb(xcb_connection_t **con) +kill_xcb() { - if (*con) { - xcb_disconnect(*con); + if (conn) { + xcb_disconnect(conn); return 1; } return 0; } int -is_alive(xcb_connection_t *con, xcb_window_t w) +is_alive(xcb_window_t w) { xcb_get_window_attributes_cookie_t c; xcb_get_window_attributes_reply_t *r; - c = xcb_get_window_attributes(con, w); - r = xcb_get_window_attributes_reply(con, c, NULL); + c = xcb_get_window_attributes(conn, w); + r = xcb_get_window_attributes_reply(conn, c, NULL); if (r == NULL) return 0; @@ -41,14 +41,14 @@ is_alive(xcb_connection_t *con, xcb_window_t w) } int -is_mapped(xcb_connection_t *con, xcb_window_t w) +is_mapped(xcb_window_t w) { int ms; xcb_get_window_attributes_cookie_t c; xcb_get_window_attributes_reply_t *r; - c = xcb_get_window_attributes(con, w); - r = xcb_get_window_attributes_reply(con, c, NULL); + c = xcb_get_window_attributes(conn, w); + r = xcb_get_window_attributes_reply(conn, c, NULL); if (r == NULL) return 0; @@ -60,14 +60,14 @@ is_mapped(xcb_connection_t *con, xcb_window_t w) } int -is_ignored(xcb_connection_t *con, xcb_window_t wid) +is_ignored(xcb_window_t wid) { int or; xcb_get_window_attributes_cookie_t c; xcb_get_window_attributes_reply_t *r; - c = xcb_get_window_attributes(con, wid); - r = xcb_get_window_attributes_reply(con, c, NULL); + c = xcb_get_window_attributes(conn, wid); + r = xcb_get_window_attributes_reply(conn, c, NULL); if (r == NULL) return 0; @@ -79,23 +79,23 @@ is_ignored(xcb_connection_t *con, xcb_window_t wid) } int -get_screen(xcb_connection_t *con, xcb_screen_t **scr) +get_screen() { - *scr = xcb_setup_roots_iterator(xcb_get_setup(con)).data; - if (*scr == NULL) + scrn = xcb_setup_roots_iterator(xcb_get_setup(conn)).data; + if (scrn == NULL) return 0; return 1; } int -get_windows(xcb_connection_t *con, xcb_window_t w, xcb_window_t **l) +get_windows(xcb_window_t w, xcb_window_t **l) { uint32_t childnum = 0; xcb_query_tree_cookie_t c; xcb_query_tree_reply_t *r; - c = xcb_query_tree(con, w); - r = xcb_query_tree_reply(con, c, NULL); + c = xcb_query_tree(conn, w); + r = xcb_query_tree_reply(conn, c, NULL); if (r == NULL) return -1; @@ -193,9 +193,9 @@ set_cursor(int x, int y, int mode) is_listable(xcb_window_t w, int mask) { if ((mask & LIST_ALL) - || (!is_mapped (conn, w) && mask & LIST_HIDDEN) - || ( is_ignored(conn, w) && mask & LIST_IGNORE) - || ( is_mapped (conn, w) && !is_ignored(conn, w) && mask == 0)) + || (!is_mapped (w) && mask & LIST_HIDDEN) + || ( is_ignored(w) && mask & LIST_IGNORE) + || ( is_mapped (w) && !is_ignored(w) && mask == 0)) return 1; return 0; @@ -224,7 +224,7 @@ move(xcb_window_t wid, int mode, int x, int y) { int curx, cury, curw, curh, curb; - if (!is_mapped(conn, wid) || wid == scrn->root) + if (!is_mapped(wid) || wid == scrn->root) return -1; curb = get_attribute(wid, ATTR_B); @@ -261,7 +261,7 @@ resize(xcb_window_t wid, int mode, int w, int h) { int curx, cury, curw, curh, curb; - if (!is_mapped(conn, wid) || wid == scrn->root) + if (!is_mapped(wid) || wid == scrn->root) return -1; curb = get_attribute(wid, ATTR_B); diff --git a/wmlib.h b/wmlib.h @@ -32,16 +32,16 @@ enum { RELATIVE = 1 }; -int init_xcb(xcb_connection_t **con); -int kill_xcb(xcb_connection_t **con); +int init_xcb(); +int kill_xcb(); -int is_alive(xcb_connection_t *con, xcb_window_t wid); -int is_ignored(xcb_connection_t *con, xcb_window_t wid); +int is_alive(xcb_window_t wid); +int is_ignored(xcb_window_t wid); int is_listable(xcb_window_t wid, int mask); -int is_mapped(xcb_connection_t *con, xcb_window_t wid); +int is_mapped(xcb_window_t wid); -int get_screen(xcb_connection_t *con, xcb_screen_t **scr); -int get_windows(xcb_connection_t *con, xcb_window_t wid, xcb_window_t **list); +int get_screen(); +int get_windows(xcb_window_t wid, xcb_window_t **list); int get_attribute(xcb_window_t, int); int get_cursor(int mode, uint32_t wid, int *x, int *y);