From 1d370af35cdb1e7d7c05f83d25f0b7d10bd7d065 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 24 Aug 2009 10:44:47 +0200 Subject: icccm: add xcb_get_wm_protocols_from_reply Signed-off-by: Julien Danjou --- icccm/icccm.c | 23 ++++++++++++++--------- icccm/xcb_icccm.h | 11 +++++++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/icccm/icccm.c b/icccm/icccm.c index 67270d3..776c299 100644 --- a/icccm/icccm.c +++ b/icccm/icccm.c @@ -694,18 +694,10 @@ xcb_get_wm_protocols_unchecked(xcb_connection_t *c, } uint8_t -xcb_get_wm_protocols_reply(xcb_connection_t *c, - xcb_get_property_cookie_t cookie, - xcb_get_wm_protocols_reply_t *protocols, - xcb_generic_error_t **e) +xcb_get_wm_protocols_from_reply(xcb_get_property_reply_t *reply, xcb_get_wm_protocols_reply_t *protocols) { - xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); - if(!reply || reply->type != ATOM || reply->format != 32) - { - free(reply); return 0; - } protocols->_reply = reply; protocols->atoms_len = xcb_get_property_value_length(protocols->_reply) / (reply->format / 8); @@ -714,6 +706,19 @@ xcb_get_wm_protocols_reply(xcb_connection_t *c, return 1; } +uint8_t +xcb_get_wm_protocols_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_get_wm_protocols_reply_t *protocols, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + uint8_t ret = xcb_get_wm_protocols_from_reply(reply, protocols); + if(!ret) + free(reply); + return ret; +} + void xcb_get_wm_protocols_reply_wipe(xcb_get_wm_protocols_reply_t *protocols) { diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h index 5358d89..938fecb 100644 --- a/icccm/xcb_icccm.h +++ b/icccm/xcb_icccm.h @@ -869,6 +869,17 @@ xcb_get_property_cookie_t xcb_get_wm_protocols_unchecked(xcb_connection_t *c, xcb_window_t window, xcb_atom_t wm_protocol_atom); +/** + * @brief Fill the given structure with the WM_PROTOCOLS property of a window. + * @param reply The reply of the GetProperty request. + * @param protocols WM_PROTOCOLS property value. + * @return Return 1 on success, 0 otherwise. + * + * protocols structure members should be freed by + * xcb_get_wm_protocols_reply_wipe(). + */ +uint8_t xcb_get_wm_protocols_from_reply(xcb_get_property_reply_t *reply, + xcb_get_wm_protocols_reply_t *protocols); /** * @brief Fill the given structure with the WM_PROTOCOLS property of a window. * @param c The connection to the X server. -- cgit v1.2.3