[Xcb-commit] configure.ac icccm

Julien Danjou jdanjou at kemper.freedesktop.org
Sat May 9 09:04:03 PDT 2009


 configure.ac  |    2 +-
 icccm/icccm.c |   16 ++++++++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 85c7984f110dabb23ebaef367bcf6df96ad34377
Author: Julien Danjou <julien at danjou.info>
Date:   Sat May 9 18:03:28 2009 +0200

    icccm: fix compatibility with libxcb > 1.2
    
    The get property value proto changed so we do not have to worry about
    formats. Reflect that change.
    
    Signed-off-by: Julien Danjou <julien at danjou.info>

diff --git a/configure.ac b/configure.ac
index 86091f4..6e0d97c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,7 +47,7 @@ AC_SUBST(xcbincludedir)
 pkgconfigdir='${libdir}/pkgconfig'
 AC_SUBST(pkgconfigdir)
 
-PKG_CHECK_MODULES(XCB, xcb >= 1.0)
+PKG_CHECK_MODULES(XCB, xcb > 1.2)
 PKG_CHECK_MODULES(XCB_SHM, xcb-shm)
 PKG_CHECK_MODULES(XCB_RENDER, xcb-render)
 PKG_CHECK_MODULES(XPROTO, xproto >= 7.0.8)
diff --git a/icccm/icccm.c b/icccm/icccm.c
index d818d7e..1c3de0d 100644
--- a/icccm/icccm.c
+++ b/icccm/icccm.c
@@ -64,7 +64,7 @@ xcb_get_text_property_reply(xcb_connection_t *c,
   prop->_reply = reply;
   prop->encoding = prop->_reply->type;
   prop->format = prop->_reply->format;
-  prop->name_len = xcb_get_property_value_length(prop->_reply) * prop->format >> 3;
+  prop->name_len = xcb_get_property_value_length(prop->_reply);
   prop->name = xcb_get_property_value(prop->_reply);
 
   return 1;
@@ -434,7 +434,7 @@ xcb_get_wm_size_hints_from_reply(xcb_size_hints_t *hints, xcb_get_property_reply
   if(!reply)
     return 0;
 
-  int length = xcb_get_property_value_length(reply);
+  int length = xcb_get_property_value_length(reply) / (reply->format / 8);
 
   if (!(reply->type == WM_SIZE_HINTS &&
         (reply->format == 8  || reply->format == 16 ||
@@ -627,16 +627,16 @@ xcb_get_wm_hints_from_reply(xcb_wm_hints_t *hints,
     return 0;
 
   int length = xcb_get_property_value_length(reply);
+  int num_elem = length / (reply->format / 8);
 
-  if ((reply->type != WM_HINTS) ||
-      (length < (XCB_NUM_WM_HINTS_ELEMENTS - 1)) ||
-      (reply->format != 32))
+  if (reply->type != WM_HINTS
+      || reply->format != 32
+      || num_elem < XCB_NUM_WM_HINTS_ELEMENTS - 1)
     return 0;
 
-  memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value(reply),
-         length * reply->format >> 3);
+  memcpy(hints, (xcb_size_hints_t *) xcb_get_property_value(reply), length);
 
-  if(length < XCB_NUM_WM_HINTS_ELEMENTS)
+  if(num_elem < XCB_NUM_WM_HINTS_ELEMENTS)
     hints->window_group = XCB_NONE;
 
   return 1;


More information about the xcb-commit mailing list