From b086f741a61b80d021c0ea7aa0ba8e65049a91d4 Mon Sep 17 00:00:00 2001 From: David Hill Date: Wed, 4 Jul 2012 17:41:08 -0400 Subject: [PATCH] convert ewmh_autoquirk to XCB --- spectrwm.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/spectrwm.c b/spectrwm.c index 83d1bfa..781cdd9 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -792,20 +792,22 @@ teardown_ewmh(void) void ewmh_autoquirk(struct ws_win *win) { - int success, i; - unsigned long *data = NULL, n; - Atom type; + int i; + unsigned long n; + xcb_atom_t type; - success = get_property(win->id, ewmh[_NET_WM_WINDOW_TYPE].atom, (~0L), - XA_ATOM, &n, NULL, (void *)&data); + xcb_get_property_cookie_t c; + xcb_get_property_reply_t *r; - if (!success) { - XFree(data); + c = xcb_get_property(conn, False, win->id, + ewmh[_NET_WM_WINDOW_TYPE].atom, XCB_ATOM_ATOM, 0, (~0L)); + r = xcb_get_property_reply(conn, c, NULL); + if (!r) return; - } + n = xcb_get_property_value_length(r); for (i = 0; i < n; i++) { - type = data[i]; + type = *((xcb_atom_t *)xcb_get_property_value(r)); if (type == ewmh[_NET_WM_WINDOW_TYPE_NORMAL].atom) break; if (type == ewmh[_NET_WM_WINDOW_TYPE_DOCK].atom || @@ -822,8 +824,7 @@ ewmh_autoquirk(struct ws_win *win) break; } } - - XFree(data); + free(r); } #define SWM_EWMH_ACTION_COUNT_MAX (6) -- 1.7.10.4