[Xcb-commit] icccm

Julien Danjou jdanjou at kemper.freedesktop.org
Mon Aug 24 01:46:03 PDT 2009


 icccm/icccm.c     |   23 ++++++++++++++---------
 icccm/xcb_icccm.h |   11 +++++++++++
 2 files changed, 25 insertions(+), 9 deletions(-)

New commits:
commit 1d370af35cdb1e7d7c05f83d25f0b7d10bd7d065
Author: Julien Danjou <julien at danjou.info>
Date:   Mon Aug 24 10:44:47 2009 +0200

    icccm: add xcb_get_wm_protocols_from_reply
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

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
@@ -871,6 +871,17 @@ xcb_get_property_cookie_t xcb_get_wm_protocols_unchecked(xcb_connection_t *c,
 
 /**
  * @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.
  * @param cookie Request cookie.
  * @param protocols WM_PROTOCOLS property value.


More information about the xcb-commit mailing list