From e50807c8ff5142a5f05459fd8b76ba3596554d19 Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 12 Jul 2012 14:30:52 -0400 Subject: [PATCH] cleanup get_iconic function --- spectrwm.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spectrwm.c b/spectrwm.c index 06f0960..f9b2d43 100644 --- a/spectrwm.c +++ b/spectrwm.c @@ -375,7 +375,7 @@ struct ws_win { int floatmaxed; /* whether maxed by max_stack */ int floating; int manual; - int iconic; + int32_t iconic; int bordered; unsigned int ewmh_flags; int font_size_boundary[SWM_MAX_FONT_STEPS]; @@ -733,29 +733,28 @@ update_iconic(struct ws_win *win, int newv) xcb_delete_property(conn, win->id, iprop); } -int +int32_t get_iconic(struct ws_win *win) { - int32_t v = 0, *vtmp; + int32_t v = 0; xcb_atom_t iprop; - xcb_get_property_cookie_t pc; xcb_get_property_reply_t *pr = NULL; iprop = get_atom_from_string("_SWM_ICONIC"); if (iprop == XCB_ATOM_NONE) goto out; - pc = xcb_get_property(conn, False, win->id, iprop, XCB_ATOM_INTEGER, - 0, 1); - pr = xcb_get_property_reply(conn, pc, NULL); + pr = xcb_get_property_reply(conn, + xcb_get_property(conn, False, win->id, iprop, XCB_ATOM_INTEGER, + 0, 1), + NULL); if (!pr) goto out; if (pr->type != XCB_ATOM_INTEGER || pr->format != 32) goto out; - vtmp = xcb_get_property_value(pr); - v = *vtmp; + v = *((int32_t *)xcb_get_property_value(pr)); out: - if (pr != NULL) + if (pr) free(pr); return (v); } -- 1.7.10.4