[Xcb-commit] 2 commits - icccm

Julien Danjou jdanjou at kemper.freedesktop.org
Thu Sep 18 23:24:42 PDT 2008


 icccm/icccm.c     |   15 ++++++++++-----
 icccm/xcb_icccm.h |    3 +++
 2 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit ffb67af5535989b6220cef859b8636cffc7cffaf
Author: Julien Danjou <julien at danjou.info>
Date:   Fri Sep 19 08:24:22 2008 +0200

    icccm: fix normal hints flags computing
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

diff --git a/icccm/icccm.c b/icccm/icccm.c
index ed5155f..ee5abd6 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -57,6 +57,7 @@ xcb_get_text_property_reply(xcb_connection_t *c,
                             xcb_generic_error_t **e)
 {
   xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, e);
+
   if(!reply)
     return 0;
 
@@ -421,6 +422,8 @@ xcb_get_wm_size_hints_unchecked(xcb_connection_t *c, xcb_window_t window,
 uint8_t
 xcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints, xcb_get_property_reply_t *reply)
 {
+  uint32_t flags;
+
   if(!reply)
     return 0;
 
@@ -436,20 +439,22 @@ xcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints, xcb_get_property_reply
   memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value (reply),
          length * reply->format >> 3);
 
-  hints->flags = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
-                  XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
-                  XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
-                  XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT);
+  flags = (XCB_SIZE_HINT_US_POSITION | XCB_SIZE_HINT_US_SIZE |
+           XCB_SIZE_HINT_P_POSITION | XCB_SIZE_HINT_P_SIZE |
+           XCB_SIZE_HINT_P_MIN_SIZE | XCB_SIZE_HINT_P_MAX_SIZE |
+           XCB_SIZE_HINT_P_RESIZE_INC | XCB_SIZE_HINT_P_ASPECT);
 
   /* NumPropSizeElements = 18 (ICCCM version 1) */
   if(length >= 18)
-    hints->flags |= (XCB_SIZE_HINT_BASE_SIZE | XCB_SIZE_HINT_P_WIN_GRAVITY);
+    flags |= (XCB_SIZE_HINT_BASE_SIZE | XCB_SIZE_HINT_P_WIN_GRAVITY);
   else
   {
     hints->base_width = 0;
     hints->base_height = 0;
     hints->win_gravity = 0;
   }
+  /* get rid of unwanted bits */
+  hints->flags &= flags;
 
   return 1;
 }
commit a6ca9f24302f95a76fc77d0d8e4a0eea15fdb501
Author: Julien Danjou <julien at danjou.info>
Date:   Fri Sep 19 08:13:23 2008 +0200

    icccm: add some comment on text reply usage
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

diff --git a/icccm/xcb_icccm.h b/icccm/xcb_icccm.h
index 1514adb..fb0ef6f 100644
--- a/icccm/xcb_icccm.h
+++ b/icccm/xcb_icccm.h
@@ -92,6 +92,9 @@ xcb_get_property_cookie_t xcb_get_text_property_unchecked(xcb_connection_t *c,
  * @param e Error if any.
  * @return Return 1 on success, 0 otherwise.
  *
+ * If the function return 0 (failure), the content of prop is unmodified and
+ * therefore the structure must not be wiped.
+ *
  * The parameter e supplied to this function must be NULL if
  * xcb_get_text_property_unchecked() is used.  Otherwise, it stores
  * the error if any.  prop structure members should be freed by


More information about the xcb-commit mailing list