From: David Hill Date: Wed, 4 Jul 2012 21:21:25 +0000 (-0400) Subject: convert ewmh_get_win_state to XCB X-Git-Url: https://jasonwoof.com/gitweb/?a=commitdiff_plain;h=0ac5177d7b141380345b6533a13e3cec5b87fd4f;hp=e4fe23a9219929d9c9ababb0d00c5d643a719bb2;p=spectrwm.git convert ewmh_get_win_state to XCB --- diff --git a/spectrwm.c b/spectrwm.c index ea82b64..40e5a07 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -951,9 +951,10 @@ ewmh_update_win_state(struct ws_win *win, long state, long action) void ewmh_get_win_state(struct ws_win *win) { - int success, i; - unsigned long n; - Atom *states; + xcb_atom_t *states; + xcb_get_property_cookie_t c; + xcb_get_property_reply_t *r; + int i, n; if (win == NULL) return; @@ -964,16 +965,19 @@ ewmh_get_win_state(struct ws_win *win) if (win->manual) win->ewmh_flags |= SWM_F_MANUAL; - success = get_property(win->id, ewmh[_NET_WM_STATE].atom, - (~0L), XA_ATOM, &n, NULL, (void *)&states); - - if (!success) + c = xcb_get_property(conn, False, win->id, ewmh[_NET_WM_STATE].atom, + XCB_ATOM_ATOM, 0, (~0L)); + r = xcb_get_property_reply(conn, c, NULL); + if (!r) return; + + states = xcb_get_property_value(r); + n = xcb_get_property_value_length(r); + + free(r); for (i = 0; i < n; i++) ewmh_update_win_state(win, states[i], _NET_WM_STATE_ADD); - - XFree(states); } /* events */