From 8efc9b87d1f3e13ed3e198b55ed355a508e0c130 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 16 Sep 2008 17:41:37 +0200 Subject: icccm: introduce xcb_get_wm_transient_for_from_reply Signed-off-by: Julien Danjou --- icccm/icccm.c | 24 ++++++++++++++---------- icccm/xcb_icccm.h | 9 +++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/icccm/icccm.c b/icccm/icccm.c index 8e7baa5..ed5155f 100644 --- a/icccm/icccm.c +++ b/icccm/icccm.c @@ -280,25 +280,29 @@ xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, xcb_window_t window) } uint8_t -xcb_get_wm_transient_for_reply(xcb_connection_t *c, - xcb_get_property_cookie_t cookie, - xcb_window_t *prop, - xcb_generic_error_t **e) +xcb_get_wm_transient_for_from_reply(xcb_window_t *prop, + xcb_get_property_reply_t *reply) { - xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); - if(!reply || reply->type != WINDOW || reply->format != 32 || !reply->length) - { - free(reply); return 0; - } *prop = *((xcb_window_t *) xcb_get_property_value(reply)); - free(reply); return 1; } +uint8_t +xcb_get_wm_transient_for_reply(xcb_connection_t *c, + xcb_get_property_cookie_t cookie, + xcb_window_t *prop, + xcb_generic_error_t **e) +{ + xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e); + uint8_t ret = xcb_get_wm_transient_for_from_reply(prop, reply); + free(reply); + return ret; +} + /* WM_SIZE_HINTS */ void diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h index 3adf259..1514adb 100644 --- a/icccm/xcb_icccm.h +++ b/icccm/xcb_icccm.h @@ -366,6 +366,15 @@ xcb_get_property_cookie_t xcb_get_wm_transient_for(xcb_connection_t *c, xcb_get_property_cookie_t xcb_get_wm_transient_for_unchecked(xcb_connection_t *c, xcb_window_t window); +/** + * @brief Fill given window pointer with the WM_TRANSIENT_FOR property of a window. + * @param prop WM_TRANSIENT_FOR property value. + * @param reply The get property request reply. + * @return Return 1 on success, 0 otherwise. + */ +uint8_t +xcb_get_wm_transient_for_from_reply(xcb_window_t *prop, + xcb_get_property_reply_t *reply); /** * @brief Fill given structure with the WM_TRANSIENT_FOR property of a window. * @param c The connection to the X server. -- cgit v1.2.3