[Xcb-commit] xcb-util

Ian Osgood iano at kemper.freedesktop.org
Sun Sep 24 13:35:03 PDT 2006


 xcb-util/atom/atoms.gperf.m4         |   40 +--
 xcb-util/atom/xcb_atom.h.m4          |   16 -
 xcb-util/convenient/xcb_aux.c        |  202 +++++++--------
 xcb-util/convenient/xcb_aux.h        |  220 ++++++++--------
 xcb-util/event/events.c              |   55 ++--
 xcb-util/event/xcb_event.h           |   90 +++---
 xcb-util/icccm/icccm.c               |  466 +++++++++++++++++------------------
 xcb-util/icccm/xcb_icccm.h           |  266 +++++++++----------
 xcb-util/image/test_formats.c        |   80 +++---
 xcb-util/image/test_xcb_image.c      |  140 +++++-----
 xcb-util/image/test_xcb_image_shm.c  |   96 +++----
 xcb-util/image/xcb_image.c           |  316 +++++++++++------------
 xcb-util/image/xcb_image.h           |  230 ++++++++---------
 xcb-util/keysyms/keysyms.c           |  138 +++++-----
 xcb-util/keysyms/xcb_keysyms.h       |   50 +--
 xcb-util/property/prop.c             |   84 +++---
 xcb-util/property/xcb_property.h     |   18 -
 xcb-util/renderutil/cache.c          |   66 ++--
 xcb-util/renderutil/util.c           |   46 +--
 xcb-util/renderutil/xcb_renderutil.h |   26 -
 xcb-util/reply/reply.c               |   38 +-
 xcb-util/reply/test_reply.c          |   22 -
 xcb-util/reply/xcb_reply.h           |   20 -
 xcb-util/wm/manage.c                 |   58 ++--
 xcb-util/wm/reply_formats.c          |   22 -
 xcb-util/wm/reply_formats.h          |   30 +-
 xcb-util/wm/table.c                  |    8 
 xcb-util/wm/xcb_wm.h                 |   30 +-
 xcb-util/wm/xcbwm-test.c             |  134 +++++-----
 29 files changed, 1504 insertions(+), 1503 deletions(-)

New commits:
diff-tree 96edbb16f3a93ac6a10a3c524b10df4f2b3bcd00 (from f84522a93631dbefa08b02cf1686b2d4611247c1)
Author: Ian Osgood <iano at quirkster.com>
Date:   Sun Sep 24 13:34:03 2006 -0700

    All xcb-util libraries compile after the Great Renaming.
    
    Many of the exported library functions still need to follow the new convention.

diff --git a/xcb-util/atom/atoms.gperf.m4 b/xcb-util/atom/atoms.gperf.m4
index a628097..9a4e889 100644
--- a/xcb-util/atom/atoms.gperf.m4
+++ b/xcb-util/atom/atoms.gperf.m4
@@ -4,7 +4,7 @@
 #include "xcb_atom.h"
 
 define(`COUNT', 0)dnl
-define(`DO', `const XCBATOM $1 = { define(`COUNT', incr(COUNT))COUNT };')dnl
+define(`DO', `const xcb_atom_t $1 = { define(`COUNT', incr(COUNT))COUNT };')dnl
 include(atomlist.m4)`'dnl
 %}
 
@@ -16,7 +16,7 @@ include(atomlist.m4)`'dnl
 %compare-strncmp
 
 %struct-type
-struct atom_map { int name; XCBATOM value; };
+struct atom_map { int name; xcb_atom_t value; };
 %%
 define(`DO', `$1,{ define(`COUNT', incr(COUNT))COUNT }')dnl
 include(atomlist.m4)`'dnl
@@ -26,41 +26,41 @@ define(`DO', `	"$1",')dnl
 include(atomlist.m4)`'dnl
 };
 
-XCBATOM InternAtomPredefined(CARD16 name_len, const char *name)
+xcb_atom_t intern_atom_predefined(uint16_t name_len, const char *name)
 {
 	const struct atom_map *value = in_word_set(name, name_len);
-	XCBATOM ret = { XCBNone };
+	xcb_atom_t ret = { XCB_NONE };
 	if(value)
 		ret = value->value;
 	return ret;
 }
 
-InternAtomFastCookie InternAtomFast(XCBConnection *c, BOOL only_if_exists, CARD16 name_len, const char *name)
+intern_atom_fast_cookie_t intern_atom_fast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name)
 {
-	InternAtomFastCookie cookie;
+	intern_atom_fast_cookie_t cookie;
 
-	if((cookie.u.atom = InternAtomPredefined(name_len, name)).xid != XCBNone)
+	if((cookie.u.atom = intern_atom_predefined(name_len, name)).xid != XCB_NONE)
 	{
 		cookie.tag = TAG_VALUE;
 		return cookie;
 	}
 
 	cookie.tag = TAG_COOKIE;
-	cookie.u.cookie = XCBInternAtom(c, only_if_exists, name_len, name);
+	cookie.u.cookie = xcb_intern_atom(c, only_if_exists, name_len, name);
 	return cookie;
 }
 
-XCBATOM InternAtomFastReply(XCBConnection *c, InternAtomFastCookie cookie, XCBGenericError **e)
+xcb_atom_t intern_atom_fast_reply(xcb_connection_t *c, intern_atom_fast_cookie_t cookie, xcb_generic_error_t **e)
 {
 	switch(cookie.tag)
 	{
-		XCBInternAtomRep *reply;
+		xcb_intern_atom_reply_t *reply;
 	case TAG_VALUE:
 		if(e)
 			*e = 0;
 		break;
 	case TAG_COOKIE:
-		reply = XCBInternAtomReply(c, cookie.u.cookie, e);
+		reply = xcb_intern_atom_reply(c, cookie.u.cookie, e);
 		if(reply)
 		{
 			cookie.u.atom = reply->atom;
@@ -73,35 +73,35 @@ XCBATOM InternAtomFastReply(XCBConnectio
 	return cookie.u.atom;
 }
 
-const char *GetAtomNamePredefined(XCBATOM atom)
+const char *get_atom_name_predefined(xcb_atom_t atom)
 {
 	if(atom.xid <= 0 || atom.xid > (sizeof(atom_names) / sizeof(*atom_names)))
 		return 0;
 	return atom_names[atom.xid - 1];
 }
 
-int GetAtomName(XCBConnection *c, XCBATOM atom, const char **namep, int *lengthp)
+int get_atom_name(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp)
 {
 	static char buf[100];
-	const char *name = GetAtomNamePredefined(atom);
+	const char *name = get_atom_name_predefined(atom);
 	int len;
-	XCBGetAtomNameCookie atomc;
-	XCBGetAtomNameRep *atomr;
+	xcb_get_atom_name_cookie_t atomc;
+	xcb_get_atom_name_reply_t *atomr;
 	if(name)
 	{
 		*namep = name;
 		*lengthp = strlen(name);
 		return 1;
 	}
-	atomc = XCBGetAtomName(c, atom);
-	atomr = XCBGetAtomNameReply(c, atomc, 0);
+	atomc = xcb_get_atom_name(c, atom);
+	atomr = xcb_get_atom_name_reply(c, atomc, 0);
 	if(!atomr)
 		return 0;
-	len = XCBGetAtomNameNameLength(atomr);
+	len = xcb_get_atom_name_name_length(atomr);
 	if(len > sizeof(buf))
 		len = sizeof(buf);
 	*lengthp = len;
-	memcpy(buf, XCBGetAtomNameName(atomr), len);
+	memcpy(buf, xcb_get_atom_name_name(atomr), len);
 	*namep = buf;
 	free(atomr);
 	return 1;
diff --git a/xcb-util/atom/xcb_atom.h.m4 b/xcb-util/atom/xcb_atom.h.m4
index 7a88cfc..b5f0f5d 100644
--- a/xcb-util/atom/xcb_atom.h.m4
+++ b/xcb-util/atom/xcb_atom.h.m4
@@ -8,19 +8,19 @@ enum tag_t {
 typedef struct {
 	enum tag_t tag;
 	union {
-		XCBInternAtomCookie cookie;
-		XCBATOM atom;
+		xcb_intern_atom_cookie_t cookie;
+		xcb_atom_t atom;
 	} u;
 } InternAtomFastCookie;
 
-XCBATOM InternAtomPredefined(CARD16 name_len, const char *name);
-InternAtomFastCookie InternAtomFast(XCBConnection *c, BOOL only_if_exists, CARD16 name_len, const char *name);
-XCBATOM InternAtomFastReply(XCBConnection *c, InternAtomFastCookie cookie, XCBGenericError **e);
+xcb_atom_t InternAtomPredefined(uint16_t name_len, const char *name);
+InternAtomFastCookie InternAtomFast(xcb_connection_t *c, uint8_t only_if_exists, uint16_t name_len, const char *name);
+xcb_atom_t InternAtomFastReply(xcb_connection_t *c, InternAtomFastCookie cookie, xcb_generic_error_t **e);
 
-const char *GetAtomNamePredefined(XCBATOM atom);
-int GetAtomName(XCBConnection *c, XCBATOM atom, const char **namep, int *lengthp);
+const char *GetAtomNamePredefined(xcb_atom_t atom);
+int GetAtomName(xcb_connection_t *c, xcb_atom_t atom, const char **namep, int *lengthp);
 
-define(`DO', `extern const XCBATOM $1;')dnl
+define(`DO', `extern const xcb_atom_t $1;')dnl
 include(atomlist.m4)`'dnl
 
 #endif /* ATOMS_H */
diff --git a/xcb-util/convenient/xcb_aux.c b/xcb-util/convenient/xcb_aux.c
index 93f7215..35fd956 100644
--- a/xcb-util/convenient/xcb_aux.c
+++ b/xcb-util/convenient/xcb_aux.c
@@ -6,16 +6,16 @@
 
 /* Connection related functions */
 
-CARD8
-XCBAuxGetDepth (XCBConnection *c,
-		XCBSCREEN     *screen)
-{
-  XCBDRAWABLE        drawable;
-  XCBGetGeometryRep *geom;
-  int                depth;
+uint8_t
+xcb_aux_get_depth (xcb_connection_t *c,
+                   xcb_screen_t     *screen)
+{
+  xcb_drawable_t            drawable;
+  xcb_get_geometry_reply_t *geom;
+  int                       depth;
 
   drawable.window = screen->root;
-  geom = XCBGetGeometryReply (c, XCBGetGeometry(c, drawable), 0);
+  geom = xcb_get_geometry_reply (c, xcb_get_geometry(c, drawable), 0);
 
   if (!geom) {
     perror ("GetGeometry(root) failed");
@@ -28,35 +28,35 @@ XCBAuxGetDepth (XCBConnection *c,
   return depth;
 }
 
-XCBSCREEN *
-XCBAuxGetScreen (XCBConnection *c,
-		 int            screen)
+xcb_screen_t *
+xcb_aux_get_screen (xcb_connection_t *c,
+                    int               screen)
 {
-  XCBSCREENIter i = XCBSetupRootsIter(XCBGetSetup(c));
-  for (; i.rem; --screen, XCBSCREENNext(&i))
+  xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(c));
+  for (; i.rem; --screen, xcb_screen_next(&i))
     if (screen == 0)
       return i.data;
   return 0;
 }
 
-XCBVISUALTYPE *
-XCBAuxGetVisualtype (XCBConnection *c,
-		     int            scr,
-		     XCBVISUALID    vid)
-{
-  XCBSCREEN        *screen;
-  XCBDEPTH         *depth;
-  XCBVISUALTYPEIter iter;
+xcb_visualtype_t *
+xcb_aux_get_visualtype (xcb_connection_t *c,
+                        int               scr,
+                        xcb_visualid_t    vid)
+{
+  xcb_screen_t        *screen;
+  xcb_depth_t         *depth;
+  xcb_visualtype_iterator_t iter;
   int               cur;
 
-  screen = XCBAuxGetScreen (c, scr);
+  screen = xcb_aux_get_screen (c, scr);
   if (!screen) return NULL;
 
-  depth = XCBSCREENAllowedDepthsIter(screen).data;
+  depth = xcb_screen_allowed_depths_iterator(screen).data;
   if (!depth) return NULL;
    
-   iter = XCBDEPTHVisualsIter(depth);
-   for (cur = 0 ; cur < iter.rem ; XCBVISUALTYPENext(&iter), ++cur)
+   iter = xcb_depth_visuals_iterator(depth);
+   for (cur = 0 ; cur < iter.rem ; xcb_visualtype_next(&iter), ++cur)
       if (vid.id == iter.data->visual_id.id)
 	 return iter.data;
 
@@ -64,100 +64,100 @@ XCBAuxGetVisualtype (XCBConnection *c,
 }
 
 void
-XCBAuxSync (XCBConnection *c)
+xcb_aux_sync (xcb_connection_t *c)
 {
-    free(XCBGetInputFocusReply(c, XCBGetInputFocus(c), NULL));
+    free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL));
 }
 
 /* structs instead of value lists */
 /* TODO: generate the struct types and functions from protocol masks and descriptions */
 
 /* This generic implementation of pack_list depends on:
-   a) structs packed to CARD32 size
-   b) structs consist of just CARD32/INT32 fields in the same order as bitmask
+   a) structs packed to uint32_t size
+   b) structs consist of just uint32_t/int32_t fields in the same order as bitmask
 */
 
 static void
-pack_list( CARD32 mask, const CARD32 *src, CARD32 *dest )
+pack_list( uint32_t mask, const uint32_t *src, uint32_t *dest )
 {
 	for ( ; mask; mask >>= 1, src++)
 		if (mask & 1)
 			*dest++ = *src;
 }
 
-XCBVoidCookie
-XCBAuxCreateWindow (XCBConnection *c,
-                 CARD8          depth,
-                 XCBWINDOW      wid,
-                 XCBWINDOW      parent,
-                 INT16          x,
-                 INT16          y,
-                 CARD16         width,
-                 CARD16         height,
-                 CARD16         border_width,
-                 CARD16         _class,
-                 XCBVISUALID    visual,
-                 CARD32         mask,
-                 const XCBParamsCW *params)
-{
-	CARD32 value_list[16];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBCreateWindow(c, depth, wid, parent,
+xcb_void_cookie_t
+xcb_aux_create_window (xcb_connection_t       *c,
+                       uint8_t                depth,
+                       xcb_window_t           wid,
+                       xcb_window_t           parent,
+                       int16_t                x,
+                       int16_t                y,
+                       uint16_t               width,
+                       uint16_t               height,
+                       uint16_t               border_width,
+                       uint16_t               _class,
+                       xcb_visualid_t         visual,
+                       uint32_t               mask,
+                       const xcb_params_cw_t *params)
+{
+	uint32_t value_list[16];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_create_window(c, depth, wid, parent,
 		x, y, width, height, border_width,
 		_class, visual, mask, value_list);
 }
 
-XCBVoidCookie
-XCBAuxChangeWindowAttributes (XCBConnection *c,
-                           XCBWINDOW      window,
-                           CARD32         mask,
-                           const XCBParamsCW *params)
-{
-	CARD32 value_list[16];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBChangeWindowAttributes( c, window, mask, value_list );
-}
-
-XCBVoidCookie
-XCBAuxConfigureWindow (XCBConnection *c,
-                    XCBWINDOW      window,
-                    CARD16         mask,
-                    const XCBParamsConfigureWindow *params)
-{
-	CARD32 value_list[8];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBConfigureWindow( c, window, mask, value_list );
-}
-
-XCBVoidCookie
-XCBAuxCreateGC (XCBConnection *c,
-             XCBGCONTEXT    gid,
-             XCBDRAWABLE    drawable,
-             CARD32         mask,
-             const XCBParamsGC *params)
-{
-	CARD32 value_list[32];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBCreateGC( c, gid, drawable, mask, value_list );
-}
-
-XCBVoidCookie
-XCBAuxChangeGC (XCBConnection *c,
-             XCBGCONTEXT    gc,
-             CARD32         mask,
-             const XCBParamsGC *params)
-{
-	CARD32 value_list[32];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBChangeGC( c, gc, mask, value_list );
-}
-
-XCBVoidCookie
-XCBAuxChangeKeyboardControl (XCBConnection *c,
-                          CARD32         mask,
-                          const XCBParamsKeyboard *params)
-{
-	CARD32 value_list[16];
-	pack_list(mask, (const CARD32 *)params, value_list);
-	return XCBChangeKeyboardControl( c, mask, value_list );
+xcb_void_cookie_t
+xcb_aux_change_window_attributes (xcb_connection_t      *c,
+                                  xcb_window_t           window,
+                                  uint32_t               mask,
+                                  const xcb_params_cw_t *params)
+{
+	uint32_t value_list[16];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_change_window_attributes( c, window, mask, value_list );
+}
+
+xcb_void_cookie_t
+xcb_aux_configure_window (xcb_connection_t                    *c,
+                          xcb_window_t                         window,
+                          uint16_t                             mask,
+                          const xcb_params_configure_window_t *params)
+{
+	uint32_t value_list[8];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_configure_window( c, window, mask, value_list );
+}
+
+xcb_void_cookie_t
+xcb_aux_create_gc (xcb_connection_t      *c,
+                   xcb_gcontext_t         gid,
+                   xcb_drawable_t         drawable,
+                   uint32_t               mask,
+                   const xcb_params_gc_t *params)
+{
+	uint32_t value_list[32];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_create_gc( c, gid, drawable, mask, value_list );
+}
+
+xcb_void_cookie_t
+xcb_aux_change_gc (xcb_connection_t     *c,
+                   xcb_gcontext_t        gc,
+                   uint32_t              mask,
+                   const xcb_params_gc_t *params)
+{
+	uint32_t value_list[32];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_change_gc( c, gc, mask, value_list );
+}
+
+xcb_void_cookie_t
+xcb_aux_change_keyboard_control (xcb_connection_t            *c,
+                                 uint32_t                     mask,
+                                 const xcb_params_keyboard_t *params)
+{
+	uint32_t value_list[16];
+	pack_list(mask, (const uint32_t *)params, value_list);
+	return xcb_change_keyboard_control( c, mask, value_list );
 }
diff --git a/xcb-util/convenient/xcb_aux.h b/xcb-util/convenient/xcb_aux.h
index 0699035..7032056 100644
--- a/xcb-util/convenient/xcb_aux.h
+++ b/xcb-util/convenient/xcb_aux.h
@@ -7,129 +7,129 @@ extern "C" {
 #endif
 
 
-CARD8          XCBAuxGetDepth      (XCBConnection *c,
-				    XCBSCREEN     *screen);
+uint8_t          xcb_aux_get_depth       (xcb_connection_t *c,
+                                          xcb_screen_t     *screen);
 
-XCBSCREEN     *XCBAuxGetScreen     (XCBConnection *c,
-				    int            screen);
+xcb_screen_t     *xcb_aux_get_screen     (xcb_connection_t *c,
+                                          int               screen);
 
-XCBVISUALTYPE *XCBAuxGetVisualtype (XCBConnection *c,
-				    int            screen,
-				    XCBVISUALID    vid);
+xcb_visualtype_t *xcb_aux_get_visualtype (xcb_connection_t *c,
+                                          int               screen,
+                                          xcb_visualid_t    vid);
 
-void           XCBAuxSync          (XCBConnection *c);
+void           xcb_aux_sync              (xcb_connection_t *c);
 
 /* less error prone to use structs instead of value lists */
 
 typedef struct {
-    CARD32 back_pixmap;
-    CARD32 back_pixel;
-    CARD32 border_pixmap;
-    CARD32 border_pixel;
-    CARD32 bit_gravity;
-    CARD32 win_gravity;
-    CARD32 backing_store;
-    CARD32 backing_planes;
-    CARD32 backing_pixel;
-    CARD32 override_redirect;
-    CARD32 save_under;
-    CARD32 event_mask;
-    CARD32 dont_propagate;
-    CARD32 colormap;
-    CARD32 cursor;
-} XCBParamsCW;
-
-XCBVoidCookie
-XCBAuxCreateWindow (XCBConnection *c,
-                 CARD8          depth,
-                 XCBWINDOW      wid,
-                 XCBWINDOW      parent,
-                 INT16          x,
-                 INT16          y,
-                 CARD16         width,
-                 CARD16         height,
-                 CARD16         border_width,
-                 CARD16         _class,
-                 XCBVISUALID    visual,
-                 CARD32         mask,
-                 const XCBParamsCW *params);
-
-XCBVoidCookie
-XCBAuxChangeWindowAttributes (XCBConnection *c,
-                           XCBWINDOW      window,
-                           CARD32         mask,
-                           const XCBParamsCW *params);
+    uint32_t back_pixmap;
+    uint32_t back_pixel;
+    uint32_t border_pixmap;
+    uint32_t border_pixel;
+    uint32_t bit_gravity;
+    uint32_t win_gravity;
+    uint32_t backing_store;
+    uint32_t backing_planes;
+    uint32_t backing_pixel;
+    uint32_t override_redirect;
+    uint32_t save_under;
+    uint32_t event_mask;
+    uint32_t dont_propagate;
+    uint32_t colormap;
+    uint32_t cursor;
+} xcb_params_cw_t;
+
+xcb_void_cookie_t
+xcb_aux_create_window (xcb_connection_t      *c,
+                       uint8_t                depth,
+                       xcb_window_t           wid,
+                       xcb_window_t           parent,
+                       int16_t                x,
+                       int16_t                y,
+                       uint16_t               width,
+                       uint16_t               height,
+                       uint16_t               border_width,
+                       uint16_t               _class,
+                       xcb_visualid_t         visual,
+                       uint32_t               mask,
+                       const xcb_params_cw_t *params);
+
+xcb_void_cookie_t
+xcb_aux_change_window_attributes (xcb_connection_t      *c,
+                                  xcb_window_t           window,
+                                  uint32_t               mask,
+                                  const xcb_params_cw_t *params);
 
 typedef struct {
-    INT32  x;
-    INT32  y;
-    CARD32 width;
-    CARD32 height;
-    CARD32 border_width;
-    CARD32 sibling;
-    CARD32 stack_mode;
-} XCBParamsConfigureWindow;
-
-XCBVoidCookie
-XCBAuxConfigureWindow (XCBConnection *c,
-                    XCBWINDOW      window,
-                    CARD16         mask,
-                    const XCBParamsConfigureWindow *params);
+    int32_t  x;
+    int32_t  y;
+    uint32_t width;
+    uint32_t height;
+    uint32_t border_width;
+    uint32_t sibling;
+    uint32_t stack_mode;
+} xcb_params_configure_window_t;
+
+xcb_void_cookie_t
+xcb_aux_configure_window (xcb_connection_t                    *c,
+                          xcb_window_t                         window,
+                          uint16_t                             mask,
+                          const xcb_params_configure_window_t *params);
 
 typedef struct {
-    CARD32 function;
-    CARD32 plane_mask;
-    CARD32 foreground;
-    CARD32 background;
-    CARD32 line_width;
-    CARD32 line_style;
-    CARD32 cap_style;
-    CARD32 join_style;
-    CARD32 fill_style;
-    CARD32 fill_rule;
-    CARD32 tile;
-    CARD32 stipple;
-    CARD32 tile_stipple_originX;
-    CARD32 tile_stipple_originY;
-    CARD32 font;
-    CARD32 subwindow_mode;
-    CARD32 graphics_exposures;
-    CARD32 clip_originX;
-    CARD32 clip_originY;
-    CARD32 mask;
-    CARD32 dash_offset;
-    CARD32 dash_list;
-    CARD32 arc_mode;
-} XCBParamsGC;
-
-XCBVoidCookie
-XCBAuxCreateGC (XCBConnection *c,
-             XCBGCONTEXT    cid,
-             XCBDRAWABLE    drawable,
-             CARD32         mask,
-             const XCBParamsGC *params);
-
-XCBVoidCookie
-XCBAuxChangeGC (XCBConnection *c,
-             XCBGCONTEXT    gc,
-             CARD32         mask,
-             const XCBParamsGC *params);
+    uint32_t function;
+    uint32_t plane_mask;
+    uint32_t foreground;
+    uint32_t background;
+    uint32_t line_width;
+    uint32_t line_style;
+    uint32_t cap_style;
+    uint32_t join_style;
+    uint32_t fill_style;
+    uint32_t fill_rule;
+    uint32_t tile;
+    uint32_t stipple;
+    uint32_t tile_stipple_originX;
+    uint32_t tile_stipple_originY;
+    uint32_t font;
+    uint32_t subwindow_mode;
+    uint32_t graphics_exposures;
+    uint32_t clip_originX;
+    uint32_t clip_originY;
+    uint32_t mask;
+    uint32_t dash_offset;
+    uint32_t dash_list;
+    uint32_t arc_mode;
+} xcb_params_gc_t;
+
+xcb_void_cookie_t
+xcb_aux_create_gc (xcb_connection_t      *c,
+                   xcb_gcontext_t         cid,
+                   xcb_drawable_t         drawable,
+                   uint32_t               mask,
+                   const xcb_params_gc_t *params);
+
+xcb_void_cookie_t
+xcb_aux_change_gc (xcb_connection_t      *c,
+                   xcb_gcontext_t         gc,
+                   uint32_t               mask,
+                   const xcb_params_gc_t *params);
 
 typedef struct {
-    CARD32 key_click_percent;
-    CARD32 bell_percent;
-    CARD32 bell_pitch;
-    CARD32 bell_duration;
-    CARD32 led;
-    CARD32 led_mode;
-    CARD32 key;
-    CARD32 auto_repeat_mode;
-} XCBParamsKeyboard;
-
-XCBVoidCookie
-XCBAuxChangeKeyboardControl (XCBConnection *c,
-                          CARD32         mask,
-                          const XCBParamsKeyboard *params);
+    uint32_t key_click_percent;
+    uint32_t bell_percent;
+    uint32_t bell_pitch;
+    uint32_t bell_duration;
+    uint32_t led;
+    uint32_t led_mode;
+    uint32_t key;
+    uint32_t auto_repeat_mode;
+} xcb_params_keyboard_t;
+
+xcb_void_cookie_t
+xcb_aux_change_keyboard_control (xcb_connection_t            *c,
+                                 uint32_t                     mask,
+                                 const xcb_params_keyboard_t *params);
 
 
 #ifdef __cplusplus
diff --git a/xcb-util/event/events.c b/xcb-util/event/events.c
index 6649eee..f7d4fed 100644
--- a/xcb-util/event/events.c
+++ b/xcb-util/event/events.c
@@ -3,36 +3,37 @@
 
 #include "xcb_event.h"
 
-typedef struct {
-	GenericEventHandler handler;
+typedef struct event_handler event_handler_t;
+struct event_handler {
+	generic_event_handler handler;
 	void *data;
-} EventHandler;
+};
 
-struct EventHandlers {
-	EventHandler event[126];
-	EventHandler error[256];
-	XCBConnection *c;
+struct event_handlers {
+	event_handler_t event[126];
+	event_handler_t error[256];
+	xcb_connection_t *c;
 };
 
-EventHandlers *allocEventHandlers(XCBConnection *c)
+event_handlers_t *alloc_event_handlers(xcb_connection_t *c)
 {
-	EventHandlers *ret = calloc(1, sizeof(EventHandlers));
+	event_handlers_t *ret = calloc(1, sizeof(event_handlers_t));
 	if(ret)
 		ret->c = c;
 	return ret;
 }
 
-void freeEventHandlers(EventHandlers *evenths)
+void free_event_handlers(event_handlers_t *evenths)
 {
 	free(evenths);
 }
 
-XCBConnection *getXCBConnection(EventHandlers *evenths)
+xcb_connection_t *get_xcb_connection(event_handlers_t *evenths)
 {
 	return evenths->c;
 }
 
-static EventHandler *getEventHandler(EventHandlers *evenths, int event)
+static event_handler_t *get_event_handler(event_handlers_t *evenths, int event)
 {
 	assert(event < 256);
 	event &= 0x7f;
@@ -40,49 +41,49 @@ static EventHandler *getEventHandler(Eve
 	return &evenths->event[event - 2];
 }
 
-static EventHandler *getErrorHandler(EventHandlers *evenths, int error)
+static event_handler_t *get_error_handler(event_handlers_t *evenths, int error)
 {
 	assert(error >= 0 && error < 256);
 	return &evenths->error[error];
 }
 
-static int handleEvent(EventHandlers *evenths, XCBGenericEvent *event)
+static int handle_event(event_handlers_t *evenths, xcb_generic_event_t *event)
 {
-	EventHandler *eventh = 0;
+	event_handler_t *eventh = 0;
 	assert(event->response_type != 1);
 
 	if(event->response_type == 0)
-		eventh = getErrorHandler(evenths, ((XCBGenericError *) event)->error_code);
+		eventh = get_error_handler(evenths, ((xcb_generic_error_t *) event)->error_code);
 	else
-		eventh = getEventHandler(evenths, event->response_type);
+		eventh = get_event_handler(evenths, event->response_type);
 
 	if(eventh->handler)
 		return eventh->handler(eventh->data, evenths->c, event);
 	return 0;
 }
 
-void eventLoop(EventHandlers *evenths)
+void event_loop(event_handlers_t *evenths)
 {
-	XCBGenericEvent *event;
-	while((event = XCBWaitForEvent(evenths->c)))
+	xcb_generic_event_t *event;
+	while((event = xcb_wait_for_event(evenths->c)))
 	{
-		handleEvent(evenths, event);
+		handle_event(evenths, event);
 		free(event);
 	}
 }
 
-static void setHandler(GenericEventHandler handler, void *data, EventHandler *place)
+static void set_handler(generic_event_handler handler, void *data, event_handler_t *place)
 {
-	EventHandler eventh = { handler, data };
+	event_handler_t eventh = { handler, data };
 	*place = eventh;
 }
 
-void setEventHandler(EventHandlers *evenths, int event, GenericEventHandler handler, void *data)
+void set_event_handler(event_handlers_t *evenths, int event, generic_event_handler handler, void *data)
 {
-	setHandler(handler, data, getEventHandler(evenths, event));
+	set_handler(handler, data, get_event_handler(evenths, event));
 }
 
-void setErrorHandler(EventHandlers *evenths, int error, GenericErrorHandler handler, void *data)
+void set_error_handler(event_handlers_t *evenths, int error, generic_error_handler handler, void *data)
 {
-	setHandler((GenericEventHandler) handler, data, getErrorHandler(evenths, error));
+	set_handler((generic_event_handler) handler, data, get_error_handler(evenths, error));
 }
diff --git a/xcb-util/event/xcb_event.h b/xcb-util/event/xcb_event.h
index 84b7f04..1042066 100644
--- a/xcb-util/event/xcb_event.h
+++ b/xcb-util/event/xcb_event.h
@@ -9,58 +9,58 @@ extern "C" {
 #endif
 
 
-typedef struct EventHandlers EventHandlers;
-EventHandlers *allocEventHandlers(XCBConnection *c);
-void freeEventHandlers(EventHandlers *evenths);
-XCBConnection *getXCBConnection(EventHandlers *evenths);
+typedef struct event_handlers event_handlers_t;
+event_handlers_t *alloc_event_handlers(xcb_connection_t *c);
+void free_event_handlers(event_handlers_t *evenths);
+xcb_connection_t *get_xcb_connection(event_handlers_t *evenths);
 
-void eventLoop(EventHandlers *evenths);
+void event_loop(event_handlers_t *evenths);
 
-typedef int (*GenericEventHandler)(void *data, XCBConnection *c, XCBGenericEvent *event);
-typedef int (*GenericErrorHandler)(void *data, XCBConnection *c, XCBGenericError *error);
+typedef int (*generic_event_handler)(void *data, xcb_connection_t *c, xcb_generic_event_t *event);
+typedef int (*generic_error_handler)(void *data, xcb_connection_t *c, xcb_generic_error_t *error);
 
-void setEventHandler(EventHandlers *evenths, int event, GenericEventHandler handler, void *data);
-void setErrorHandler(EventHandlers *evenths, int error, GenericErrorHandler handler, void *data);
+void set_event_handler(event_handlers_t *evenths, int event, generic_event_handler handler, void *data);
+void set_error_handler(event_handlers_t *evenths, int error, generic_error_handler handler, void *data);
 
-#define MAKE_HANDLER(cls,kind) \
-static inline void set##kind##cls##Handler(EventHandlers *evenths, int (*handler)(void *, XCBConnection *, XCB##kind##cls *), void *data) \
+#define MAKE_HANDLER(cls,lkind, ukind) \
+static inline void set_##lkind##_##cls##_handler(event_handlers_t *evenths, int (*handler)(void *, xcb_connection_t *, xcb_##lkind##_##cls##_t *), void *data) \
 { \
-	set##cls##Handler(evenths, XCB##kind, (GenericEventHandler) handler, data); \
+	set_##cls##_handler(evenths, XCB_##ukind, (generic_event_handler) handler, data); \
 }
 
-MAKE_HANDLER(Event, KeyPress)
-MAKE_HANDLER(Event, KeyRelease)
-MAKE_HANDLER(Event, ButtonPress)
-MAKE_HANDLER(Event, ButtonRelease)
-MAKE_HANDLER(Event, MotionNotify)
-MAKE_HANDLER(Event, EnterNotify)
-MAKE_HANDLER(Event, LeaveNotify)
-MAKE_HANDLER(Event, FocusIn)
-MAKE_HANDLER(Event, FocusOut)
-MAKE_HANDLER(Event, KeymapNotify)
-MAKE_HANDLER(Event, Expose)
-MAKE_HANDLER(Event, GraphicsExposure)
-MAKE_HANDLER(Event, NoExposure)
-MAKE_HANDLER(Event, VisibilityNotify)
-MAKE_HANDLER(Event, CreateNotify)
-MAKE_HANDLER(Event, DestroyNotify)
-MAKE_HANDLER(Event, UnmapNotify)
-MAKE_HANDLER(Event, MapNotify)
-MAKE_HANDLER(Event, MapRequest)
-MAKE_HANDLER(Event, ReparentNotify)
-MAKE_HANDLER(Event, ConfigureNotify)
-MAKE_HANDLER(Event, ConfigureRequest)
-MAKE_HANDLER(Event, GravityNotify)
-MAKE_HANDLER(Event, ResizeRequest)
-MAKE_HANDLER(Event, CirculateNotify)
-MAKE_HANDLER(Event, CirculateRequest)
-MAKE_HANDLER(Event, PropertyNotify)
-MAKE_HANDLER(Event, SelectionClear)
-MAKE_HANDLER(Event, SelectionRequest)
-MAKE_HANDLER(Event, SelectionNotify)
-MAKE_HANDLER(Event, ColormapNotify)
-MAKE_HANDLER(Event, ClientMessage)
-MAKE_HANDLER(Event, MappingNotify)
+MAKE_HANDLER(event, key_press, KEY_PRESS)
+MAKE_HANDLER(event, key_release, KEY_RELEASE)
+MAKE_HANDLER(event, button_press, BUTTON_PRESS)
+MAKE_HANDLER(event, button_release, BUTTON_RELEASE)
+MAKE_HANDLER(event, motion_notify, MOTION_NOTIFY)
+MAKE_HANDLER(event, enter_notify, ENTER_NOTIFY)
+MAKE_HANDLER(event, leave_notify, LEAVE_NOTIFY)
+MAKE_HANDLER(event, focus_in, FOCUS_IN)
+MAKE_HANDLER(event, focus_out, FOCUS_OUT)
+MAKE_HANDLER(event, keymap_notify, KEYMAP_NOTIFY)
+MAKE_HANDLER(event, expose, EXPOSE)
+MAKE_HANDLER(event, graphics_exposure, GRAPHICS_EXPOSURE)
+MAKE_HANDLER(event, no_exposure, NO_EXPOSURE)
+MAKE_HANDLER(event, visibility_notify, VISIBILITY_NOTIFY)
+MAKE_HANDLER(event, create_notify, CREATE_NOTIFY)
+MAKE_HANDLER(event, destroy_notify, DESTROY_NOTIFY)
+MAKE_HANDLER(event, unmap_notify, UNMAP_NOTIFY)
+MAKE_HANDLER(event, map_notify, MAP_NOTIFY)
+MAKE_HANDLER(event, map_request, MAP_REQUEST)
+MAKE_HANDLER(event, reparent_notify, REPARENT_NOTIFY)
+MAKE_HANDLER(event, configure_notify, CONFIGURE_NOTIFY)
+MAKE_HANDLER(event, configure_request, CONFIGURE_REQUEST)
+MAKE_HANDLER(event, gravity_notify, GRAVITY_NOTIFY)
+MAKE_HANDLER(event, resize_request, RESIZE_REQUEST)
+MAKE_HANDLER(event, circulate_notify, CIRCULATE_NOTIFY)
+MAKE_HANDLER(event, circulate_request, CIRCULATE_REQUEST)
+MAKE_HANDLER(event, property_notify, PROPERTY_NOTIFY)
+MAKE_HANDLER(event, selection_clear, SELECTION_CLEAR)
+MAKE_HANDLER(event, selection_request, SELECTION_REQUEST)
+MAKE_HANDLER(event, selection_notify, SELECTION_NOTIFY)
+MAKE_HANDLER(event, colormap_notify, COLORMAP_NOTIFY)
+MAKE_HANDLER(event, client_message, CLIENT_MESSAGE)
+MAKE_HANDLER(event, mapping_notify, MAPPING_NOTIFY)
 
 
 #ifdef __cplusplus
diff --git a/xcb-util/icccm/icccm.c b/xcb-util/icccm/icccm.c
index 67b8eac..9476d7d 100644
--- a/xcb-util/icccm/icccm.c
+++ b/xcb-util/icccm/icccm.c
@@ -5,33 +5,33 @@
 
 
 static int
-GetTextProperty(XCBConnection *c,
-                XCBWINDOW      window,
-                XCBATOM        property,
-                CARD8         *format,
-                XCBATOM       *encoding,
-                CARD32        *name_len,
+GetTextProperty(xcb_connection_t *c,
+                xcb_window_t      window,
+                xcb_atom_t        property,
+                uint8_t         *format,
+                xcb_atom_t       *encoding,
+                uint32_t        *name_len,
                 char         **name)
 {
-	XCBGetPropertyCookie cookie;
-	XCBGetPropertyRep *reply;
+	xcb_get_property_cookie_t cookie;
+	xcb_get_property_reply_t *reply;
 
-	cookie = GetAnyProperty(c, 0, window, property, 128);
-	reply = XCBGetPropertyReply(c, cookie, 0);
+	cookie = get_any_property(c, 0, window, property, 128);
+	reply = xcb_get_property_reply(c, cookie, 0);
 	if(!reply)
 		return 0;
 	*format = reply->format;
 	*encoding = reply->type;
-	*name_len = XCBGetPropertyValueLength(reply) * *format / 8;
+	*name_len = xcb_get_property_value_length(reply) * *format / 8;
 	if(reply->bytes_after)
 	{
-		cookie = XCBGetProperty(c, 0, window, property, reply->type, 0, *name_len);
+		cookie = xcb_get_property(c, 0, window, property, reply->type, 0, *name_len);
 		free(reply);
-		reply = XCBGetPropertyReply(c, cookie, 0);
+		reply = xcb_get_property_reply(c, cookie, 0);
 		if(!reply)
 			return 0;
 	}
-	memmove(reply, XCBGetPropertyValue(reply), *name_len);
+	memmove(reply, xcb_get_property_value(reply), *name_len);
 	*name = (char *) reply;
 	return 1;
 }
@@ -39,97 +39,97 @@ GetTextProperty(XCBConnection *c,
 /* WM_NAME */
 
 void
-SetWMName (XCBConnection *c,
-	   XCBWINDOW      window,
-	   XCBATOM        encoding,
-	   CARD32         name_len,
+SetWMName (xcb_connection_t *c,
+	   xcb_window_t      window,
+	   xcb_atom_t        encoding,
+	   uint32_t         name_len,
 	   const char    *name)
 {
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_NAME, encoding, 8, name_len, name);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_NAME, encoding, 8, name_len, name);
 }
 
 int
-GetWMName (XCBConnection *c,
-	   XCBWINDOW      window,
-	   CARD8         *format,
-	   XCBATOM       *encoding,
-	   CARD32        *name_len,
+GetWMName (xcb_connection_t *c,
+	   xcb_window_t      window,
+	   uint8_t         *format,
+	   xcb_atom_t       *encoding,
+	   uint32_t        *name_len,
 	   char         **name)
 {
 	return GetTextProperty(c, window, WM_NAME, format, encoding, name_len, name);
 }
 
 void
-WatchWMName (PropertyHandlers      *prophs,
-	     CARD32                 long_len,
-	     GenericPropertyHandler handler,
+WatchWMName (property_handlers_t      *prophs,
+	     uint32_t                 long_len,
+	     generic_property_handler handler,
 	     void                  *data)
 {
-	SetPropertyHandler(prophs, WM_NAME, long_len, handler, data);
+	set_property_handler(prophs, WM_NAME, long_len, handler, data);
 }
 
 /* WM_ICON_NAME */
 
 void
-SetWMIconName (XCBConnection *c,
-	       XCBWINDOW      window,
-	       XCBATOM        encoding,
-	       CARD32         name_len,
+SetWMIconName (xcb_connection_t *c,
+	       xcb_window_t      window,
+	       xcb_atom_t        encoding,
+	       uint32_t         name_len,
 	       const char    *name)
 {
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_ICON_NAME, encoding, 8, name_len, name);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_ICON_NAME, encoding, 8, name_len, name);
 }
 
 int
-GetWMIconName (XCBConnection *c,
-               XCBWINDOW      window,
-               CARD8         *format,
-               XCBATOM       *encoding,
-               CARD32        *name_len,
+GetWMIconName (xcb_connection_t *c,
+               xcb_window_t      window,
+               uint8_t         *format,
+               xcb_atom_t       *encoding,
+               uint32_t        *name_len,
                char         **name)
 {
 	return GetTextProperty(c, window, WM_ICON_NAME, format, encoding, name_len, name);
 }
 
 void
-WatchWMIconName (PropertyHandlers      *prophs,
-		 CARD32                 long_len,
-		 GenericPropertyHandler handler,
+WatchWMIconName (property_handlers_t      *prophs,
+		 uint32_t                 long_len,
+		 generic_property_handler handler,
 		 void                  *data)
 {
-	SetPropertyHandler(prophs, WM_ICON_NAME, long_len, handler, data);
+	set_property_handler(prophs, WM_ICON_NAME, long_len, handler, data);
 }
 
 /* WM_CLIENT_MACHINE */
 
 void
-SetWMClientMachine (XCBConnection *c,
-                    XCBWINDOW      window,
-                    XCBATOM        encoding,
-                    CARD32         name_len,
+SetWMClientMachine (xcb_connection_t *c,
+                    xcb_window_t      window,
+                    xcb_atom_t        encoding,
+                    uint32_t         name_len,
                     const char    *name)
 {
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_CLIENT_MACHINE, encoding, 8, name_len, name);
 }
 
 int
-GetWMClientMachine (XCBConnection *c,
-                    XCBWINDOW      window,
-                    CARD8         *format,
-                    XCBATOM       *encoding,
-                    CARD32        *name_len,
+GetWMClientMachine (xcb_connection_t *c,
+                    xcb_window_t      window,
+                    uint8_t         *format,
+                    xcb_atom_t       *encoding,
+                    uint32_t        *name_len,
                     char         **name)
 {
 	return GetTextProperty(c, window, WM_CLIENT_MACHINE, format, encoding, name_len, name);
 }
 
 void
-WatchWMClientMachine (PropertyHandlers      *prophs,
-                      CARD32                 long_len,
-                      GenericPropertyHandler handler,
+WatchWMClientMachine (property_handlers_t      *prophs,
+                      uint32_t                 long_len,
+                      generic_property_handler handler,
                       void                  *data)
 {
-	SetPropertyHandler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
+	set_property_handler(prophs, WM_CLIENT_MACHINE, long_len, handler, data);
 }
 
 /* WM_SIZE_HINTS */
@@ -148,15 +148,15 @@ typedef enum {
 } SizeHintsFlags;
 
 struct SizeHints {
-	CARD32 flags;
-	INT32 x, y, width, height;
-	INT32 min_width, min_height;
-	INT32 max_width, max_height;
-	INT32 width_inc, height_inc;
-	INT32 min_aspect_num, min_aspect_den;
-	INT32 max_aspect_num, max_aspect_den;
-	INT32 base_width, base_height;
-	CARD32 win_gravity;
+	uint32_t flags;
+	int32_t x, y, width, height;
+	int32_t min_width, min_height;
+	int32_t max_width, max_height;
+	int32_t width_inc, height_inc;
+	int32_t min_aspect_num, min_aspect_den;
+	int32_t max_aspect_num, max_aspect_den;
+	int32_t base_width, base_height;
+	uint32_t win_gravity;
 };
 
 SizeHints *
@@ -173,8 +173,8 @@ FreeSizeHints(SizeHints *hints)
 
 void
 SizeHintsGetPosition (SizeHints *hints,
-		      INT32     *x,
-		      INT32     *y)
+		      int32_t     *x,
+		      int32_t     *y)
 {
         *x = hints->x;
         *y = hints->y;
@@ -182,8 +182,8 @@ SizeHintsGetPosition (SizeHints *hints,
 
 void
 SizeHintsGetSize (SizeHints *hints,
-		  INT32     *width,
-		  INT32     *height)
+		  int32_t     *width,
+		  int32_t     *height)
 {
         *width = hints->width;
         *height = hints->height;
@@ -191,8 +191,8 @@ SizeHintsGetSize (SizeHints *hints,
 
 void
 SizeHintsGetMinSize (SizeHints *hints,
-		     INT32     *min_width,
-		     INT32     *min_height)
+		     int32_t     *min_width,
+		     int32_t     *min_height)
 {
         *min_width = hints->min_width;
         *min_height = hints->min_height;
@@ -200,8 +200,8 @@ SizeHintsGetMinSize (SizeHints *hints,
 
 void
 SizeHintsGetMaxSize (SizeHints *hints,
-		     INT32     *max_width,
-		     INT32     *max_height)
+		     int32_t     *max_width,
+		     int32_t     *max_height)
 {
         *max_width = hints->max_width;
         *max_height = hints->max_height;
@@ -209,8 +209,8 @@ SizeHintsGetMaxSize (SizeHints *hints,
 
 void
 SizeHintsGetIncrease (SizeHints *hints,
-		     INT32     *width_inc,
-		     INT32     *height_inc)
+		     int32_t     *width_inc,
+		     int32_t     *height_inc)
 {
         *width_inc = hints->width_inc;
         *height_inc = hints->height_inc;
@@ -218,8 +218,8 @@ SizeHintsGetIncrease (SizeHints *hints,
 
 void
 SizeHintsGetMinAspect (SizeHints *hints,
-		       INT32     *min_aspect_num,
-		       INT32     *min_aspect_den)
+		       int32_t     *min_aspect_num,
+		       int32_t     *min_aspect_den)
 {
         *min_aspect_num = hints->min_aspect_num;
         *min_aspect_den = hints->min_aspect_den;
@@ -227,8 +227,8 @@ SizeHintsGetMinAspect (SizeHints *hints,
 
 void
 SizeHintsGetMaxAspect (SizeHints *hints,
-		       INT32     *max_aspect_num,
-		       INT32     *max_aspect_den)
+		       int32_t     *max_aspect_num,
+		       int32_t     *max_aspect_den)
 {
         *max_aspect_num = hints->max_aspect_num;
         *max_aspect_den = hints->max_aspect_den;
@@ -236,74 +236,74 @@ SizeHintsGetMaxAspect (SizeHints *hints,
 
 void
 SizeHintsGetBaseSize (SizeHints *hints,
-		      INT32     *base_width,
-		      INT32     *base_height)
+		      int32_t     *base_width,
+		      int32_t     *base_height)
 {
         *base_width = hints->base_width;
         *base_height = hints->base_height;
 }
 
-CARD32
+uint32_t
 SizeHintsGetWinGravity (SizeHints *hints)
 {
         return hints->win_gravity;
 }
 
-BOOL
+uint8_t
 SizeHintsIsUSPosition (SizeHints *hints)
 {
         return (hints->flags & USPosition);
 }
 
-BOOL
+uint8_t
 SizeHintsIsUSSize (SizeHints *hints)
 {
         return (hints->flags & USSize);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPPosition (SizeHints *hints)
 {
         return (hints->flags & PPosition);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPSize (SizeHints *hints)
 {
         return (hints->flags & PSize);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPMinSize (SizeHints *hints)
 {
         return (hints->flags & PMinSize);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPMaxSize (SizeHints *hints)
 {
         return (hints->flags & PMaxSize);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPResizeInc (SizeHints *hints)
 {
         return (hints->flags & PResizeInc);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPAspect (SizeHints *hints)
 {
         return (hints->flags & PAspect);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPBaseSize (SizeHints *hints)
 {
         return (hints->flags & PBaseSize);
 }
 
-BOOL
+uint8_t
 SizeHintsIsPWinGravity (SizeHints *hints)
 {
         return (hints->flags & PWinGravity);
@@ -378,8 +378,8 @@ SizeHintsSetFlagPWinGravity (SizeHints *
 void
 SizeHintsSetPosition (SizeHints *hints,
 		      int        user_specified,
-		      INT32      x,
-		      INT32      y)
+		      int32_t      x,
+		      int32_t      y)
 {
 	hints->flags &= ~(USPosition | PPosition);
 	if (user_specified)
@@ -393,8 +393,8 @@ SizeHintsSetPosition (SizeHints *hints,
 void
 SizeHintsSetSize (SizeHints *hints,
 		  int        user_specified,
-		  INT32      width,
-		  INT32      height)
+		  int32_t      width,
+		  int32_t      height)
 {
 	hints->flags &= ~(USSize | PSize);
 	if (user_specified)
@@ -407,8 +407,8 @@ SizeHintsSetSize (SizeHints *hints,
 
 void
 SizeHintsSetMinSize (SizeHints *hints,
-		     INT32      min_width,
-		     INT32      min_height)
+		     int32_t      min_width,
+		     int32_t      min_height)
 {
 	hints->flags |= PMinSize;
 	hints->min_width = min_width;
@@ -417,8 +417,8 @@ SizeHintsSetMinSize (SizeHints *hints,
 
 void
 SizeHintsSetMaxSize (SizeHints *hints,
-		     INT32      max_width,
-		     INT32      max_height)
+		     int32_t      max_width,
+		     int32_t      max_height)
 {
 	hints->flags |= PMaxSize;
 	hints->max_width = max_width;
@@ -427,8 +427,8 @@ SizeHintsSetMaxSize (SizeHints *hints,
 
 void
 SizeHintsSetResizeInc (SizeHints *hints,
-		       INT32      width_inc,
-		       INT32      height_inc)
+		       int32_t      width_inc,
+		       int32_t      height_inc)
 {
 	hints->flags |= PResizeInc;
 	hints->width_inc = width_inc;
@@ -437,10 +437,10 @@ SizeHintsSetResizeInc (SizeHints *hints,
 
 void
 SizeHintsSetAspect (SizeHints *hints,
-		    INT32      min_aspect_num,
-		    INT32      min_aspect_den,
-		    INT32      max_aspect_num,
-		    INT32      max_aspect_den)
+		    int32_t      min_aspect_num,
+		    int32_t      min_aspect_den,
+		    int32_t      max_aspect_num,
+		    int32_t      max_aspect_den)
 {
 	hints->flags |= PAspect;
 	hints->min_aspect_num = min_aspect_num;
@@ -451,8 +451,8 @@ SizeHintsSetAspect (SizeHints *hints,
 
 void
 SizeHintsSetBaseSize (SizeHints *hints,
-		      INT32      base_width,
-		      INT32      base_height)
+		      int32_t      base_width,
+		      int32_t      base_height)
 {
 	hints->flags |= PBaseSize;
 	hints->base_width = base_width;
@@ -461,35 +461,35 @@ SizeHintsSetBaseSize (SizeHints *hints,
 
 void
 SizeHintsSetWinGravity (SizeHints *hints,
-			CARD8      win_gravity)
+			uint8_t      win_gravity)
 {
 	hints->flags |= PWinGravity;
 	hints->win_gravity = win_gravity;
 }
 
 void
-SetWMSizeHints (XCBConnection *c,
-		XCBWINDOW      window,
-		XCBATOM        property,
+SetWMSizeHints (xcb_connection_t *c,
+		xcb_window_t      window,
+		xcb_atom_t        property,
 		SizeHints     *hints)
 {
-	XCBChangeProperty(c, XCBPropModeReplace, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, property, WM_SIZE_HINTS, 32, sizeof(*hints) / 4, hints);
 }
 
 int
-GetWMSizeHints (XCBConnection *c,
-		XCBWINDOW      window,
-		XCBATOM        property,
+GetWMSizeHints (xcb_connection_t *c,
+		xcb_window_t      window,
+		xcb_atom_t        property,
 		SizeHints     *hints,
 		long          *supplied)
 {
-        XCBGetPropertyCookie cookie;
-	XCBGetPropertyRep   *rep;
+        xcb_get_property_cookie_t cookie;
+	xcb_get_property_reply_t   *rep;
 
-	cookie = XCBGetProperty (c, 0, window,
+	cookie = xcb_get_property (c, 0, window,
 				 property, WM_SIZE_HINTS,
 				 0L, 18); /* NumPropSizeElements = 18 (ICCCM version 1) */
-	rep = XCBGetPropertyReply (c, cookie, 0);
+	rep = xcb_get_property_reply (c, cookie, 0);
 	if (!rep)
 	        return 0;
 
@@ -502,11 +502,11 @@ GetWMSizeHints (XCBConnection *c,
                 char *prop;
 	        long  length;
 
-		length = XCBGetPropertyValueLength (rep);
+		length = xcb_get_property_value_length (rep);
 		/* FIXME: in GetProp.c of xcl, one move the memory.
 		 * Should we do that too ? */
 		prop = (char *)malloc(sizeof(char)*length);
-		memcpy(prop, XCBGetPropertyValue (rep), length);
+		memcpy(prop, xcb_get_property_value (rep), length);
 		prop[length] = '\0';
 		hints = (SizeHints *)strdup (prop);
 
@@ -538,16 +538,16 @@ GetWMSizeHints (XCBConnection *c,
 /* WM_NORMAL_HINTS */
 
 void
-SetWMNormalHints (XCBConnection *c,
-		  XCBWINDOW      window,
+SetWMNormalHints (xcb_connection_t *c,
+		  xcb_window_t      window,
 		  SizeHints     *hints)
 {
 	SetWMSizeHints(c, window, WM_NORMAL_HINTS, hints);
 }
 
 int
-GetWMNormalHints (XCBConnection *c,
-		  XCBWINDOW      window,
+GetWMNormalHints (xcb_connection_t *c,
+		  xcb_window_t      window,
 		  SizeHints     *hints,
 		  long          *supplied)
 {
@@ -557,31 +557,31 @@ GetWMNormalHints (XCBConnection *c,
 /* WM_HINTS */
 
 struct WMHints {
-	INT32     flags;           /* marks which fields in this structure are defined */
-	BOOL      input;           /* does this application rely on the window manager
+	int32_t     flags;           /* marks which fields in this structure are defined */
+	uint8_t      input;           /* does this application rely on the window manager
 				      to get keyboard input? */
-	INT32     initial_state;   /* see below */
-	XCBPIXMAP icon_pixmap;     /* pixmap to be used as icon */
-	XCBWINDOW icon_window;     /* window to be used as icon */
-	INT32     icon_x;          /* initial position of icon */
-	INT32     icon_y;
-	XCBPIXMAP icon_mask;       /* icon mask bitmap */
-	XCBWINDOW window_group;    /* id of related window group */
+	int32_t     initial_state;   /* see below */
+	xcb_pixmap_t icon_pixmap;     /* pixmap to be used as icon */
+	xcb_window_t icon_window;     /* window to be used as icon */
+	int32_t     icon_x;          /* initial position of icon */
+	int32_t     icon_y;
+	xcb_pixmap_t icon_mask;       /* icon mask bitmap */
+	xcb_window_t window_group;    /* id of related window group */
 	/* this structure may be extended in the future */
 };
 
 typedef enum {
-        XCBWMInputHint        = (1L << 0),
-	XCBWMStateHint        = (1L << 1),
-	XCBWMIconPixmapHint   = (1L << 2),
-	XCBWMIconWindowHint   = (1L << 3),
-	XCBWMIconPositionHint = (1L << 4),
-	XCBWMIconMaskHint     = (1L << 5),
-	XCBWMWindowGroupHint  = (1L << 6),
-	XCBWMXUrgencyHint     = (1L << 8)
-} XCBWM;
+        xcb_wm_input_hint_t        = (1L << 0),
+	xcb_wm_state_hint_t        = (1L << 1),
+	xcb_wm_icon_pixmap_hint_t   = (1L << 2),
+	xcb_wm_icon_window_hint_t   = (1L << 3),
+	xcb_wm_icon_position_hint_t = (1L << 4),
+	xcb_wm_icon_mask_hint_t     = (1L << 5),
+	xcb_wm_window_group_hint_t  = (1L << 6),
+	xcb_wmx_urgency_hint_t     = (1L << 8)
+} xcb_wm_t;
 
-#define XCBWMAllHints (InputHint     | StateHint        | IconPixmapHint | \
+#define xcb_wm_all_hints (InputHint     | StateHint        | IconPixmapHint | \
                        IconWindowHint| IconPositionHint | IconMaskHint   | \
                        WindowGroupHint)
 
@@ -591,193 +591,193 @@ AllocWMHints()
 	return calloc(1, sizeof(WMHints));
 }
 
-BOOL
+uint8_t
 WMHintsGetInput(WMHints *hints)
 {
         return hints->input;
 }
 
-XCBPIXMAP
+xcb_pixmap_t
 WMHintsGetIconPixmap(WMHints *hints)
 {
         return hints->icon_pixmap;
 }
 
-XCBPIXMAP
+xcb_pixmap_t
 WMHintsGetIconMask(WMHints *hints)
 {
         return hints->icon_mask;
 }
 
-XCBWINDOW
+xcb_window_t
 WMHintsGetIconWindow(WMHints *hints)
 {
         return hints->icon_window;
 }
 
-XCBWINDOW
+xcb_window_t
 WMHintsGetWindowGroup(WMHints *hints)
 {
         return hints->window_group;
 }
 
 
-BOOL
+uint8_t
 WMHintsIsInputHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMInputHint);
+        return (hints->flags & xcb_wm_input_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsStateHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMStateHint);
+        return (hints->flags & xcb_wm_state_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsIconPixmapHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMIconPixmapHint);
+        return (hints->flags & xcb_wm_icon_pixmap_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsIconWindowHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMIconWindowHint);
+        return (hints->flags & xcb_wm_icon_window_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsIconPositionHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMIconPositionHint);
+        return (hints->flags & xcb_wm_icon_position_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsIconMaskHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMIconMaskHint);
+        return (hints->flags & xcb_wm_icon_mask_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsWindowGroupHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMWindowGroupHint);
+        return (hints->flags & xcb_wm_window_group_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsIsXUrgencyHint(WMHints *hints)
 {
-        return (hints->flags & XCBWMXUrgencyHint);
+        return (hints->flags & xcb_wmx_urgency_hint_t);
 }
 
-BOOL
+uint8_t
 WMHintsStateIsWithdrawn(WMHints *hints)
 {
-        return (hints->initial_state == XCBWMWithdrawnState);
+        return (hints->initial_state == xcb_wm_withdrawn_state_t);
 }
 
-BOOL
+uint8_t
 WMHintsStateIsNormal(WMHints *hints)
 {
-        return (hints->initial_state == XCBWMNormalState);
+        return (hints->initial_state == xcb_wm_normal_state_t);
 }
 
-BOOL
+uint8_t
 WMHintsStateIsIconic(WMHints *hints)
 {
-        return (hints->initial_state == XCBWMIconicState);
+        return (hints->initial_state == xcb_wm_iconic_state_t);
 }
 
 void
-WMHintsSetInput(WMHints *hints, BOOL input)
+WMHintsSetInput(WMHints *hints, uint8_t input)
 {
         hints->input = input;
-        hints->flags |= XCBWMInputHint;
+        hints->flags |= xcb_wm_input_hint_t;
 }
 
 void
 WMHintsSetIconic(WMHints *hints)
 {
-        hints->initial_state = XCBWMIconicState;
-        hints->flags |= XCBWMStateHint;
+        hints->initial_state = xcb_wm_iconic_state_t;
+        hints->flags |= xcb_wm_state_hint_t;
 }
 
 void
 WMHintsSetNormal(WMHints *hints)
 {
-        hints->initial_state = XCBWMNormalState;
-        hints->flags |= XCBWMStateHint;
+        hints->initial_state = xcb_wm_normal_state_t;
+        hints->flags |= xcb_wm_state_hint_t;
 }
 
 void
 WMHintsSetWithdrawn(WMHints *hints)
 {
-        hints->initial_state = XCBWMWithdrawnState;
-        hints->flags |= XCBWMStateHint;
+        hints->initial_state = xcb_wm_withdrawn_state_t;
+        hints->flags |= xcb_wm_state_hint_t;
 }
 
 void
 WMHintsSetNone(WMHints *hints)
 {
-        hints->flags &= ~XCBWMStateHint;
+        hints->flags &= ~xcb_wm_state_hint_t;
 }
 
 void
 WMHintsSetUrgent(WMHints *hints)
 {
-        hints->flags |= XCBWMXUrgencyHint;
+        hints->flags |= xcb_wmx_urgency_hint_t;
 }
 
 void
-WMHintsSetIconPixmap(WMHints *hints, XCBPIXMAP icon_pixmap)
+WMHintsSetIconPixmap(WMHints *hints, xcb_pixmap_t icon_pixmap)
 {
         hints->icon_pixmap = icon_pixmap;
-        hints->flags |= XCBWMIconPixmapHint;
+        hints->flags |= xcb_wm_icon_pixmap_hint_t;
 }
 
 void
-WMHintsSetIconMask(WMHints *hints, XCBPIXMAP icon_mask)
+WMHintsSetIconMask(WMHints *hints, xcb_pixmap_t icon_mask)
 {
         hints->icon_mask = icon_mask;
-        hints->flags |= XCBWMIconMaskHint;
+        hints->flags |= xcb_wm_icon_mask_hint_t;
 }
 
 void
-WMHintsSetIconWindow(WMHints *hints, XCBWINDOW icon_window)
+WMHintsSetIconWindow(WMHints *hints, xcb_window_t icon_window)
 {
         hints->icon_window = icon_window;
-        hints->flags |= XCBWMIconWindowHint;
+        hints->flags |= xcb_wm_icon_window_hint_t;
 }
 
 void
-WMHintsSetWindowGroup(WMHints *hints, XCBWINDOW window_group)
+WMHintsSetWindowGroup(WMHints *hints, xcb_window_t window_group)
 {
         hints->window_group = window_group;
-        hints->flags |= XCBWMWindowGroupHint;
+        hints->flags |= xcb_wm_window_group_hint_t;
 }
 
 void
-SetWMHints (XCBConnection *c,
-            XCBWINDOW      window,
+SetWMHints (xcb_connection_t *c,
+            xcb_window_t      window,
             WMHints       *hints)
 {
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_HINTS, WM_HINTS, 32, sizeof(*hints) / 4, hints);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_HINTS, WM_HINTS, 32, sizeof(*hints) / 4, hints);
 }
 
 WMHints *
-GetWMHints (XCBConnection *c,
-	    XCBWINDOW      window)
+GetWMHints (xcb_connection_t *c,
+	    xcb_window_t      window)
 {
-	XCBGetPropertyCookie cookie;
-	XCBGetPropertyRep   *rep;
+	xcb_get_property_cookie_t cookie;
+	xcb_get_property_reply_t   *rep;
 	WMHints             *hints;
         char                *prop;
 	long                 length;
 
-	cookie = XCBGetProperty (c, 0, window,
+	cookie = xcb_get_property (c, 0, window,
 			WM_HINTS, WM_HINTS,
 			0L, NumWMHintsElements);
-	rep = XCBGetPropertyReply (c, cookie, 0);
+	rep = xcb_get_property_reply (c, cookie, 0);
 	if (!rep)
 		return NULL;
 
@@ -795,8 +795,8 @@ GetWMHints (XCBConnection *c,
 		return NULL;
 	}
 
-	length = XCBGetPropertyValueLength (rep);
-	prop = (char *) XCBGetPropertyValue (rep);
+	length = xcb_get_property_value_length (rep);
+	prop = (char *) xcb_get_property_value (rep);
 	prop[length] = '\0';
 	hints = (WMHints *)strdup (prop);
 	if (rep->value_len < NumWMHintsElements)
@@ -808,39 +808,39 @@ GetWMHints (XCBConnection *c,
 /* WM_PROTOCOLS */
 
 void
-SetWMProtocols (XCBConnection *c,
-		XCBWINDOW      window,
-		CARD32         list_len,
-		XCBATOM       *list)
+SetWMProtocols (xcb_connection_t *c,
+		xcb_window_t      window,
+		uint32_t         list_len,
+		xcb_atom_t       *list)
 {
-	InternAtomFastCookie proto;
-	XCBATOM WM_PROTOCOLS;
+	intern_atom_fast_cookie_t proto;
+	xcb_atom_t WM_PROTOCOLS;
 
-	proto = InternAtomFast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS");
-	WM_PROTOCOLS = InternAtomFastReply(c, proto, 0);
+	proto = intern_atom_fast(c, 0, sizeof("WM_PROTOCOLS") - 1, "WM_PROTOCOLS");
+	WM_PROTOCOLS = intern_atom_fast_reply(c, proto, 0);
 
-	XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
+	xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_PROTOCOLS, ATOM, 32, list_len, list);
 }
 
 int
-GetWMProtocols (XCBConnection *c,
-		XCBWINDOW      window,
-		CARD32        *list_len,
-		XCBATOM      **list)
-{
-        XCBGetPropertyCookie cookie;
-	XCBGetPropertyRep   *rep;
-	XCBATOM              property;
-
-	property = InternAtomFastReply(c,
-				       InternAtomFast(c,
-						      0,
-						      strlen("WM_PROTOCOLS"),
-						      "WM_PROTOCOLS"),
-				       NULL);
-	cookie = XCBGetProperty(c, 0, window,
+GetWMProtocols (xcb_connection_t *c,
+		xcb_window_t      window,
+		uint32_t        *list_len,
+		xcb_atom_t      **list)
+{
+        xcb_get_property_cookie_t cookie;
+	xcb_get_property_reply_t   *rep;
+	xcb_atom_t              property;
+
+	property = intern_atom_fast_reply(c,
+                                          intern_atom_fast(c,
+                                                           0,
+                                                           strlen("WM_PROTOCOLS"),
+                                                           "WM_PROTOCOLS"),
+                                          NULL);
+	cookie = xcb_get_property(c, 0, window,
 				property, ATOM, 0, 1000000L);
-	rep = XCBGetPropertyReply(c, cookie, 0);
+	rep = xcb_get_property_reply(c, cookie, 0);
 	if (!rep)
 	        return 0;
 	if ((rep->type.xid == ATOM.xid) ||
@@ -848,15 +848,15 @@ GetWMProtocols (XCBConnection *c,
 	{
 	        int length;
 
-		length = XCBGetPropertyValueLength(rep);
+		length = xcb_get_property_value_length(rep);
 		*list_len = length;
-		*list = (XCBATOM *)malloc(sizeof(XCBATOM) * length);
+		*list = (xcb_atom_t *)malloc(sizeof(xcb_atom_t) * length);
 		if (!(*list))
 		{
 		        free(rep);
 			return 0;
 		}
-		memcpy(*list, XCBGetPropertyValue(rep), length);
+		memcpy(*list, xcb_get_property_value(rep), length);
 		free(rep);
 		return 1;
 	}
@@ -878,17 +878,17 @@ static char *makename(const char *fmt, .
 	return ret;
 }
 
-char *DiscriminatedAtomNameByScreen(const char *base, CARD8 screen)
+char *DiscriminatedAtomNameByScreen(const char *base, uint8_t screen)
 {
 	return makename("%s_S%u", base, screen);
 }
 
-char *DiscriminatedAtomNameByResource(const char *base, CARD32 resource)
+char *DiscriminatedAtomNameByResource(const char *base, uint32_t resource)
 {
 	return makename("%s_R%08X", base, resource);
 }
 
-char *DiscriminatedAtomNameUnique(const char *base, CARD32 id)
+char *DiscriminatedAtomNameUnique(const char *base, uint32_t id)
 {
 	if(base)
 		return makename("%s_U%lu", base, id);
diff --git a/xcb-util/icccm/xcb_icccm.h b/xcb-util/icccm/xcb_icccm.h
index a79f41c..3807603 100644
--- a/xcb-util/icccm/xcb_icccm.h
+++ b/xcb-util/icccm/xcb_icccm.h
@@ -12,62 +12,62 @@ extern "C" {
 
 /* WM_NAME */
 
-void SetWMName   (XCBConnection *c,
-		  XCBWINDOW      window,
-		  XCBATOM        encoding,
-		  CARD32         name_len,
+void SetWMName   (xcb_connection_t *c,
+		  xcb_window_t      window,
+		  xcb_atom_t        encoding,
+		  uint32_t         name_len,
 		  const char    *name);
 
-int  GetWMName   (XCBConnection *c,
-		  XCBWINDOW      window,
-		  CARD8         *format,
-		  XCBATOM       *encoding,
-		  CARD32        *name_len,
+int  GetWMName   (xcb_connection_t *c,
+		  xcb_window_t      window,
+		  uint8_t         *format,
+		  xcb_atom_t       *encoding,
+		  uint32_t        *name_len,
 		  char         **name);
 
-void WatchWMName (PropertyHandlers      *prophs,
-		  CARD32                 long_len,
-		  GenericPropertyHandler handler,
+void WatchWMName (property_handlers_t      *prophs,
+		  uint32_t                 long_len,
+		  generic_property_handler handler,
 		  void                  *data);
 
 /* WM_ICON_NAME */
 
-void SetWMIconName   (XCBConnection *c,
-		      XCBWINDOW      window,
-		      XCBATOM        encoding,
-		      CARD32         name_len,
+void SetWMIconName   (xcb_connection_t *c,
+		      xcb_window_t      window,
+		      xcb_atom_t        encoding,
+		      uint32_t         name_len,
 		      const char    *name);
 
-int  GetWMIconName (XCBConnection *c,
-                    XCBWINDOW      window,
-                    CARD8         *format,
-                    XCBATOM       *encoding,
-                    CARD32        *name_len,
+int  GetWMIconName (xcb_connection_t *c,
+                    xcb_window_t      window,
+                    uint8_t         *format,
+                    xcb_atom_t       *encoding,
+                    uint32_t        *name_len,
                     char         **name);
 
-void WatchWMIconName (PropertyHandlers      *prophs,
-		      CARD32                 long_len,
-		      GenericPropertyHandler handler,
+void WatchWMIconName (property_handlers_t      *prophs,
+		      uint32_t                 long_len,
+		      generic_property_handler handler,
 		      void                  *data);
 
 /* WM_CLIENT_MACHINE */
 
-void SetWMClientMachine (XCBConnection *c,
-                         XCBWINDOW      window,
-                         XCBATOM        encoding,
-                         CARD32         name_len,
+void SetWMClientMachine (xcb_connection_t *c,
+                         xcb_window_t      window,
+                         xcb_atom_t        encoding,
+                         uint32_t         name_len,
                          const char    *name);
 
-int  GetWMClientMachine (XCBConnection *c,
-                         XCBWINDOW      window,
-                         CARD8         *format,
-                         XCBATOM       *encoding,
-                         CARD32        *name_len,
+int  GetWMClientMachine (xcb_connection_t *c,
+                         xcb_window_t      window,
+                         uint8_t         *format,
+                         xcb_atom_t       *encoding,
+                         uint32_t        *name_len,
                          char         **name);
 
-void WatchWMClientMachine (PropertyHandlers      *prophs,
-                           CARD32                 long_len,
-                           GenericPropertyHandler handler,
+void WatchWMClientMachine (property_handlers_t      *prophs,
+                           uint32_t                 long_len,
+                           generic_property_handler handler,
                            void                  *data);
 
 /* WM_SIZE_HINTS */
@@ -79,41 +79,41 @@ SizeHints *AllocSizeHints         ();
 void       FreeSizeHints          (SizeHints *hints);
 
 void       SizeHintsGetPosition (SizeHints *hints,
-				 INT32     *x,
-				 INT32     *y);
+				 int32_t     *x,
+				 int32_t     *y);
 void       SizeHintsGetSize     (SizeHints *hints,
-				 INT32     *width,
-				 INT32     *height);
+				 int32_t     *width,
+				 int32_t     *height);
 void       SizeHintsGetMinSize  (SizeHints *hints,
-				 INT32     *min_width,
-				 INT32     *min_height);
+				 int32_t     *min_width,
+				 int32_t     *min_height);
 void       SizeHintsGetMaxSize  (SizeHints *hints,
-				 INT32     *max_width,
-				 INT32     *max_height);
+				 int32_t     *max_width,
+				 int32_t     *max_height);
 void       SizeHintsGetIncrease  (SizeHints *hints,
-				  INT32     *width_inc,
-				  INT32     *height_inc);
+				  int32_t     *width_inc,
+				  int32_t     *height_inc);
 void       SizeHintsGetMinAspect (SizeHints *hints,
-				  INT32     *min_aspect_num,
-				  INT32     *min_aspect_den);
+				  int32_t     *min_aspect_num,
+				  int32_t     *min_aspect_den);
 void       SizeHintsGetMaxAspect (SizeHints *hints,
-				  INT32     *max_aspect_num,
-				  INT32     *max_aspect_den);
+				  int32_t     *max_aspect_num,
+				  int32_t     *max_aspect_den);
 void       SizeHintsGetBaseSize  (SizeHints *hints,
-				  INT32     *base_width,
-				  INT32     *base_height);
-CARD32     SizeHintsGetWinGravity (SizeHints *hints);
-
-BOOL       SizeHintsIsUSPosition  (SizeHints *hints);
-BOOL       SizeHintsIsUSSize      (SizeHints *hints);
-BOOL       SizeHintsIsPPosition   (SizeHints *hints);
-BOOL       SizeHintsIsPSize       (SizeHints *hints);
-BOOL       SizeHintsIsPMinSize    (SizeHints *hints);
-BOOL       SizeHintsIsPMaxSize    (SizeHints *hints);
-BOOL       SizeHintsIsPResizeInc  (SizeHints *hints);
-BOOL       SizeHintsIsPAspect     (SizeHints *hints);
-BOOL       SizeHintsIsPBaseSize   (SizeHints *hints);
-BOOL       SizeHintsIsPWinGravity (SizeHints *hints);
+				  int32_t     *base_width,
+				  int32_t     *base_height);
+uint32_t     SizeHintsGetWinGravity (SizeHints *hints);
+
+uint8_t       SizeHintsIsUSPosition  (SizeHints *hints);
+uint8_t       SizeHintsIsUSSize      (SizeHints *hints);
+uint8_t       SizeHintsIsPPosition   (SizeHints *hints);
+uint8_t       SizeHintsIsPSize       (SizeHints *hints);
+uint8_t       SizeHintsIsPMinSize    (SizeHints *hints);
+uint8_t       SizeHintsIsPMaxSize    (SizeHints *hints);
+uint8_t       SizeHintsIsPResizeInc  (SizeHints *hints);
+uint8_t       SizeHintsIsPAspect     (SizeHints *hints);
+uint8_t       SizeHintsIsPBaseSize   (SizeHints *hints);
+uint8_t       SizeHintsIsPWinGravity (SizeHints *hints);
 
 void       SizeHintsSetFlagNone        (SizeHints *hints);
 void       SizeHintsSetFlagUSPosition  (SizeHints *hints);
@@ -129,58 +129,58 @@ void       SizeHintsSetFlagPWinGravity (
 
 void       SizeHintsSetPosition   (SizeHints *hints,
 				   int        user_specified,
-				   INT32      x,
-				   INT32      y);
+				   int32_t      x,
+				   int32_t      y);
 
 void       SizeHintsSetSize       (SizeHints *hints,
 				   int        user_specified,
-				   INT32      width,
-				   INT32      height);
+				   int32_t      width,
+				   int32_t      height);
 
 void       SizeHintsSetMinSize    (SizeHints *hints,
-				   INT32      min_width,
-				   INT32      min_height);
+				   int32_t      min_width,
+				   int32_t      min_height);
 
 void       SizeHintsSetMaxSize    (SizeHints *hints,
-				   INT32      max_width,
-				   INT32      max_height);
+				   int32_t      max_width,
+				   int32_t      max_height);
 
 void       SizeHintsSetResizeInc  (SizeHints *hints,
-				   INT32      width_inc,
-				   INT32      height_inc);
+				   int32_t      width_inc,
+				   int32_t      height_inc);
 
 void       SizeHintsSetAspect     (SizeHints *hints,
-				   INT32      min_aspect_num,
-				   INT32      min_aspect_den,
-				   INT32      max_aspect_num,
-				   INT32      max_aspect_den);
+				   int32_t      min_aspect_num,
+				   int32_t      min_aspect_den,
+				   int32_t      max_aspect_num,
+				   int32_t      max_aspect_den);
 
 void       SizeHintsSetBaseSize   (SizeHints *hints,
-				   INT32      base_width,
-				   INT32      base_height);
+				   int32_t      base_width,
+				   int32_t      base_height);
 
 void       SizeHintsSetWinGravity (SizeHints *hints,
-				   CARD8      win_gravity);
+				   uint8_t      win_gravity);
 
-void       SetWMSizeHints         (XCBConnection *c,
-				   XCBWINDOW       window,
-				   XCBATOM         property,
+void       SetWMSizeHints         (xcb_connection_t *c,
+				   xcb_window_t       window,
+				   xcb_atom_t         property,
 				   SizeHints      *hints);
 
-int        GetWMSizeHints         (XCBConnection *c,
-				   XCBWINDOW      window,
-				   XCBATOM        property,
+int        GetWMSizeHints         (xcb_connection_t *c,
+				   xcb_window_t      window,
+				   xcb_atom_t        property,
 				   SizeHints     *hints,
 				   long          *supplied);
 
 /* WM_NORMAL_HINTS */
 
-void SetWMNormalHints (XCBConnection *c,
-		       XCBWINDOW      window,
+void SetWMNormalHints (xcb_connection_t *c,
+		       xcb_window_t      window,
 		       SizeHints     *hints);
 
-int  GetWMNormalHints (XCBConnection *c,
-		       XCBWINDOW      window,
+int  GetWMNormalHints (xcb_connection_t *c,
+		       xcb_window_t      window,
 		       SizeHints     *hints,
 		       long          *supplied);
 
@@ -190,66 +190,66 @@ typedef struct WMHints WMHints;
 #define NumWMHintsElements 9 /* number of elements in this structure */
 
 typedef enum {
-    XCBWMWithdrawnState = 0,
-    XCBWMNormalState    = 1,
-    XCBWMIconicState    = 3
-} XCBWMState;
+    xcb_wm_withdrawn_state_t = 0,
+    xcb_wm_normal_state_t    = 1,
+    xcb_wm_iconic_state_t    = 3
+} xcb_wm_state_t;
 
 WMHints *AllocWMHints();
 
-BOOL      WMHintsGetInput       (WMHints *hints);
-XCBPIXMAP WMHintsGetIconPixmap  (WMHints *hints);
-XCBPIXMAP WMHintsGetIconMask    (WMHints *hints);
-XCBWINDOW WMHintsGetIconWindow  (WMHints *hints);
-XCBWINDOW WMHintsGetWindowGroup (WMHints *hints);
-
-BOOL WMHintsIsInputHint        (WMHints *hints);
-BOOL WMHintsIsStateHint        (WMHints *hints);
-BOOL WMHintsIsIconPixmapHint   (WMHints *hints);
-BOOL WMHintsIsIconWindowHint   (WMHints *hints);
-BOOL WMHintsIsIconPositionHint (WMHints *hints);
-BOOL WMHintsIsIconMaskHint     (WMHints *hints);
-BOOL WMHintsIsWindowGroupHint  (WMHints *hints);
-BOOL WMHintsIsXUrgencyHint     (WMHints *hints);
-
-BOOL WMHintsStateIsWithdrawn (WMHints *hints);
-BOOL WMHintsStateIsNormal    (WMHints *hints);
-BOOL WMHintsStateIsIconic    (WMHints *hints);
+uint8_t      WMHintsGetInput       (WMHints *hints);
+xcb_pixmap_t WMHintsGetIconPixmap  (WMHints *hints);
+xcb_pixmap_t WMHintsGetIconMask    (WMHints *hints);
+xcb_window_t WMHintsGetIconWindow  (WMHints *hints);
+xcb_window_t WMHintsGetWindowGroup (WMHints *hints);
+
+uint8_t WMHintsIsInputHint        (WMHints *hints);
+uint8_t WMHintsIsStateHint        (WMHints *hints);
+uint8_t WMHintsIsIconPixmapHint   (WMHints *hints);
+uint8_t WMHintsIsIconWindowHint   (WMHints *hints);
+uint8_t WMHintsIsIconPositionHint (WMHints *hints);
+uint8_t WMHintsIsIconMaskHint     (WMHints *hints);
+uint8_t WMHintsIsWindowGroupHint  (WMHints *hints);
+uint8_t WMHintsIsXUrgencyHint     (WMHints *hints);
+
+uint8_t WMHintsStateIsWithdrawn (WMHints *hints);
+uint8_t WMHintsStateIsNormal    (WMHints *hints);
+uint8_t WMHintsStateIsIconic    (WMHints *hints);
 
-void WMHintsSetInput       (WMHints *hints, BOOL input);
+void WMHintsSetInput       (WMHints *hints, uint8_t input);
 void WMHintsSetIconic      (WMHints *hints);
 void WMHintsSetNormal      (WMHints *hints);
 void WMHintsSetWithdrawn   (WMHints *hints);
 void WMHintsSetNone        (WMHints *hints);
 void WMHintsSetUrgent      (WMHints *hints);
-void WMHintsSetIconPixmap  (WMHints *hints, XCBPIXMAP icon_pixmap);
-void WMHintsSetIconMask    (WMHints *hints, XCBPIXMAP icon_mask);
-void WMHintsSetIconWindow  (WMHints *hints, XCBWINDOW icon_window);
-void WMHintsSetWindowGroup (WMHints *hints, XCBWINDOW window_group);
+void WMHintsSetIconPixmap  (WMHints *hints, xcb_pixmap_t icon_pixmap);
+void WMHintsSetIconMask    (WMHints *hints, xcb_pixmap_t icon_mask);
+void WMHintsSetIconWindow  (WMHints *hints, xcb_window_t icon_window);
+void WMHintsSetWindowGroup (WMHints *hints, xcb_window_t window_group);
 
-void SetWMHints (XCBConnection *c,
-                 XCBWINDOW      window,
+void SetWMHints (xcb_connection_t *c,
+                 xcb_window_t      window,
                  WMHints       *hints);
 
-WMHints *GetWMHints (XCBConnection *c,
-		     XCBWINDOW      window);
+WMHints *GetWMHints (xcb_connection_t *c,
+		     xcb_window_t      window);
 
 /* WM_PROTOCOLS */
 
-void SetWMProtocols (XCBConnection *c,
-		     XCBWINDOW      window,
-		     CARD32         list_len,
-		     XCBATOM       *list);
-int  GetWMProtocols (XCBConnection *c,
-		     XCBWINDOW      window,
-		     CARD32        *list_len,
-		     XCBATOM      **list);
+void SetWMProtocols (xcb_connection_t *c,
+		     xcb_window_t      window,
+		     uint32_t         list_len,
+		     xcb_atom_t       *list);
+int  GetWMProtocols (xcb_connection_t *c,
+		     xcb_window_t      window,
+		     uint32_t        *list_len,
+		     xcb_atom_t      **list);
 
 #define HAS_DISCRIMINATED_NAME 0
 #if HAS_DISCRIMINATED_NAME
-char *DiscriminatedAtomNameByScreen   (const char *base, CARD8 screen);
-char *DiscriminatedAtomNameByResource (const char *base, CARD32 resource);
-char *DiscriminatedAtomNameUnique     (const char *base, CARD32 id);
+char *DiscriminatedAtomNameByScreen   (const char *base, uint8_t screen);
+char *DiscriminatedAtomNameByResource (const char *base, uint32_t resource);
+char *DiscriminatedAtomNameUnique     (const char *base, uint32_t id);
 #endif
 
 
diff --git a/xcb-util/image/test_formats.c b/xcb-util/image/test_formats.c
index eb25d66..3b97978 100644
--- a/xcb-util/image/test_formats.c
+++ b/xcb-util/image/test_formats.c
@@ -19,89 +19,89 @@ static int xpad(int depth)
 #endif
 
 /* FIXME: this function doesn't work correctly for XYPixmaps yet. */
-static XCBImage *create_image(XCBConnection *c, int depth, int format)
+static xcb_image_t *create_image(xcb_connection_t *c, int depth, int format)
 {
 #if 0
 	int pad = (format == ZPixmap ? xpad(depth) : 8);
 #endif
-	XCBImage *im;
+	xcb_image_t *im;
 	int x, y;
-	CARD32 i = 0;
+	uint32_t i = 0;
 	printf("Image depth %d, format %d\n", depth, format);
-	im = XCBImageCreate(c, depth, format, 0, 0, WIDTH, HEIGHT, 32, 0);
+	im = xcb_image_create(c, depth, format, 0, 0, WIDTH, HEIGHT, 32, 0);
 	if(!im)
 	{
 		printf("ImageCreate failed.\n");
 		return 0;
 	}
-	im->data = malloc(im->bytes_per_line * HEIGHT * (format == XCBImageFormatZPixmap ? 1 : depth));
+	im->data = malloc(im->bytes_per_line * HEIGHT * (format == XCB_IMAGE_FORMAT_Z_PIXMAP ? 1 : depth));
 	if(!im->data)
 	{
-		XCBImageDestroy(im);
+		xcb_image_destroy(im);
 		return 0;
 	}
 	for(x = 0; x < WIDTH; ++x)
 		for(y = 0; y < HEIGHT; ++y)
 		{
-			XCBImagePutPixel(im, x, y, i);
+			xcb_image_put_pixel(im, x, y, i);
 			++i;
 			i &= (1 << depth) - 1;
 		}
 	return im;
 }
 
-static XCBWINDOW create_window(XCBConnection *c, XCBSCREEN *root)
+static xcb_window_t create_window(xcb_connection_t *c, xcb_screen_t *root)
 {
-	static const CARD32 mask = XCBCWEventMask;
-	static const CARD32 values[] = { XCBEventMaskExposure };
+	static const uint32_t mask = XCB_CW_EVENT_MASK;
+	static const uint32_t values[] = { XCB_EVENT_MASK_EXPOSURE };
 	unsigned int seq;
-	XCBWINDOW w = XCBWINDOWNew(c);
-	seq = XCBCreateWindow(c, root->root_depth, w, root->root, 30, 30, WIDTH, HEIGHT, 0, XCBWindowClassInputOutput, root->root_visual, mask, values).sequence;
+	xcb_window_t w = xcb_window_new(c);
+	seq = xcb_create_window(c, root->root_depth, w, root->root, 30, 30, WIDTH, HEIGHT, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, root->root_visual, mask, values).sequence;
 	printf("CreateWindow sequence %d, depth %d\n", seq, root->root_depth);
-	seq = XCBMapWindow(c, w).sequence;
+	seq = xcb_map_window(c, w).sequence;
 	printf("MapWindow sequence %d\n", seq);
 	return w;
 }
 
-static XCBPIXMAP create_pixmap(XCBConnection *c, XCBDRAWABLE d, CARD8 depth)
+static xcb_pixmap_t create_pixmap(xcb_connection_t *c, xcb_drawable_t d, uint8_t depth)
 {
-	XCBPIXMAP p = XCBPIXMAPNew(c);
+	xcb_pixmap_t p = xcb_pixmap_new(c);
 	unsigned int seq;
-	seq = XCBCreatePixmap(c, depth, p, d, WIDTH, HEIGHT).sequence;
+	seq = xcb_create_pixmap(c, depth, p, d, WIDTH, HEIGHT).sequence;
 	printf("CreatePixmap sequence %d, depth %d\n", seq, depth);
 	return p;
 }
 
-static XCBGCONTEXT create_gcontext(XCBConnection *c, XCBSCREEN *root)
+static xcb_gcontext_t create_gcontext(xcb_connection_t *c, xcb_screen_t *root)
 {
-	static const CARD32 mask = XCBGCForeground | XCBGCBackground;
-	const CARD32 values[] = { root->black_pixel, root->white_pixel };
-	const XCBDRAWABLE d = { root->root };
+	static const uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
+	const uint32_t values[] = { root->black_pixel, root->white_pixel };
+	const xcb_drawable_t d = { root->root };
 	unsigned int seq;
-	XCBGCONTEXT gc = XCBGCONTEXTNew(c);
-	seq = XCBCreateGC(c, gc, d, mask, values).sequence;
+	xcb_gcontext_t gc = xcb_gcontext_new(c);
+	seq = xcb_create_gc(c, gc, d, mask, values).sequence;
 	printf("CreateGC sequence %d\n", seq);
 	return gc;
 }
 
 int main(int argc, char **argv)
 {
-	int screen, depth, format = XCBImageFormatZPixmap;
-	XCBSCREEN *root;
-	XCBImage *im;
-	XCBDRAWABLE d, w = { { 0 } };
-	XCBGCONTEXT gc;
-	XCBGenericEvent *ev;
-	XCBConnection *c = XCBConnect(0, &screen);
+	int screen, depth, format = XCB_IMAGE_FORMAT_Z_PIXMAP;
+	xcb_screen_t *root;
+	xcb_image_t *im;
+	xcb_drawable_t d, w = { { 0 } };
+	xcb_gcontext_t gc;
+	xcb_generic_event_t *ev;
+	xcb_connection_t *c = xcb_connect(0, &screen);
 	if(!c)
 	{
 		printf("Connection failed.\n");
 		exit(1);
 	}
-	root = XCBAuxGetScreen(c, screen);
+	root = xcb_aux_get_screen(c, screen);
 	if(argc > 1)
 		format = atoi(argv[1]);
-	if(format == XCBImageFormatXYBitmap || argc > 2)
+	if(format == XCB_IMAGE_FORMAT_XY_BITMAP || argc > 2)
 		depth = 1;
 	else
 		depth = root->root_depth;
@@ -114,33 +114,33 @@ int main(int argc, char **argv)
 		d.pixmap = create_pixmap(c, w, depth);
 	}
 	gc = create_gcontext(c, root);
-	XCBFlush(c);
+	xcb_flush(c);
 
 	if(im)
 	{
-		while((ev = XCBWaitForEvent(c)))
+		while((ev = xcb_wait_for_event(c)))
 		{
-			if(ev->response_type == XCBExpose && ((XCBExposeEvent *) ev)->count == 0)
+			if(ev->response_type == XCB_EXPOSE && ((xcb_expose_event_t *) ev)->count == 0)
 			{
-				XCBImagePut(c, d, gc, im, 0, 0, 0, 0, WIDTH, HEIGHT);
+				xcb_image_put(c, d, gc, im, 0, 0, 0, 0, WIDTH, HEIGHT);
 				if(w.window.xid)
 				{
 					unsigned int seq;
-					seq = XCBCopyPlane(c, d, w, gc, 0, 0, WIDTH, HEIGHT, 0, 0, 1).sequence;
+					seq = xcb_copy_plane(c, d, w, gc, 0, 0, WIDTH, HEIGHT, 0, 0, 1).sequence;
 					printf("CopyPlane sequence %d\n", seq);
 				}
-				XCBFlush(c);
+				xcb_flush(c);
 			}
 			else if(ev->response_type == 0)
 			{
-				XCBGenericError *err = (XCBGenericError *) ev;
+				xcb_generic_error_t *err = (xcb_generic_error_t *) ev;
 				printf("Error: %d after sequence %d\n", err->error_code, (unsigned int) err->full_sequence);
 			}
 			free(ev);
 		}
-		XCBImageDestroy(im);
+		xcb_image_destroy(im);
 	}
 
-	XCBDisconnect(c);
+	xcb_disconnect(c);
 	exit(0);
 }
diff --git a/xcb-util/image/test_xcb_image.c b/xcb-util/image/test_xcb_image.c
index 4816672..23ce236 100644
--- a/xcb-util/image/test_xcb_image.c
+++ b/xcb-util/image/test_xcb_image.c
@@ -12,29 +12,29 @@
 #define W_H 4
 
 void
-reflect_window (XCBConnection *c,
-		XCBDRAWABLE win,
-		XCBDRAWABLE new_win,
-		XCBGCONTEXT gc,
-		CARD16      width,
-		CARD16      height)
+reflect_window (xcb_connection_t *c,
+		xcb_drawable_t win,
+		xcb_drawable_t new_win,
+		xcb_gcontext_t gc,
+		uint16_t      width,
+		uint16_t      height)
 {
-  XCBImage *image;
-  CARD32    pixel1;
-  CARD32    pixel2;
-  INT32     left_x;
-  INT32     right_x;
-  INT32     y;
+  xcb_image_t *image;
+  uint32_t    pixel1;
+  uint32_t    pixel2;
+  int32_t     left_x;
+  int32_t     right_x;
+  int32_t     y;
 
   int i, j;
   int format;
 
-  format = XCBImageFormatZPixmap;
+  format = XCB_IMAGE_FORMAT_Z_PIXMAP;
 
   printf ("get_image %d %d\n", width, height);
-  image = XCBImageGet (c, win,
+  image = xcb_image_get (c, win,
 			 0, 0, width, height,
-			 XCBAllPlanes,
+			 XCB_ALL_PLANES,
 			 format);
 
   printf ("Create image summary:\n");
@@ -53,7 +53,7 @@ reflect_window (XCBConnection *c,
     {
       for (i = 0 ; i < image->width ; i++)
 	{
-	  pixel1 = XCBImageGetPixel (image, i, j);
+	  pixel1 = xcb_image_get_pixel (image, i, j);
 	  printf ("%6d ", pixel1);
 	}
       printf ("\n");
@@ -65,14 +65,14 @@ reflect_window (XCBConnection *c,
     {
       for (y = 0 ; y < height ; y++)
 	{
-	  pixel1 = XCBImageGetPixel (image, left_x, y);
+	  pixel1 = xcb_image_get_pixel (image, left_x, y);
 	  right_x = width - left_x-1;
 	  if (left_x != right_x)
 	    {
-	      pixel2 = XCBImageGetPixel (image, right_x, y);
-	      XCBImagePutPixel (image, left_x, y, pixel2);
+	      pixel2 = xcb_image_get_pixel (image, right_x, y);
+	      xcb_image_put_pixel (image, left_x, y, pixel2);
 	    }
-	  XCBImagePutPixel (image, right_x, y, pixel1);
+	  xcb_image_put_pixel (image, right_x, y, pixel1);
 	}
       printf ("\n");
     }
@@ -81,23 +81,23 @@ reflect_window (XCBConnection *c,
     {
       for (i = 0 ; i < image->width ; i++)
 	{
-	  pixel1 = XCBImageGetPixel (image, i, j);
+	  pixel1 = xcb_image_get_pixel (image, i, j);
 	  printf ("%6d ", pixel1);
 	}
       printf ("\n");
     }
-  XCBImagePut (c, new_win, gc, image,
+  xcb_image_put (c, new_win, gc, image,
 		 0, 0, 0, 0, width, height);
-  image = XCBImageGet (c, new_win,
+  image = xcb_image_get (c, new_win,
 			 0, 0, width, height,
-			 XCBAllPlanes,
+			 XCB_ALL_PLANES,
 			 format);
   printf ("New : \n");
   for (j = 0 ; j < image->height ; j++)
     {
       for (i = 0 ; i < image->width ; i++)
 	{
-	  pixel1 = XCBImageGetPixel (image, i, j);
+	  pixel1 = xcb_image_get_pixel (image, i, j);
 	  printf ("%6d ", pixel1);
 	}
       printf ("\n");
@@ -108,117 +108,117 @@ reflect_window (XCBConnection *c,
 int
 main (int argc, char *argv[])
 {
-  XCBConnection   *c;
-  XCBSCREEN       *screen;
-  XCBDRAWABLE      win;
-  XCBDRAWABLE      new_win;
-  XCBDRAWABLE      rect;
-  XCBRECTANGLE     rect_coord = { 0, 0, W_W, W_H};
-  XCBGCONTEXT      bgcolor, fgcolor;
-  XCBPOINT         points[2];
-  CARD32           mask;
-  CARD32           valgc[2];
-  CARD32           valwin[3];
+  xcb_connection_t   *c;
+  xcb_screen_t       *screen;
+  xcb_drawable_t      win;
+  xcb_drawable_t      new_win;
+  xcb_drawable_t      rect;
+  xcb_rectangle_t     rect_coord = { 0, 0, W_W, W_H};
+  xcb_gcontext_t      bgcolor, fgcolor;
+  xcb_point_t         points[2];
+  uint32_t           mask;
+  uint32_t           valgc[2];
+  uint32_t           valwin[3];
   int              depth;
   int              screen_nbr;
-  XCBGenericEvent *e;
+  xcb_generic_event_t *e;
   
   /* Open the connexion to the X server and get the first screen */
-  c = XCBConnect (NULL, &screen_nbr);
-  screen = XCBAuxGetScreen (c, screen_nbr);
-  depth = XCBAuxGetDepth (c, screen);
+  c = xcb_connect (NULL, &screen_nbr);
+  screen = xcb_aux_get_screen (c, screen_nbr);
+  depth = xcb_aux_get_depth (c, screen);
 
   /* Create a black graphic context for drawing in the foreground */
   win.window = screen->root;
 
-  fgcolor = XCBGCONTEXTNew(c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  fgcolor = xcb_gcontext_new(c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC(c, fgcolor, win, mask, valgc);
+  xcb_create_gc(c, fgcolor, win, mask, valgc);
 
-  bgcolor = XCBGCONTEXTNew(c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  bgcolor = xcb_gcontext_new(c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC(c, bgcolor, win, mask, valgc);
+  xcb_create_gc(c, bgcolor, win, mask, valgc);
 
   /* Ask for our window's Id */
-  win.window = XCBWINDOWNew(c);
+  win.window = xcb_window_new(c);
 
   /* Create the window */
-  mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
+  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
   valwin[0] = screen->white_pixel;
-  valwin[1] = XCBEventMaskKeyPress | XCBEventMaskButtonRelease | XCBEventMaskExposure;
-  valwin[2] = XCBEventMaskButtonPress;
-  XCBCreateWindow (c,                        /* Connection          */
+  valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE;
+  valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS;
+  xcb_create_window (c,                        /* Connection          */
  		   0,                        /* depth               */
 		   win.window,               /* window Id           */
 		   screen->root,             /* parent window       */
 		   0, 0,                     /* x, y                */
 		   W_W, W_H,                 /* width, height       */
 		   10,                       /* border_width        */
-		   XCBWindowClassInputOutput,/* class               */
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class               */
 		   screen->root_visual,      /* visual              */
 		   mask, valwin);                 /* masks, not used yet */
 
   /* Map the window on the screen */
-  XCBMapWindow (c, win.window);
+  xcb_map_window (c, win.window);
 
   /* Create a Pixmap that will fill the window */
-  rect.pixmap = XCBPIXMAPNew (c);
-  XCBCreatePixmap(c, depth, rect.pixmap, win, W_W, W_H);
-  XCBPolyFillRectangle(c, rect, bgcolor, 1, &rect_coord);
+  rect.pixmap = xcb_pixmap_new (c);
+  xcb_create_pixmap(c, depth, rect.pixmap, win, W_W, W_H);
+  xcb_poly_fill_rectangle(c, rect, bgcolor, 1, &rect_coord);
   points[0].x = 0;
   points[0].y = 0;
   points[1].x = 1;
   points[1].y = 1;
-  XCBPolyLine(c, XCBCoordModeOrigin, rect, fgcolor, 2, points);
+  xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points);
 /*   points[0].x = 10; */
 /*   points[0].y = 10; */
 /*   points[1].x = 10; */
 /*   points[1].y = 40; */
-/*   XCBPolyLine(c, CoordModeOrigin, rect, fgcolor, 2, points); */
+/*   xcb_poly_line(c, CoordModeOrigin, rect, fgcolor, 2, points); */
 
   /* Ask for our window's Id */
-  new_win.window = XCBWINDOWNew(c);
+  new_win.window = xcb_window_new(c);
 
   /* Create the window */
-  mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
+  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
   valwin[0] = screen->white_pixel;
-  valwin[1] = XCBEventMaskKeyPress | XCBEventMaskButtonRelease | XCBEventMaskExposure;
-  valwin[2] = XCBEventMaskButtonPress;
-  XCBCreateWindow (c,                        /* Connection          */
+  valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE;
+  valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS;
+  xcb_create_window (c,                        /* Connection          */
  		   0,                        /* depth               */
 		   new_win.window,               /* window Id           */
 		   screen->root,             /* parent window       */
 		   0, 0,                     /* x, y                */
 		   W_W, W_H,                 /* width, height       */
 		   10,                       /* border_width        */
-		   XCBWindowClassInputOutput,/* class               */
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class               */
 		   screen->root_visual,      /* visual              */
 		   mask, valwin);                 /* masks, not used yet */
 
   
 
   /* Map the window on the screen */
-  XCBMapWindow (c, new_win.window);
+  xcb_map_window (c, new_win.window);
 
 
-  XCBFlush (c); 
+  xcb_flush (c); 
 
-  while ((e = XCBWaitForEvent(c)))
+  while ((e = xcb_wait_for_event(c)))
     {
       switch (e->response_type)
 	{ 
-	case XCBExpose:
+	case XCB_EXPOSE:
 	  {
-	    XCBCopyArea(c, rect, win, bgcolor,
+	    xcb_copy_area(c, rect, win, bgcolor,
 			0, 0, 0, 0, W_W, W_H);
 	    reflect_window (c, win, new_win,
 			    fgcolor,
 			    W_W, W_H);
-	    XCBFlush (c);
+	    xcb_flush (c);
 	    break;
 	  }
 	}
diff --git a/xcb-util/image/test_xcb_image_shm.c b/xcb-util/image/test_xcb_image_shm.c
index 3a068c0..a886daf 100644
--- a/xcb-util/image/test_xcb_image_shm.c
+++ b/xcb-util/image/test_xcb_image_shm.c
@@ -18,59 +18,59 @@
 int
 main (int argc, char *argv[])
 {
-  XCBConnection   *c;
-  XCBSCREEN       *screen;
-  XCBDRAWABLE      win;
-  XCBDRAWABLE      rect;
-  XCBRECTANGLE     rect_coord = { 0, 0, W_W, W_H};
-  XCBGCONTEXT      bgcolor, fgcolor;
-  XCBPOINT         points[2];
-  CARD32           mask;
-  CARD32           valgc[2];
-  CARD32           valwin[3];
+  xcb_connection_t   *c;
+  xcb_screen_t       *screen;
+  xcb_drawable_t      win;
+  xcb_drawable_t      rect;
+  xcb_rectangle_t     rect_coord = { 0, 0, W_W, W_H};
+  xcb_gcontext_t      bgcolor, fgcolor;
+  xcb_point_t         points[2];
+  uint32_t           mask;
+  uint32_t           valgc[2];
+  uint32_t           valwin[3];
   int              depth;
   int              screen_nbr;
-  XCBGenericEvent *e;
+  xcb_generic_event_t *e;
   
   /* Open the connexion to the X server and get the first screen */
-  c = XCBConnect (NULL, &screen_nbr);
-  screen = XCBAuxGetScreen (c, screen_nbr);
-  depth = XCBAuxGetDepth (c, screen);
+  c = xcb_connect (NULL, &screen_nbr);
+  screen = xcb_aux_get_screen (c, screen_nbr);
+  depth = xcb_aux_get_depth (c, screen);
 
   /* Create a black graphic context for drawing in the foreground */
   win.window = screen->root;
 
-  fgcolor = XCBGCONTEXTNew(c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  fgcolor = xcb_gcontext_new(c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC(c, fgcolor, win, mask, valgc);
+  xcb_create_gc(c, fgcolor, win, mask, valgc);
 
-  bgcolor = XCBGCONTEXTNew(c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  bgcolor = xcb_gcontext_new(c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC(c, bgcolor, win, mask, valgc);
+  xcb_create_gc(c, bgcolor, win, mask, valgc);
 
   /* Shm test */
   printf ("shm test begin\n");
-  XCBImage *img = 0;
-  XCBShmQueryVersionRep *rep;
-  XCBShmSegmentInfo shminfo;
+  xcb_image_t *img = 0;
+  xcb_shm_query_version_reply_t *rep;
+  xcb_shm_segment_info_t shminfo;
 
-  rep = XCBShmQueryVersionReply (c,
-				 XCBShmQueryVersion (c),
+  rep = xcb_shm_query_version_reply (c,
+				 xcb_shm_query_version (c),
 				 NULL);
   if (rep)
     {
-      CARD8 format;
+      uint8_t format;
       
       if (rep->shared_pixmaps && 
 	  (rep->major_version > 1 || rep->minor_version > 0))
 	format = rep->pixmap_format;
       else
 	format = 0;
-      img = XCBImageSHMCreate (c, depth, format, NULL, W_W, W_H);
+      img = xcb_image_shm_create (c, depth, format, NULL, W_W, W_H);
 
       printf ("Create image summary:\n");
       printf (" * format..........: %d\n", img->format);
@@ -85,8 +85,8 @@ main (int argc, char *argv[])
       shminfo.shmaddr = shmat(shminfo.shmid, 0, 0);
       img->data = shminfo.shmaddr;
 
-      shminfo.shmseg = XCBShmSEGNew (c);
-      XCBShmAttach(c, shminfo.shmseg,
+      shminfo.shmseg = xcb_shm_seg_new (c);
+      xcb_shm_attach(c, shminfo.shmseg,
 		   shminfo.shmid, 0);
       shmctl(shminfo.shmid, IPC_RMID, 0);
     }
@@ -99,63 +99,63 @@ main (int argc, char *argv[])
 
   /* Draw in the image */
   printf ("put the pixel\n");
-  XCBImagePutPixel (img, 20, 20, 65535);
+  xcb_image_put_pixel (img, 20, 20, 65535);
   printf ("fin put pixel\n");
 
   /* Ask for our window's Id */
-  win.window = XCBWINDOWNew(c);
+  win.window = xcb_window_new(c);
 
   /* Create the window */
-  mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
+  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
   valwin[0] = screen->white_pixel;
-  valwin[1] = XCBEventMaskKeyPress | XCBEventMaskButtonRelease | XCBEventMaskExposure;
-  valwin[2] = XCBEventMaskButtonPress;
-  XCBCreateWindow (c,                        /* Connection          */
+  valwin[1] = XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE;
+  valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS;
+  xcb_create_window (c,                        /* Connection          */
  		   0,                        /* depth               */
 		   win.window,               /* window Id           */
 		   screen->root,             /* parent window       */
 		   0, 0,                     /* x, y                */
 		   W_W, W_H,                 /* width, height       */
 		   10,                       /* border_width        */
-		   XCBWindowClassInputOutput,/* class               */
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,/* class               */
 		   screen->root_visual,      /* visual              */
 		   mask, valwin);            /* masks, not used yet */
 
   /* Map the window on the screen */
-  XCBMapWindow (c, win.window);
+  xcb_map_window (c, win.window);
 
   /* Create a Pixmap that will fill the window */
-  rect.pixmap = XCBPIXMAPNew (c);
-  XCBCreatePixmap(c, depth, rect.pixmap, win, W_W, W_H);
-  XCBPolyFillRectangle(c, rect, bgcolor, 1, &rect_coord);
+  rect.pixmap = xcb_pixmap_new (c);
+  xcb_create_pixmap(c, depth, rect.pixmap, win, W_W, W_H);
+  xcb_poly_fill_rectangle(c, rect, bgcolor, 1, &rect_coord);
   points[0].x = 0;
   points[0].y = 0;
   points[1].x = 1;
   points[1].y = 1;
-  XCBPolyLine(c, XCBCoordModeOrigin, rect, fgcolor, 2, points);
+  xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points);
 /*   points[0].x = 10; */
 /*   points[0].y = 10; */
 /*   points[1].x = 10; */
 /*   points[1].y = 40; */
-/*   XCBPolyLine(c, XCBCoordModeOrigin, rect, fgcolor, 2, points); */
+/*   xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, rect, fgcolor, 2, points); */
 
 
-  XCBFlush (c); 
+  xcb_flush (c); 
 
-  while ((e = XCBWaitForEvent(c)))
+  while ((e = xcb_wait_for_event(c)))
     {
       switch (e->response_type)
 	{ 
-	case XCBExpose:
+	case XCB_EXPOSE:
 	  {
-	    XCBCopyArea(c, rect, win, bgcolor,
+	    xcb_copy_area(c, rect, win, bgcolor,
 			0, 0, 0, 0, W_W, W_H);
 	    printf ("put image\n");
-	    XCBImageSHMPut (c, win, fgcolor,
+	    xcb_image_shm_put (c, win, fgcolor,
 			       img, shminfo,
 			       0, 0, 0, 0, W_W,W_H,
 			       0);
-	    XCBFlush (c);
+	    xcb_flush (c);
 	    break;
 	  }
 	}
diff --git a/xcb-util/image/xcb_image.c b/xcb-util/image/xcb_image.c
index 465936b..75be4da 100644
--- a/xcb-util/image/xcb_image.c
+++ b/xcb-util/image/xcb_image.c
@@ -10,20 +10,20 @@
 #include "xcb_image.h"
 
 /* Convenient */
-static CARD8          xcb_bits_per_pixel   (XCBConnection *c, CARD8 depth);
-static CARD32         xcb_bytes_per_line   (CARD8 pad, CARD16 width, CARD8 bpp);
-static CARD8          xcb_scanline_pad_get (XCBConnection *conn,
-					    CARD8          depth);
+static uint8_t          xcb_bits_per_pixel   (xcb_connection_t *c, uint8_t depth);
+static uint32_t         xcb_bytes_per_line   (uint8_t pad, uint16_t width, uint8_t bpp);
+static uint8_t          xcb_scanline_pad_get (xcb_connection_t *conn,
+					    uint8_t          depth);
 
-static inline CARD32 _lomask(int n)
+static inline uint32_t _lomask(int n)
 {
   return (1 << n) - 1;
 }
 
 static unsigned int Ones(                /* HAKMEM 169 */
-    CARD32 mask)
+    uint32_t mask)
 {
-    register CARD32 y;
+    register uint32_t y;
 
     y = (mask >> 1) &033333333333;
     y = mask - y - ((y >>1) & 033333333333);
@@ -33,11 +33,11 @@ static unsigned int Ones(               
 
 /* Convenient functions */
 
-static CARD8
-xcb_bits_per_pixel (XCBConnection *c, CARD8 depth)
+static uint8_t
+xcb_bits_per_pixel (xcb_connection_t *c, uint8_t depth)
 { 
-  XCBFORMAT *fmt = XCBSetupPixmapFormats(XCBGetSetup(c));
-  XCBFORMAT *fmtend = fmt + XCBSetupPixmapFormatsLength(XCBGetSetup(c));
+  xcb_format_t *fmt = xcb_setup_pixmap_formats(xcb_get_setup(c));
+  xcb_format_t *fmtend = fmt + xcb_setup_pixmap_formats_length(xcb_get_setup(c));
   
   for(; fmt != fmtend; ++fmt)
     if(fmt->depth == depth)
@@ -52,18 +52,18 @@ xcb_bits_per_pixel (XCBConnection *c, CA
   return 32;
 }
 
-static CARD32
-xcb_bytes_per_line (CARD8 pad, CARD16 width, CARD8 bpp)
+static uint32_t
+xcb_bytes_per_line (uint8_t pad, uint16_t width, uint8_t bpp)
 {
   return ((bpp * width + pad - 1) & -pad) >> 3;
 }
 
-static CARD8
-xcb_scanline_pad_get (XCBConnection *conn,
-		      CARD8          depth)
+static uint8_t
+xcb_scanline_pad_get (xcb_connection_t *conn,
+		      uint8_t          depth)
 {
-  XCBFORMAT *fmt = XCBSetupPixmapFormats(XCBGetSetup(conn));
-  XCBFORMAT *fmtend = fmt + XCBSetupPixmapFormatsLength(XCBGetSetup(conn));
+  xcb_format_t *fmt = xcb_setup_pixmap_formats(xcb_get_setup(conn));
+  xcb_format_t *fmtend = fmt + xcb_setup_pixmap_formats_length(xcb_get_setup(conn));
   
   for(; fmt != fmtend; ++fmt)
     if(fmt->depth == depth)
@@ -71,52 +71,52 @@ xcb_scanline_pad_get (XCBConnection *con
 	return fmt->scanline_pad;
       }
 
-  return XCBGetSetup (conn)->bitmap_format_scanline_pad;
+  return xcb_get_setup (conn)->bitmap_format_scanline_pad;
 
-/*   XCBFORMATIter iter; */
+/*   xcb_format_iterator_t iter; */
 /*   int           cur; */
 
-/*   iter =  XCBSetupPixmapFormatsIter (conn->setup); */
-/*   for (cur = 0 ; cur < iter.rem ; cur++, XCBFORMATNext (&iter)) */
+/*   iter =  xcb_setup_pixmap_formats_iterator (conn->setup); */
+/*   for (cur = 0 ; cur < iter.rem ; cur++, xcb_format_next (&iter)) */
 /*     if (iter.data->depth == depth) */
 /*       return iter.data->scanline_pad; */
   
-/*   return XCBGetSetup (conn)->bitmap_format_scanline_pad; */
+/*   return xcb_get_setup (conn)->bitmap_format_scanline_pad; */
 }
 
-static int format_invalid(CARD8 depth, CARD8 format, CARD8 xpad)
+static int format_invalid(uint8_t depth, uint8_t format, uint8_t xpad)
 {
   return (depth == 0 || depth > 32 ||
-      (format != XCBImageFormatXYBitmap &&
-       format != XCBImageFormatXYPixmap &&
-       format != XCBImageFormatZPixmap) ||
-      (format == XCBImageFormatXYBitmap && depth != 1) ||
+      (format != XCB_IMAGE_FORMAT_XY_BITMAP &&
+       format != XCB_IMAGE_FORMAT_XY_PIXMAP &&
+       format != XCB_IMAGE_FORMAT_Z_PIXMAP) ||
+      (format == XCB_IMAGE_FORMAT_XY_BITMAP && depth != 1) ||
       (xpad != 8 && xpad != 16 && xpad != 32));
 }
 
-XCBImage *
-XCBImageCreate (XCBConnection *conn,
-		CARD8          depth,
-		CARD8          format,
+xcb_image_t *
+xcb_image_create (xcb_connection_t *conn,
+		uint8_t          depth,
+		uint8_t          format,
 		unsigned int   offset,
-		BYTE          *data,
-		CARD16         width,
-		CARD16         height,
-		CARD8          xpad,
-		CARD32         bytes_per_line)
-{
-  XCBImage       *image;
-  const XCBSetup *rep;
-  CARD8          bpp = 1; /* bits per pixel */
+		uint8_t          *data,
+		uint16_t         width,
+		uint16_t         height,
+		uint8_t          xpad,
+		uint32_t         bytes_per_line)
+{
+  xcb_image_t       *image;
+  const xcb_setup_t *rep;
+  uint8_t          bpp = 1; /* bits per pixel */
 
   if (format_invalid(depth, format, xpad))
-    return (XCBImage *) NULL;
+    return (xcb_image_t *) NULL;
 
-  image = (XCBImage *)malloc (sizeof (XCBImage));
+  image = (xcb_image_t *)malloc (sizeof (xcb_image_t));
   if (image == NULL)
     return NULL;
   
-  rep = XCBGetSetup (conn);
+  rep = xcb_get_setup (conn);
 
   image->width = width;
   image->height = height;
@@ -126,7 +126,7 @@ XCBImageCreate (XCBConnection *conn,
   image->bitmap_format_bit_order = rep->bitmap_format_bit_order;
   image->bitmap_format_scanline_pad = xpad;
   
-  if (format == XCBImageFormatZPixmap) 
+  if (format == XCB_IMAGE_FORMAT_Z_PIXMAP) 
     {
       bpp = xcb_bits_per_pixel (conn, depth);
     }
@@ -140,7 +140,7 @@ XCBImageCreate (XCBConnection *conn,
    */
   if (bytes_per_line == 0)
     {
-      if (format == XCBImageFormatZPixmap)
+      if (format == XCB_IMAGE_FORMAT_Z_PIXMAP)
 	image->bytes_per_line = 
 	  xcb_bytes_per_line (image->bitmap_format_scanline_pad,
 			      width, bpp);
@@ -158,7 +158,7 @@ XCBImageCreate (XCBConnection *conn,
 }
 
 int
-XCBImageInit (XCBImage *image)
+xcb_image_init (xcb_image_t *image)
 {
   if (format_invalid(image->depth, image->format, image->bitmap_format_scanline_pad))
     return 0;
@@ -168,7 +168,7 @@ XCBImageInit (XCBImage *image)
    */
   if (image->bytes_per_line == 0)
     {
-      if (image->format == XCBImageFormatZPixmap)
+      if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP)
 	image->bytes_per_line = 
 	  xcb_bytes_per_line (image->bitmap_format_scanline_pad,
 			      image->width,
@@ -184,7 +184,7 @@ XCBImageInit (XCBImage *image)
 }
 
 int
-XCBImageDestroy (XCBImage *image)
+xcb_image_destroy (xcb_image_t *image)
 {
   if (image->data != NULL)
     free (image->data);
@@ -193,22 +193,22 @@ XCBImageDestroy (XCBImage *image)
   return 1;
 }
 
-XCBImage *
-XCBImageGet (XCBConnection *conn,
-	     XCBDRAWABLE    draw,
-	     INT16          x,
-	     INT16          y,
-	     CARD16         width,
-	     CARD16         height,
-	     CARD32         plane_mask,
-	     CARD8          format)
-{
-  XCBImage       *image;
-  XCBGetImageRep *rep;
-  BYTE           *data;
+xcb_image_t *
+xcb_image_get (xcb_connection_t *conn,
+	     xcb_drawable_t    draw,
+	     int16_t          x,
+	     int16_t          y,
+	     uint16_t         width,
+	     uint16_t         height,
+	     uint32_t         plane_mask,
+	     uint8_t          format)
+{
+  xcb_image_t       *image;
+  xcb_get_image_reply_t *rep;
+  uint8_t           *data;
 
-  rep = XCBGetImageReply (conn, 
-			  XCBGetImage (conn,
+  rep = xcb_get_image_reply (conn, 
+			  xcb_get_image (conn,
 				       format,
 				       draw,
 				       x, y,
@@ -218,14 +218,14 @@ XCBImageGet (XCBConnection *conn,
   if (!rep)
     return NULL;
 
-  data = malloc(XCBGetImageDataLength(rep));
+  data = malloc(xcb_get_image_data_length(rep));
   if (!data)
     return NULL;
-  memcpy(data, XCBGetImageData (rep), XCBGetImageDataLength (rep));
+  memcpy(data, xcb_get_image_data (rep), xcb_get_image_data_length (rep));
 
-  if (format == XCBImageFormatXYPixmap)
+  if (format == XCB_IMAGE_FORMAT_XY_PIXMAP)
     {
-      image = XCBImageCreate (conn,
+      image = xcb_image_create (conn,
 				Ones (plane_mask & _lomask(rep->depth)),
 				format,
 				0,
@@ -234,11 +234,11 @@ XCBImageGet (XCBConnection *conn,
 				xcb_scanline_pad_get (conn, rep->depth),
 				0);
     }
-  else /* format == XCBImageFormatZPixmap */
+  else /* format == XCB_IMAGE_FORMAT_Z_PIXMAP */
     {
-      image = XCBImageCreate (conn,
+      image = xcb_image_create (conn,
 				rep->depth,
-				XCBImageFormatZPixmap,
+				XCB_IMAGE_FORMAT_Z_PIXMAP,
 				0,
 				data,
 				width, height,
@@ -254,19 +254,19 @@ XCBImageGet (XCBConnection *conn,
 }
 
 int
-XCBImagePut (XCBConnection *conn,
-	     XCBDRAWABLE    draw,
-	     XCBGCONTEXT    gc,
-	     XCBImage      *image,
-	     INT16          x_offset,
-	     INT16          y_offset,
-	     INT16          x,
-	     INT16          y,
-	     CARD16         width,
-	     CARD16         height)
+xcb_image_put (xcb_connection_t *conn,
+	     xcb_drawable_t    draw,
+	     xcb_gcontext_t    gc,
+	     xcb_image_t      *image,
+	     int16_t          x_offset,
+	     int16_t          y_offset,
+	     int16_t          x,
+	     int16_t          y,
+	     uint16_t         width,
+	     uint16_t         height)
 {
-  INT32 w;
-  INT32 h;
+  int32_t w;
+  int32_t h;
   int dest_bits_per_pixel;
   int dest_scanline_pad;
   int left_pad;
@@ -295,21 +295,21 @@ XCBImagePut (XCBConnection *conn,
   if ((w <= 0) || (h <= 0))
     return 0;
 
-  if ((image->bits_per_pixel == 1) || (image->format != XCBImageFormatZPixmap))
+  if ((image->bits_per_pixel == 1) || (image->format != XCB_IMAGE_FORMAT_Z_PIXMAP))
     {
       dest_bits_per_pixel = 1;
-      dest_scanline_pad = XCBGetSetup (conn)->bitmap_format_scanline_pad;
-      left_pad = image->xoffset & (XCBGetSetup (conn)->bitmap_format_scanline_unit- 1);
+      dest_scanline_pad = xcb_get_setup (conn)->bitmap_format_scanline_pad;
+      left_pad = image->xoffset & (xcb_get_setup (conn)->bitmap_format_scanline_unit- 1);
     }
   else
     {
-      XCBFORMATIter iter;
+      xcb_format_iterator_t iter;
       
       dest_bits_per_pixel = image->bits_per_pixel;
       dest_scanline_pad = image->bitmap_format_scanline_pad;
       left_pad = 0;
-      iter = XCBSetupPixmapFormatsIter (XCBGetSetup (conn));
-      for (; iter.rem ; XCBFORMATNext (&iter))
+      iter = xcb_setup_pixmap_formats_iterator (xcb_get_setup (conn));
+      for (; iter.rem ; xcb_format_next (&iter))
 	if (iter.data->depth == image->depth)
 	  {
 	    dest_bits_per_pixel = iter.data->bits_per_pixel;
@@ -317,16 +317,16 @@ XCBImagePut (XCBConnection *conn,
 	  }
       
       if (dest_bits_per_pixel != image->bits_per_pixel) {
-	XCBImage       img;
-	register INT32 i, j;
-	const XCBSetup *rep;
+	xcb_image_t       img;
+	register int32_t i, j;
+	const xcb_setup_t *rep;
 	
 	/* XXX slow, but works */
-	rep = XCBGetSetup (conn);
+	rep = xcb_get_setup (conn);
 	img.width = width;
 	img.height = height;
 	img.xoffset = 0;
-	img.format = XCBImageFormatZPixmap;
+	img.format = XCB_IMAGE_FORMAT_Z_PIXMAP;
 	img.image_byte_order = rep->image_byte_order;
 	img.bitmap_format_scanline_unit = rep->bitmap_format_scanline_unit;
 	img.bitmap_format_bit_order = rep->bitmap_format_bit_order;
@@ -336,20 +336,20 @@ XCBImagePut (XCBConnection *conn,
 	img.bytes_per_line =  xcb_bytes_per_line (dest_scanline_pad,
 						  width,
 						  dest_bits_per_pixel);
-	img.data = malloc((CARD8) (img.bytes_per_line * height));
+	img.data = malloc((uint8_t) (img.bytes_per_line * height));
 	
 	if (img.data == NULL)
 	  return 0;
 	
 	for (j = height; --j >= 0; )
 	  for (i = width; --i >= 0; )
-	    XCBImagePutPixel(&img,
+	    xcb_image_put_pixel(&img,
 				i, j,
-				XCBImageGetPixel(image,
+				xcb_image_get_pixel(image,
 						    x_offset + i,
 						    y_offset + j));
 	
-	XCBPutImage(conn, img.format, draw, gc,
+	xcb_put_image(conn, img.format, draw, gc,
 		    w, h, x, y,
 		    dest_scanline_pad,
 		    img.depth,
@@ -361,7 +361,7 @@ XCBImagePut (XCBConnection *conn,
       }
     }
 
-  XCBPutImage(conn, image->format, draw, gc,
+  xcb_put_image(conn, image->format, draw, gc,
 	      w, h, x, y,
 	      left_pad,
 	      image->depth, image->bytes_per_line * height,
@@ -374,22 +374,22 @@ XCBImagePut (XCBConnection *conn,
  * Shm stuff
  */
 
-XCBImage *
-XCBImageSHMCreate (XCBConnection *conn,
-		   CARD8          depth,
-		   CARD8          format,
-		   BYTE          *data,
-		   CARD16         width,
-		   CARD16         height)
+xcb_image_t *
+xcb_image_shm_create (xcb_connection_t *conn,
+		   uint8_t          depth,
+		   uint8_t          format,
+		   uint8_t          *data,
+		   uint16_t         width,
+		   uint16_t         height)
 {
-  XCBImage       *image;
-  const XCBSetup *rep;
+  xcb_image_t       *image;
+  const xcb_setup_t *rep;
 
-  image = (XCBImage *)malloc (sizeof (XCBImage));
+  image = (xcb_image_t *)malloc (sizeof (xcb_image_t));
   if (!image)
     return NULL;
   
-  rep = XCBGetSetup (conn);
+  rep = xcb_get_setup (conn);
   
   image->width = width;
   image->height = height;
@@ -403,7 +403,7 @@ XCBImageSHMCreate (XCBConnection *conn,
   image->bitmap_format_bit_order = rep->bitmap_format_bit_order;
   image->bitmap_format_scanline_pad = xcb_scanline_pad_get (conn, depth);
 
-  if (format == XCBImageFormatZPixmap)
+  if (format == XCB_IMAGE_FORMAT_Z_PIXMAP)
     image->bits_per_pixel = xcb_bits_per_pixel (conn, depth);
   else
     image->bits_per_pixel = 1;
@@ -416,7 +416,7 @@ XCBImageSHMCreate (XCBConnection *conn,
 }
 
 int
-XCBImageSHMDestroy (XCBImage *image)
+xcb_image_shm_destroy (xcb_image_t *image)
 {
   if (image)
     free (image);
@@ -425,23 +425,23 @@ XCBImageSHMDestroy (XCBImage *image)
 }
 
 int
-XCBImageSHMPut (XCBConnection *conn,
-		XCBDRAWABLE    draw,
-		XCBGCONTEXT    gc,
-		XCBImage      *image,
-		XCBShmSegmentInfo shminfo,
-		INT16          src_x,
-		INT16          src_y,
-		INT16          dest_x,
-		INT16          dest_y,
-		CARD16         src_width,
-		CARD16         src_height,
-		CARD8          send_event)
+xcb_image_shm_put (xcb_connection_t *conn,
+		xcb_drawable_t    draw,
+		xcb_gcontext_t    gc,
+		xcb_image_t      *image,
+		xcb_shm_segment_info_t shminfo,
+		int16_t          src_x,
+		int16_t          src_y,
+		int16_t          dest_x,
+		int16_t          dest_y,
+		uint16_t         src_width,
+		uint16_t         src_height,
+		uint8_t          send_event)
 {
   if (!shminfo.shmaddr)
     return 0;
 
-  XCBShmPutImage(conn, draw, gc,
+  xcb_shm_put_image(conn, draw, gc,
 		 image->width, image->height,
 		 src_x, src_y, src_width, src_height,
 		 dest_x, dest_y,
@@ -453,29 +453,29 @@ XCBImageSHMPut (XCBConnection *conn,
 }
 
 int
-XCBImageSHMGet (XCBConnection *conn,
-		XCBDRAWABLE    draw,
-		XCBImage      *image,
-		XCBShmSegmentInfo shminfo,
-		INT16          x,
-		INT16          y,
-		CARD32         plane_mask)
-{
-  XCBShmGetImageRep *rep;
-  XCBShmGetImageCookie cookie;
-  XCBGenericError *err = NULL;
+xcb_image_shm_get (xcb_connection_t *conn,
+		xcb_drawable_t    draw,
+		xcb_image_t      *image,
+		xcb_shm_segment_info_t shminfo,
+		int16_t          x,
+		int16_t          y,
+		uint32_t         plane_mask)
+{
+  xcb_shm_get_image_reply_t *rep;
+  xcb_shm_get_image_cookie_t cookie;
+  xcb_generic_error_t *err = NULL;
 
   if (!shminfo.shmaddr)
     return 0;
 
-  cookie = XCBShmGetImage(conn, draw,
+  cookie = xcb_shm_get_image(conn, draw,
 			  x, y,
 			  image->width, image->height,
 			  plane_mask,
 			  image->format,
 			  shminfo.shmseg,
 			  image->data - shminfo.shmaddr);
-  rep = XCBShmGetImageReply(conn, cookie, &err);
+  rep = xcb_shm_get_image_reply(conn, cookie, &err);
   /* rep would be useful to get the visual id */
   /* but i don't use it */
   /* So, should we remove it ? */
@@ -495,25 +495,25 @@ XCBImageSHMGet (XCBConnection *conn,
 
 /* GetPixel/PutPixel */
 
-static inline int XYINDEX (int x, XCBImage *img, int *bitp)
+static inline int XYINDEX (int x, xcb_image_t *img, int *bitp)
 {
  int mask = img->bitmap_format_scanline_unit - 1;
   int unit = (x + img->xoffset) & ~mask;
   int byte = (x + img->xoffset) & mask;
-  if (img->bitmap_format_bit_order == XCBImageOrderMSBFirst)
+  if (img->bitmap_format_bit_order == XCB_IMAGE_ORDER_MSB_FIRST)
     byte = img->bitmap_format_scanline_unit - byte;
   *bitp = byte & 7;
-  if (img->image_byte_order == XCBImageOrderMSBFirst)
+  if (img->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
     byte = img->bitmap_format_scanline_unit - byte;
   return (unit + byte) >> 3;
 }
 
-static inline int ZINDEX (int x, XCBImage *img)
+static inline int ZINDEX (int x, xcb_image_t *img)
 {
   return (x * img->bits_per_pixel) >> 3;
 }
 
-static inline void set_bit (CARD8 *byte, int bit, int value)
+static inline void set_bit (uint8_t *byte, int bit, int value)
 {
   if (value)
     *byte |= 1 << bit;
@@ -522,11 +522,11 @@ static inline void set_bit (CARD8 *byte,
 }
 
 int
-XCBImagePutPixel (XCBImage *image, int x, int y, CARD32 pixel)
+xcb_image_put_pixel (xcb_image_t *image, int x, int y, uint32_t pixel)
 {
-  register BYTE *src = image->data + (y * image->bytes_per_line);
+  register uint8_t *src = image->data + (y * image->bytes_per_line);
 
-  if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1)
+  if (image->format == XCB_IMAGE_FORMAT_XY_PIXMAP || (image->bits_per_pixel | image->depth) == 1)
     {
       int plane, bit;
       /* do least signif plane 1st */
@@ -538,17 +538,17 @@ XCBImagePutPixel (XCBImage *image, int x
 	}
     }
   else
-    if (image->format == XCBImageFormatZPixmap)
+    if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP)
       {
 	src += ZINDEX(x, image);
 	if (image->bits_per_pixel == 4)
 	{
-	  CARD8 mask = ~_lomask(4);
+	  uint8_t mask = ~_lomask(4);
 	  pixel &= _lomask(image->depth);
 	  /* if x is odd and byte order is LSB, or
 	   * if x is even and byte order is MSB, then
 	   * want high nibble; else want low nibble. */
-	  if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst))
+	  if ((x & 1) == (image->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST))
 	  {
 	    mask = ~mask;
 	    pixel <<= 4;
@@ -558,7 +558,7 @@ XCBImagePutPixel (XCBImage *image, int x
 	else
 	{
 	  int nbytes = image->bits_per_pixel >> 3;
-	  int rev = image->image_byte_order == XCBImageOrderMSBFirst;
+	  int rev = image->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST;
 	  if(rev)
 	    src += nbytes - 1;
 	  while (--nbytes >= 0)
@@ -579,13 +579,13 @@ XCBImagePutPixel (XCBImage *image, int x
   return 1;
 }
 
-CARD32
-XCBImageGetPixel (XCBImage *image, int x, int y)
+uint32_t
+xcb_image_get_pixel (xcb_image_t *image, int x, int y)
 {
-  CARD32         pixel = 0;
-  register BYTE *src = image->data + (y * image->bytes_per_line);
+  uint32_t         pixel = 0;
+  register uint8_t *src = image->data + (y * image->bytes_per_line);
   
-  if (image->format == XCBImageFormatXYPixmap || (image->bits_per_pixel | image->depth) == 1)
+  if (image->format == XCB_IMAGE_FORMAT_XY_PIXMAP || (image->bits_per_pixel | image->depth) == 1)
     {
       int plane, bit;
       src += XYINDEX(x, image, &bit);
@@ -597,7 +597,7 @@ XCBImageGetPixel (XCBImage *image, int x
 	}
     }
   else
-    if (image->format == XCBImageFormatZPixmap)
+    if (image->format == XCB_IMAGE_FORMAT_Z_PIXMAP)
       {
 	src += ZINDEX(x, image);
 	if (image->bits_per_pixel == 4)
@@ -606,13 +606,13 @@ XCBImageGetPixel (XCBImage *image, int x
 	  /* if x is odd and byte order is LSB, or
 	   * if x is even and byte order is MSB, then
 	   * want high nibble; else want low nibble. */
-	  if ((x & 1) == (image->image_byte_order == XCBImageOrderLSBFirst))
+	  if ((x & 1) == (image->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST))
 	    pixel >>= 4;
 	}
 	else
 	{
 	  int nbytes = image->bits_per_pixel >> 3;
-	  int rev = image->image_byte_order == XCBImageOrderMSBFirst;
+	  int rev = image->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST;
 	  if(rev)
 	    src += nbytes - 1;
 	  while (--nbytes >= 0)
diff --git a/xcb-util/image/xcb_image.h b/xcb-util/image/xcb_image.h
index a336268..751f361 100644
--- a/xcb-util/image/xcb_image.h
+++ b/xcb-util/image/xcb_image.h
@@ -11,7 +11,7 @@ extern "C" {
 
 
 /**
- * @defgroup XCB_Image XCB Image Functions
+ * @defgroup xcb__image_t XCB Image Functions
  *
  * Functions used to create and manipulate images.
  *
@@ -19,40 +19,40 @@ extern "C" {
  */
 
 
-typedef struct XCBImage_ XCBImage;
+typedef struct xcb_image_t xcb_image_t;
 
 /**
- * @struct XCBImage
- * A structure that describes an XCBImage.
+ * @struct xcb_image_t
+ * A structure that describes an xcb_image_t.
  */
-struct XCBImage_
+struct xcb_image_t
 {
-  CARD16         width;
-  CARD16         height;
+  uint16_t         width;
+  uint16_t         height;
   unsigned int   xoffset;
-  CARD8          format;
-  BYTE          *data;
-  CARD8          image_byte_order;
-  CARD8          bitmap_format_scanline_unit;
-  CARD8          bitmap_format_bit_order;
-  CARD8          bitmap_format_scanline_pad;
-  CARD8          depth;
-  CARD32         bytes_per_line;
-  CARD8          bits_per_pixel;
+  uint8_t          format;
+  uint8_t          *data;
+  uint8_t          image_byte_order;
+  uint8_t          bitmap_format_scanline_unit;
+  uint8_t          bitmap_format_bit_order;
+  uint8_t          bitmap_format_scanline_pad;
+  uint8_t          depth;
+  uint32_t         bytes_per_line;
+  uint8_t          bits_per_pixel;
 };
 
-typedef struct XCBShmSegmentInfo_ XCBShmSegmentInfo;
+typedef struct xcb_shm_segment_info_t xcb_shm_segment_info_t;
 
 /**
- * @struct XCBShmSegmentInfo
+ * @struct xcb_shm_segment_info_t
  * A structure that stores the informations needed by the MIT Shm
  * Extension.
  */
-struct XCBShmSegmentInfo_
+struct xcb_shm_segment_info_t
 {
-  XCBShmSEG shmseg;
-  CARD32    shmid;
-  BYTE     *shmaddr;
+  xcb_shm_seg_t shmseg;
+  uint32_t    shmid;
+  uint8_t     *shmaddr;
 };
 
 /**
@@ -71,27 +71,27 @@ struct XCBShmSegmentInfo_
  * between the start of one scanline and the start of the next.
  * @return The new image.
  *
- * This function allocates the memory needed for an XCBImage structure
+ * This function allocates the memory needed for an xcb_image_t structure
  * for the specified connection but does not allocate space for the image
  * itself. It initializes the structure byte-order, bit-order, and
  * bitmap-unit values from the connection and returns a pointer to the
- * XCBImage structure.
+ * xcb_image_t structure.
  *
  * The @p offset parameter permits the rapid displaying of the image
  * without requiring each scanline to be shifted into position.
  *
- * The image must be destroyed with @ref XCBImageDestroy.
- * @ingroup XCB_Image
+ * The image must be destroyed with @ref xcb_image_destroy_t.
+ * @ingroup xcb__image_t
  */
-XCBImage *XCBImageCreate (XCBConnection *conn,
-			  CARD8          depth,
-			  CARD8          format,
+xcb_image_t *xcb_image_create (xcb_connection_t *conn,
+			  uint8_t          depth,
+			  uint8_t          format,
 			  unsigned int   offset,
-			  BYTE          *data,
-			  CARD16         width,
-			  CARD16         height,
-			  CARD8          xpad,
-			  CARD32         bytes_per_line);
+			  uint8_t          *data,
+			  uint16_t         width,
+			  uint16_t         height,
+			  uint8_t          xpad,
+			  uint32_t         bytes_per_line);
 
 /**
  * Initialize an Image.
@@ -99,9 +99,9 @@ XCBImage *XCBImageCreate (XCBConnection 
  * @return 1 if the operation has succeeded.
  *
  * This function  initializes the image structure.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImageInit (XCBImage *image);
+int xcb_image_init (xcb_image_t *image);
 
 /**
  * Destroy an Image.
@@ -110,14 +110,14 @@ int XCBImageInit (XCBImage *image);
  *
  * This function deallocates both the memory associated with the @p image
  * parameter and its data.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImageDestroy (XCBImage *image);
+int xcb_image_destroy (xcb_image_t *image);
 
-#define XCBAllPlanes ((CARD32)~0L)
+#define XCB_ALL_PLANES ((uint32_t)~0L)
 
 /**
- * Return a pointer to a XCBImage.
+ * Return a pointer to a xcb_image_t.
  * @param conn The connection to the X server.
  * @param draw The draw you get the image from.
  * @param x The x coordinate, which are relative to the origin of the
@@ -126,7 +126,7 @@ int XCBImageDestroy (XCBImage *image);
  * drawable and define the upper-left corner of the rectangle.
  * @param width The width of the subimage, in pixels.
  * @param height The height of the subimage, in pixels.
- * @param plane_mask The plane mask (can be XCBAllPlanes).
+ * @param plane_mask The plane mask (can be xcb_all_planes_t).
  * @param format The format of the image. You can pass XYBitmap,
  * XYPixmap, or ZPixmap.
  * @return The subimage of @p draw defined by @p x, @p y, @p w, @p h.
@@ -137,40 +137,40 @@ int XCBImageDestroy (XCBImage *image);
  * format.
  *
  * If a problem occurs, the functons returns @c NULL.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-XCBImage *XCBImageGet (XCBConnection *conn,
-		       XCBDRAWABLE    draw,
-		       INT16          x,
-		       INT16          y,
-		       CARD16         width,
-		       CARD16         height,
-		       CARD32         plane_mask,
-		       CARD8          format);
+xcb_image_t *xcb_image_get (xcb_connection_t *conn,
+		       xcb_drawable_t    draw,
+		       int16_t          x,
+		       int16_t          y,
+		       uint16_t         width,
+		       uint16_t         height,
+		       uint32_t         plane_mask,
+		       uint8_t          format);
 
 /* Not implemented. Should be ? */
-XCBImage xcb_image_subimage_get (XCBConnection *conn,
-				 XCBDRAWABLE    draw,
+xcb_image_t xcb_image_subimage_get (xcb_connection_t *conn,
+				 xcb_drawable_t    draw,
 				 int            x,
 				 int            y,
 				 unsigned int   width,
 				 unsigned int   height,
 				 unsigned long  plane_mask,
-				 CARD8          format,
-				 XCBImage      *dest_im,
+				 uint8_t          format,
+				 xcb_image_t      *dest_im,
 				 int            dest_x,
 				 int            dest_y);
 
 /**
- * Put the data of an XCBImage onto a drawable.
+ * Put the data of an xcb_image_t onto a drawable.
  * @param conn The connection to the X server.
  * @param draw The draw you get the image from.
  * @param gc The graphic context.
  * @param image The image you want to combine with the rectangle.
  * @param x_offset The offset in x from the left edge of the image
- * defined by the XCBImage structure.
+ * defined by the xcb_image_t structure.
  * @param y_offset The offset in y from the left edge of the image
- * defined by the XCBImage structure.
+ * defined by the xcb_image_t structure.
  * @param x The x coordinate, which is relative to the origin of the
  * drawable and defines the x coordinate of the upper-left corner of the
  * rectangle.
@@ -190,18 +190,18 @@ XCBImage xcb_image_subimage_get (XCBConn
  * depth of the image must match the depth of the drawable.
  *
  * If a problem occurs, the functons returns @c NULL.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImagePut (XCBConnection *conn,
-		 XCBDRAWABLE    draw,
-		 XCBGCONTEXT    gc,
-		 XCBImage      *image,
-		 INT16          x_offset,
-		 INT16          y_offset,
-		 INT16          x,
-		 INT16          y,
-		 CARD16         width,
-		 CARD16         height);
+int xcb_image_put (xcb_connection_t *conn,
+		 xcb_drawable_t    draw,
+		 xcb_gcontext_t    gc,
+		 xcb_image_t      *image,
+		 int16_t          x_offset,
+		 int16_t          y_offset,
+		 int16_t          x,
+		 int16_t          y,
+		 uint16_t         width,
+		 uint16_t         height);
 
 /**
  * Put a pixel in a image
@@ -216,12 +216,12 @@ int XCBImagePut (XCBConnection *conn,
  * format (that is, the least-significant byte of the long is the
  * least-significant byte of the pixel). The image must contain the @p x
  * and @p y coordinates.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImagePutPixel (XCBImage *image,
+int xcb_image_put_pixel (xcb_image_t *image,
 		      int       x,
 		      int       y,
-		      CARD32    pixel);
+		      uint32_t    pixel);
 
 /**
  * Get a pixel in a image
@@ -234,9 +234,9 @@ int XCBImagePutPixel (XCBImage *image,
  * pixel value is returned in normalized format (that is, the
  * least-significant byte of the long is the least-significant byte of
  * the pixel). The image must contain the @p x and @p y coordinates.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-CARD32 XCBImageGetPixel (XCBImage *image,
+uint32_t xcb_image_get_pixel (xcb_image_t *image,
 			 int       x,
 			 int       y);
 
@@ -245,7 +245,7 @@ CARD32 XCBImageGetPixel (XCBImage *image
  */
 
 /**
- * Create an XCBImage to be used with the MIT Shm Extension
+ * Create an xcb_image_t to be used with the MIT Shm Extension
  * @param conn The connection to the X server.
  * @param depth The depth of the image.
  * @param format The format of the image. You can pass XYBitmap,
@@ -255,44 +255,44 @@ CARD32 XCBImageGetPixel (XCBImage *image
  * @param height The height of the image, in pixels.
  * @return The new image.
  *
- * This function allocates the memory needed for an XCBImage structure
+ * This function allocates the memory needed for an xcb_image_t structure
  * for the specified display but does not allocate space for the image
  * itself.
  *
- * The image must be destroyed with @ref XCBImageSHMDestroy.
+ * The image must be destroyed with @ref xcb_image_shm_destroy_t.
  *
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-XCBImage *XCBImageSHMCreate (XCBConnection *conn,
-			     CARD8          depth,
-			     CARD8          format,
-			     BYTE          *data,
-			     CARD16         width,
-			     CARD16         height);
+xcb_image_t *xcb_image_shm_create (xcb_connection_t *conn,
+			     uint8_t          depth,
+			     uint8_t          format,
+			     uint8_t          *data,
+			     uint16_t         width,
+			     uint16_t         height);
 
 /**
- * Destroy an Image created by XCBImageSHMCreate.
+ * Destroy an Image created by xcb_image_shm_create_t.
  * @param image The image to be destroyed.
  * @return 1 if the operation has succeeded.
  *
  * This function deallocates both the memory associated with the @p image
  * parameter and its data.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImageSHMDestroy (XCBImage *image);
+int xcb_image_shm_destroy (xcb_image_t *image);
 
 /**
- * Put the data of an XCBImage onto a drawable using the MIT Shm
+ * Put the data of an xcb_image_t onto a drawable using the MIT Shm
  * Extension.
  * @param conn The connection to the X server.
  * @param draw The draw you get the image from.
  * @param gc The graphic context.
  * @param image The image you want to combine with the rectangle.
- * @param shminfo A @ref XCBShmSegmentInfo structure.
+ * @param shminfo A @ref xcb_shm_segment_info_t structure.
  * @param x The offset in x from the left edge of the image
- * defined by the XCBImage structure.
+ * defined by the xcb_image_t structure.
  * @param y The offset in y from the left edge of the image
- * defined by the XCBImage structure.
+ * defined by the xcb_image_t structure.
  * @param dest_x The x coordinate, which is relative to the origin of the
  * drawable and defines the x coordinate of the upper-left corner of the
  * rectangle.
@@ -317,27 +317,27 @@ int XCBImageSHMDestroy (XCBImage *image)
  *
  * If a problem occurs, the functons returns @c 0. Otherwise, it
  * returns @c 1.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImageSHMPut (XCBConnection    *conn,
-		    XCBDRAWABLE       draw,
-		    XCBGCONTEXT       gc,
-		    XCBImage         *image,
-		    XCBShmSegmentInfo shminfo,
-		    INT16             x,
-		    INT16             y,
-		    INT16             dest_x,
-		    INT16             dest_y,
-		    CARD16            width,
-		    CARD16            height,
-		    CARD8             send_event);
+int xcb_image_shm_put (xcb_connection_t    *conn,
+		    xcb_drawable_t       draw,
+		    xcb_gcontext_t       gc,
+		    xcb_image_t         *image,
+		    xcb_shm_segment_info_t shminfo,
+		    int16_t             x,
+		    int16_t             y,
+		    int16_t             dest_x,
+		    int16_t             dest_y,
+		    uint16_t            width,
+		    uint16_t            height,
+		    uint8_t             send_event);
 
 /**
- * Read image data into a shared memory XCBImage.
+ * Read image data into a shared memory xcb_image_t.
  * @param conn The connection to the X server.
  * @param draw The draw you get the image from.
  * @param image The image you want to combine with the rectangle.
- * @param shminfo A @ref XCBShmSegmentInfo structure.
+ * @param shminfo A @ref xcb_shm_segment_info_t structure.
  * @param x The x coordinate, which are relative to the origin of the
  * drawable and define the upper-left corner of the rectangle.
  * @param y The y coordinate, which are relative to the origin of the
@@ -345,23 +345,23 @@ int XCBImageSHMPut (XCBConnection    *co
  * @param plane_mask The plane mask.
  * @return The subimage of @p draw defined by @p x, @p y, @p w, @p h.
  *
- * This function reads image data into a shared memory XCBImage where
+ * This function reads image data into a shared memory xcb_image_t where
  * @p conn is the connection to the X server, @p draw is the source
- * drawable, @p image is the destination XCBImage, @p x and @p y are offsets
+ * drawable, @p image is the destination xcb_image_t, @p x and @p y are offsets
  * within the drawable, and @p plane_mask defines which planes are to be
  * read.
  *
  * If a problem occurs, the functons returns @c 0. It returns 1
  * otherwise.
- * @ingroup XCB_Image
+ * @ingroup xcb__image_t
  */
-int XCBImageSHMGet (XCBConnection    *conn,
-		    XCBDRAWABLE       draw,
-		    XCBImage         *image,
-		    XCBShmSegmentInfo shminfo,
-		    INT16             x,
-		    INT16             y,
-		    CARD32            plane_mask);
+int xcb_image_shm_get (xcb_connection_t    *conn,
+		    xcb_drawable_t       draw,
+		    xcb_image_t         *image,
+		    xcb_shm_segment_info_t shminfo,
+		    int16_t             x,
+		    int16_t             y,
+		    uint32_t            plane_mask);
 
 /**
  * @}
diff --git a/xcb-util/keysyms/keysyms.c b/xcb-util/keysyms/keysyms.c
index 7756947..90649d6 100644
--- a/xcb-util/keysyms/keysyms.c
+++ b/xcb-util/keysyms/keysyms.c
@@ -22,42 +22,42 @@ enum tag_t {
 
 struct _XCBKeySymbols
 {
-  XCBConnection *c;
+  xcb_connection_t *c;
   enum tag_t     tag;
   union {
-    XCBGetKeyboardMappingCookie cookie;
-    XCBGetKeyboardMappingRep *reply;
+    xcb_get_keyboard_mapping_cookie_t cookie;
+    xcb_get_keyboard_mapping_reply_t *reply;
   } u;
 };
 
-static void XCBConvertCase(XCBKEYSYM  sym,
-			   XCBKEYSYM *lower,
-			   XCBKEYSYM *upper);
+static void xcb_convert_case(xcb_keysym_t  sym,
+			   xcb_keysym_t *lower,
+			   xcb_keysym_t *upper);
 
-static void XCBKeySymbolsGetReply (XCBKeySymbols    *syms,
-				   XCBGenericError **e);
+static void xcb_key_symbols_get_reply (xcb_key_symbols_t    *syms,
+				   xcb_generic_error_t **e);
 
 /* public implementation */
 
-XCBKeySymbols *
-XCBKeySymbolsAlloc (XCBConnection *c)
+xcb_key_symbols_t *
+xcb_key_symbols_alloc (xcb_connection_t *c)
 {
-  XCBKeySymbols *syms;
-  XCBKEYCODE     min_keycode;
-  XCBKEYCODE     max_keycode;
+  xcb_key_symbols_t *syms;
+  xcb_keycode_t     min_keycode;
+  xcb_keycode_t     max_keycode;
 
   if (!c)
     return NULL;
 
-  syms = (XCBKeySymbols *)malloc (sizeof (XCBKeySymbols));
+  syms = (xcb_key_symbols_t *)malloc (sizeof (xcb_key_symbols_t));
 
   syms->c = c;
   syms->tag = TAG_COOKIE;
 
-  min_keycode = XCBGetSetup (c)->min_keycode;
-  max_keycode = XCBGetSetup (c)->max_keycode;
+  min_keycode = xcb_get_setup (c)->min_keycode;
+  max_keycode = xcb_get_setup (c)->max_keycode;
   
-  syms->u.cookie = XCBGetKeyboardMapping(c,
+  syms->u.cookie = xcb_get_keyboard_mapping(c,
 					 min_keycode,
 					 max_keycode.id - min_keycode.id + 1);
   
@@ -65,7 +65,7 @@ XCBKeySymbolsAlloc (XCBConnection *c)
 }
 
 void
-XCBKeySymbolsFree (XCBKeySymbols *syms)
+xcb_key_symbols_free (xcb_key_symbols_t *syms)
 {
   if (syms)
     {
@@ -153,26 +153,26 @@ rule that is satisfied from the followin
 
 */
 
-XCBKEYSYM XCBKeySymbolsGetKeysym (XCBKeySymbols *syms,
-				  XCBKEYCODE     keycode,
+xcb_keysym_t xcb_key_symbols_get_keysym (xcb_key_symbols_t *syms,
+				  xcb_keycode_t     keycode,
 				  int            col)
 {
-  XCBKEYSYM *keysyms;
-  XCBKEYSYM  keysym_null = { 0 };
-  XCBKEYSYM  lsym;
-  XCBKEYSYM  usym;
-  XCBKEYCODE min_keycode;
-  XCBKEYCODE max_keycode;
+  xcb_keysym_t *keysyms;
+  xcb_keysym_t  keysym_null = { 0 };
+  xcb_keysym_t  lsym;
+  xcb_keysym_t  usym;
+  xcb_keycode_t min_keycode;
+  xcb_keycode_t max_keycode;
   int        per;
   
   if (!syms)
     return keysym_null;
   
-  XCBKeySymbolsGetReply (syms, NULL);
+  xcb_key_symbols_get_reply (syms, NULL);
   
-  keysyms = XCBGetKeyboardMappingKeysyms (syms->u.reply);
-  min_keycode = XCBGetSetup (syms->c)->min_keycode;
-  max_keycode = XCBGetSetup (syms->c)->max_keycode;
+  keysyms = xcb_get_keyboard_mapping_keysyms (syms->u.reply);
+  min_keycode = xcb_get_setup (syms->c)->min_keycode;
+  max_keycode = xcb_get_setup (syms->c)->max_keycode;
 
   per = syms->u.reply->keysyms_per_keycode;
   if ((col < 0) || ((col >= per) && (col > 3)) ||
@@ -192,7 +192,7 @@ XCBKEYSYM XCBKeySymbolsGetKeysym (XCBKey
 	}
       if ((per <= (col|1)) || (keysyms[col|1].id == 0))
 	{
-	  XCBConvertCase(keysyms[col&~1], &lsym, &usym);
+	  xcb_convert_case(keysyms[col&~1], &lsym, &usym);
 	  if (!(col & 1))
 	    return lsym;
 	  else if (usym.id == lsym.id)
@@ -205,27 +205,27 @@ XCBKEYSYM XCBKeySymbolsGetKeysym (XCBKey
 }
 
 
-XCBKEYCODE
-XCBKeySymbolsGetKeycode (XCBKeySymbols *syms,
-			 XCBKEYSYM      keysym)
+xcb_keycode_t
+xcb_key_symbols_get_keycode (xcb_key_symbols_t *syms,
+			 xcb_keysym_t      keysym)
 {
-  XCBKEYSYM    ks;
-  XCBKEYCODE   keycode_null = { 0 };
+  xcb_keysym_t    ks;
+  xcb_keycode_t   keycode_null = { 0 };
   int          i, j;
 
   if (!syms)
     return keycode_null;
   
-  XCBKeySymbolsGetReply (syms, NULL);
+  xcb_key_symbols_get_reply (syms, NULL);
 
   for (j = 0; j < syms->u.reply->keysyms_per_keycode; j++)
     {
-      for (i = XCBGetSetup (syms->c)->min_keycode.id; i <= XCBGetSetup (syms->c)->max_keycode.id; i++)
+      for (i = xcb_get_setup (syms->c)->min_keycode.id; i <= xcb_get_setup (syms->c)->max_keycode.id; i++)
 	{
-	  XCBKEYCODE keycode;
+	  xcb_keycode_t keycode;
 	  
 	  keycode.id = i;
-	  ks = XCBKeySymbolsGetKeysym (syms, keycode, j);
+	  ks = xcb_key_symbols_get_keysym (syms, keycode, j);
 	  if (ks.id == keysym.id)
 	    return keycode;
 	}
@@ -234,40 +234,40 @@ XCBKeySymbolsGetKeycode (XCBKeySymbols *
   return keycode_null;
 }
 
-XCBKEYSYM
-XCBKeyPressLookupKeysym (XCBKeySymbols    *syms,
-			 XCBKeyPressEvent *event,
+xcb_keysym_t
+xcb_key_press_lookup_keysym (xcb_key_symbols_t    *syms,
+			 xcb_key_press_event_t *event,
 			 int               col)
 {
-  return XCBKeySymbolsGetKeysym (syms, event->detail, col);
+  return xcb_key_symbols_get_keysym (syms, event->detail, col);
 }
 
-XCBKEYSYM
-XCBKeyReleaseLookupKeysym (XCBKeySymbols      *syms,
-			   XCBKeyReleaseEvent *event,
+xcb_keysym_t
+xcb_key_release_lookup_keysym (xcb_key_symbols_t      *syms,
+			   xcb_key_release_event_t *event,
 			   int                 col)
 {
-  return XCBKeySymbolsGetKeysym (syms, event->detail, col);
+  return xcb_key_symbols_get_keysym (syms, event->detail, col);
 }
 
 int
-XCBRefreshKeyboardMapping (XCBKeySymbols         *syms,
-			   XCBMappingNotifyEvent *event)
+xcb_refresh_keyboard_mapping (xcb_key_symbols_t         *syms,
+			   xcb_mapping_notify_event_t *event)
 {
-  if (event->request == XCBMappingKeyboard && syms) {
+  if (event->request == XCB_MAPPING_KEYBOARD && syms) {
     if (syms->tag == TAG_VALUE) {
-      XCBKEYCODE     min_keycode;
-      XCBKEYCODE     max_keycode;
+      xcb_keycode_t     min_keycode;
+      xcb_keycode_t     max_keycode;
 
       if (syms->u.reply) {
 	free (syms->u.reply);
 	syms->u.reply = NULL;
       }
       syms->tag = TAG_COOKIE;
-      min_keycode = XCBGetSetup (syms->c)->min_keycode;
-      max_keycode = XCBGetSetup (syms->c)->max_keycode;
+      min_keycode = xcb_get_setup (syms->c)->min_keycode;
+      max_keycode = xcb_get_setup (syms->c)->max_keycode;
   
-      syms->u.cookie = XCBGetKeyboardMapping(syms->c,
+      syms->u.cookie = xcb_get_keyboard_mapping(syms->c,
 					     min_keycode,
 					     max_keycode.id - min_keycode.id + 1);
       
@@ -281,43 +281,43 @@ XCBRefreshKeyboardMapping (XCBKeySymbols
 /* Tests for classes of symbols */
 
 int
-XCBIsKeypadKey (XCBKEYSYM keysym)
+xcb_is_keypad_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= XK_KP_Space) && (keysym.id <= XK_KP_Equal));
 }
 
 int
-XCBIsPrivateKeypadKey (XCBKEYSYM keysym)
+xcb_is_private_keypad_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= 0x11000000) && (keysym.id <= 0x1100FFFF));
 }
 
 int
-XCBIsCursorKey (XCBKEYSYM keysym)
+xcb_is_cursor_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= XK_Home) && (keysym.id <= XK_Select));
 }
 
 int
-XCBIsPFKey (XCBKEYSYM keysym)
+xcb_is_pf_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= XK_KP_F1) && (keysym.id <= XK_KP_F4));
 }
 
 int
-XCBIsFunctionKey (XCBKEYSYM keysym)
+xcb_is_function_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= XK_F1) && (keysym.id <= XK_F35));
 }
 
 int
-XCBIsMiscFunctionKey (XCBKEYSYM keysym)
+xcb_is_misc_function_key (xcb_keysym_t keysym)
 {
   return ((keysym.id >= XK_Select) && (keysym.id <= XK_Break));
 }
 
 int
-XCBIsModifierKey (XCBKEYSYM keysym)
+xcb_is_modifier_key (xcb_keysym_t keysym)
 {
   return  (((keysym.id >= XK_Shift_L)  && (keysym.id <= XK_Hyper_R)) ||
 	   ((keysym.id >= XK_ISO_Lock) && (keysym.id <= XK_ISO_Last_Group_Lock)) ||
@@ -328,9 +328,9 @@ XCBIsModifierKey (XCBKEYSYM keysym)
 /* private functions */
 
 void
-XCBConvertCase(XCBKEYSYM  sym,
-	       XCBKEYSYM *lower,
-	       XCBKEYSYM *upper)
+xcb_convert_case(xcb_keysym_t  sym,
+	       xcb_keysym_t *lower,
+	       xcb_keysym_t *upper)
 {
   lower->id = sym.id;
   upper->id = sym.id;
@@ -439,8 +439,8 @@ XCBConvertCase(XCBKEYSYM  sym,
 }
 
 void
-XCBKeySymbolsGetReply (XCBKeySymbols    *syms,
-		       XCBGenericError **e)
+xcb_key_symbols_get_reply (xcb_key_symbols_t    *syms,
+		       xcb_generic_error_t **e)
 {
   if (!syms)
     return;
@@ -448,7 +448,7 @@ XCBKeySymbolsGetReply (XCBKeySymbols    
   if (syms->tag == TAG_COOKIE)
     {
       syms->tag = TAG_VALUE;
-      syms->u.reply = XCBGetKeyboardMappingReply(syms->c,
+      syms->u.reply = xcb_get_keyboard_mapping_reply(syms->c,
 						 syms->u.cookie,
 						 e);
     }
diff --git a/xcb-util/keysyms/xcb_keysyms.h b/xcb-util/keysyms/xcb_keysyms.h
index ace0a95..d89fe17 100644
--- a/xcb-util/keysyms/xcb_keysyms.h
+++ b/xcb-util/keysyms/xcb_keysyms.h
@@ -9,55 +9,55 @@ extern "C" {
 #endif
 
 
-typedef struct _XCBKeySymbols XCBKeySymbols;
+typedef struct _XCBKeySymbols xcb_key_symbols_t;
 
 /* enumeration for col parameter? */
 enum {
-	XCBLookupNone   = 1,
-	XCBLookupChars  = 2,
-	XCBLookupKeySym = 3,
-	XCBLookupBoth   = 4
-} XCBLookup;
+	xcb_lookup_none_t   = 1,
+	xcb_lookup_chars_t  = 2,
+	xcb_lookup_key_sym_t = 3,
+	xcb_lookup_both_t   = 4
+} xcb_lookup_t;
 
-XCBKeySymbols *XCBKeySymbolsAlloc        (XCBConnection         *c);
+xcb_key_symbols_t *xcb_key_symbols_alloc        (xcb_connection_t         *c);
 
-void           XCBKeySymbolsFree         (XCBKeySymbols         *syms);
+void           xcb_key_symbols_free         (xcb_key_symbols_t         *syms);
 
-XCBKEYSYM      XCBKeySymbolsGetKeysym    (XCBKeySymbols         *syms,
-					  XCBKEYCODE             keycode,
+xcb_keysym_t      xcb_key_symbols_get_keysym    (xcb_key_symbols_t         *syms,
+					  xcb_keycode_t             keycode,
 					  int                    col);
 
-XCBKEYCODE     XCBKeySymbolsGetKeycode   (XCBKeySymbols         *syms,
-					  XCBKEYSYM              keysym);
+xcb_keycode_t     xcb_key_symbols_get_keycode   (xcb_key_symbols_t         *syms,
+					  xcb_keysym_t              keysym);
 
-XCBKEYSYM      XCBKeyPressLookupKeysym   (XCBKeySymbols         *syms,
-					  XCBKeyPressEvent      *event,
+xcb_keysym_t      xcb_key_press_lookup_keysym   (xcb_key_symbols_t         *syms,
+					  xcb_key_press_event_t      *event,
 					  int                    col);
 
-XCBKEYSYM      XCBKeyReleaseLookupKeysym (XCBKeySymbols         *syms,
-					  XCBKeyReleaseEvent    *event,
+xcb_keysym_t      xcb_key_release_lookup_keysym (xcb_key_symbols_t         *syms,
+					  xcb_key_release_event_t    *event,
 					  int                    col);
 
-int            XCBRefreshKeyboardMapping (XCBKeySymbols         *syms,
-					  XCBMappingNotifyEvent *event);
+int            xcb_refresh_keyboard_mapping (xcb_key_symbols_t         *syms,
+					  xcb_mapping_notify_event_t *event);
 
 /* TODO:  need XLookupString equivalent */
 
 /* Tests for classes of symbols */
 
-int XCBIsKeypadKey        (XCBKEYSYM keysym);
+int xcb_is_keypad_key        (xcb_keysym_t keysym);
 
-int XCBIsPrivateKeypadKey (XCBKEYSYM keysym);
+int xcb_is_private_keypad_key (xcb_keysym_t keysym);
 
-int XCBIsCursorKey        (XCBKEYSYM keysym);
+int xcb_is_cursor_key        (xcb_keysym_t keysym);
 
-int XCBIsPFKey            (XCBKEYSYM keysym);
+int xcb_is_pf_key            (xcb_keysym_t keysym);
 
-int XCBIsFunctionKey      (XCBKEYSYM keysym);
+int xcb_is_function_key      (xcb_keysym_t keysym);
 
-int XCBIsMiscFunctionKey  (XCBKEYSYM keysym);
+int xcb_is_misc_function_key  (xcb_keysym_t keysym);
 
-int XCBIsModifierKey      (XCBKEYSYM keysym);
+int xcb_is_modifier_key      (xcb_keysym_t keysym);
 
 
 #ifdef __cplusplus
diff --git a/xcb-util/property/prop.c b/xcb-util/property/prop.c
index cbe2ec8..c3d94a1 100644
--- a/xcb-util/property/prop.c
+++ b/xcb-util/property/prop.c
@@ -4,130 +4,130 @@
 #include "xcb_property.h"
 
 typedef struct {
-	CARD32 long_len;
-	GenericPropertyHandler handler;
+	uint32_t long_len;
+	generic_property_handler handler;
 	void *data;
-} propHandler;
+} prop_handler_t;
 
 typedef struct node node;
 struct node {
 	node *next;
-	XCBATOM name;
-	propHandler h;
+	xcb_atom_t name;
+	prop_handler_t h;
 };
 
-struct PropertyHandlers {
+struct property_handlers {
 	node *head;
-	propHandler *def;
-	EventHandlers *evenths;
+	prop_handler_t *def;
+	event_handlers_t *evenths;
 };
 
-XCBGetPropertyCookie GetAnyProperty(XCBConnection *c, BOOL del, XCBWINDOW window, XCBATOM name, CARD32 long_len)
+xcb_get_property_cookie_t get_any_property(xcb_connection_t *c, uint8_t del, xcb_window_t window, xcb_atom_t name, uint32_t long_len)
 {
-	static const XCBATOM type = { XCBGetPropertyTypeAny };
-	return XCBGetProperty(c, del, window, name, type, 0, long_len);
+	static const xcb_atom_t type = { XCB_GET_PROPERTY_TYPE_ANY };
+	return xcb_get_property(c, del, window, name, type, 0, long_len);
 }
 
-static int callHandler(XCBConnection *c, BYTE state, XCBWINDOW window, XCBATOM atom, propHandler *h)
+static int call_handler(xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, prop_handler_t *h)
 {
-	XCBGetPropertyRep *propr = 0;
+	xcb_get_property_reply_t *propr = 0;
 	int ret;
-	if(state != XCBPropertyDelete)
+	if(state != XCB_PROPERTY_DELETE)
 	{
-		XCBGetPropertyCookie cookie = GetAnyProperty(c, 0, window, atom, h->long_len);
-		propr = XCBGetPropertyReply(c, cookie, 0);
+		xcb_get_property_cookie_t cookie = get_any_property(c, 0, window, atom, h->long_len);
+		propr = xcb_get_property_reply(c, cookie, 0);
 	}
 	ret = h->handler(h->data, c, state, window, atom, propr);
 	free(propr);
 	return ret;
 }
 
-int PropertyChanged(PropertyHandlers *prophs, BYTE state, XCBWINDOW window, XCBATOM atom)
+int property_changed(property_handlers_t *prophs, uint8_t state, xcb_window_t window, xcb_atom_t atom)
 {
-	XCBConnection *c = getXCBConnection(GetPropertyEventHandlers(prophs));
+	xcb_connection_t *c = get_xcb_connection(get_property_event_handlers(prophs));
 	node *cur;
 	for(cur = prophs->head; cur; cur = cur->next)
 		if(cur->name.xid == atom.xid)
-			return callHandler(c, state, window, atom, &cur->h);
+			return call_handler(c, state, window, atom, &cur->h);
 	if(prophs->def)
-		return callHandler(c, state, window, atom, prophs->def);
+		return call_handler(c, state, window, atom, prophs->def);
 	return 0;
 }
 
-static int handlePropertyNotifyEvent(void *data, XCBConnection *c, XCBPropertyNotifyEvent *e)
+static int handle_property_notify_event(void *data, xcb_connection_t *c, xcb_property_notify_event_t *e)
 {
-	PropertyHandlers *prophs = data;
-	BYTE state = e->state;
-	XCBWINDOW window = e->window;
-	XCBATOM atom = e->atom;
+	property_handlers_t *prophs = data;
+	uint8_t state = e->state;
+	xcb_window_t window = e->window;
+	xcb_atom_t atom = e->atom;
 
-	return PropertyChanged(prophs, state, window, atom);
+	return property_changed(prophs, state, window, atom);
 }
 
-PropertyHandlers *AllocPropertyHandlers(EventHandlers *evenths)
+property_handlers_t *alloc_property_handlers(event_handlers_t *evenths)
 {
-	PropertyHandlers *prophs = malloc(sizeof(PropertyHandlers));
+	property_handlers_t *prophs = malloc(sizeof(property_handlers_t));
 	if(prophs)
 	{
 		prophs->head = 0;
 		prophs->def = 0;
 		prophs->evenths = evenths;
-		setPropertyNotifyEventHandler(evenths, handlePropertyNotifyEvent, prophs);
+		set_property_notify_event_handler(evenths, handle_property_notify_event, prophs);
 	}
 	return prophs;
 }
 
-void FreePropertyHandlers(PropertyHandlers *prophs)
+void free_property_handlers(property_handlers_t *prophs)
 {
 	free(prophs);
 }
 
-EventHandlers *GetPropertyEventHandlers(PropertyHandlers *prophs)
+event_handlers_t *get_property_event_handlers(property_handlers_t *prophs)
 {
 	return prophs->evenths;
 }
 
-static inline void setPropHandler(propHandler *cur, CARD32 long_len, GenericPropertyHandler handler, void *data)
+static inline void set_prop_handler(prop_handler_t *cur, uint32_t long_len, generic_property_handler handler, void *data)
 {
 	cur->long_len = long_len;
 	cur->handler = handler;
 	cur->data = data;
 }
 
-int SetPropertyHandler(PropertyHandlers *prophs, XCBATOM name, CARD32 long_len, GenericPropertyHandler handler, void *data)
+int set_property_handler(property_handlers_t *prophs, xcb_atom_t name, uint32_t long_len, generic_property_handler handler, void *data)
 {
 	node *cur = malloc(sizeof(node));
 	if(!cur)
 		return 0;
 	cur->next = prophs->head;
 	cur->name = name;
-	setPropHandler(&cur->h, long_len, handler, data);
+	set_prop_handler(&cur->h, long_len, handler, data);
 	prophs->head = cur;
 	return 1;
 }
 
-int SetDefaultPropertyHandler(PropertyHandlers *prophs, CARD32 long_len, GenericPropertyHandler handler, void *data)
+int set_default_property_handler(property_handlers_t *prophs, uint32_t long_len, generic_property_handler handler, void *data)
 {
 	assert(!prophs->def);
-	prophs->def = malloc(sizeof(propHandler));
+	prophs->def = malloc(sizeof(prop_handler_t));
 	if(!prophs->def)
 		return 0;
-	setPropHandler(prophs->def, long_len, handler, data);
+	set_prop_handler(prophs->def, long_len, handler, data);
 	return 1;
 }
 
-int rootOfScreen(XCBConnection *c, int screen, XCBWINDOW *root)
+int root_of_screen(xcb_connection_t *c, int screen, xcb_window_t *root)
 {
-	XCBSCREENIter i = XCBSetupRootsIter(XCBGetSetup(c));
+	xcb_screen_iterator_t i = xcb_setup_roots_iterator(xcb_get_setup(c));
 	if(screen >= i.rem)
 		return 0;
-	for(; screen && i.rem; --screen, XCBSCREENNext(&i))
+	for(; screen && i.rem; --screen, xcb_screen_next(&i))
 		/* empty */;
 	*root = i.data->root;
 	return 1;
 }
 
-XCBVoidCookie sendToWindow(XCBConnection *c, XCBWINDOW root, const XCBClientMessageEvent *ev)
+xcb_void_cookie_t send_to_window(xcb_connection_t *c, xcb_window_t root, const xcb_client_message_event_t *ev)
 {
-	return XCBSendEvent(c, /* propagate */ 0, root, XCBEventMaskSubstructureNotify | XCBEventMaskSubstructureRedirect, (const char *) ev);
+	return xcb_send_event(c, /* propagate */ 0, root, XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *) ev);
 }
diff --git a/xcb-util/property/xcb_property.h b/xcb-util/property/xcb_property.h
index abd9711..411c2a8 100644
--- a/xcb-util/property/xcb_property.h
+++ b/xcb-util/property/xcb_property.h
@@ -9,20 +9,20 @@ extern "C" {
 #endif
 
 
-XCBGetPropertyCookie GetAnyProperty(XCBConnection *c, BOOL del, XCBWINDOW window, XCBATOM name, CARD32 long_len);
+xcb_get_property_cookie_t get_any_property(xcb_connection_t *c, uint8_t del, xcb_window_t window, xcb_atom_t name, uint32_t long_len);
 
-typedef struct PropertyHandlers PropertyHandlers;
+typedef struct property_handlers property_handlers_t;
 
-PropertyHandlers *AllocPropertyHandlers(EventHandlers *evenths);
-void FreePropertyHandlers(PropertyHandlers *prophs);
-EventHandlers *GetPropertyEventHandlers(PropertyHandlers *prophs);
+property_handlers_t *alloc_property_handlers(event_handlers_t *evenths);
+void free_property_handlers(property_handlers_t *prophs);
+event_handlers_t *get_property_event_handlers(property_handlers_t *prophs);
 
-typedef int (*GenericPropertyHandler)(void *data, XCBConnection *c, BYTE state, XCBWINDOW window, XCBATOM atom, XCBGetPropertyRep *property);
+typedef int (*generic_property_handler)(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *property);
 
-int SetPropertyHandler(PropertyHandlers *prophs, XCBATOM name, CARD32 long_len, GenericPropertyHandler handler, void *data);
-int SetDefaultPropertyHandler(PropertyHandlers *prophs, CARD32 long_len, GenericPropertyHandler handler, void *data);
+int set_property_handler(property_handlers_t *prophs, xcb_atom_t name, uint32_t long_len, generic_property_handler handler, void *data);
+int set_default_property_handler(property_handlers_t *prophs, uint32_t long_len, generic_property_handler handler, void *data);
 
-int PropertyChanged(PropertyHandlers *prophs, BYTE state, XCBWINDOW window, XCBATOM atom);
+int property_changed(property_handlers_t *prophs, uint8_t state, xcb_window_t window, xcb_atom_t atom);
 
 
 #ifdef __cplusplus
diff --git a/xcb-util/renderutil/cache.c b/xcb-util/renderutil/cache.c
index fe95a14..3bfeb87 100644
--- a/xcb-util/renderutil/cache.c
+++ b/xcb-util/renderutil/cache.c
@@ -32,9 +32,9 @@
 
 typedef struct connection_cache {
     struct connection_cache      *next;		/* keep a linked list */
-    XCBConnection                *c;		/* which display this is */
-    XCBRenderQueryVersionRep     *version;
-    XCBRenderQueryPictFormatsRep *formats;
+    xcb_connection_t                *c;		/* which display this is */
+    xcb_render_query_version_reply_t     *version;
+    xcb_render_query_pict_formats_reply_t *formats;
 } connection_cache;
 
 static struct {
@@ -63,17 +63,17 @@ static struct {
 /* Test each depth not explicitly advertised to see if pixmap creation
  * succeeds: if it does, that depth is usable. */
 static int
-pixmap_depths_usable (XCBConnection *c, CARD32 missing, XCBPIXMAP pixmap, XCBDRAWABLE root)
+pixmap_depths_usable (xcb_connection_t *c, uint32_t missing, xcb_pixmap_t pixmap, xcb_drawable_t root)
 {
-    XCBVoidCookie create_cookie[32] = { { 0 } };
-    XCBVoidCookie free_cookie[32]   = { { 0 } };
+    xcb_void_cookie_t create_cookie[32] = { { 0 } };
+    xcb_void_cookie_t free_cookie[32]   = { { 0 } };
     int d;
     int success = 1;
     for (d = 1; d <= 32; d++)
 	if (missing & DEPTH_MASK(d))
 	{
-	    create_cookie[d - 1] = XCBCreatePixmapChecked (c, d, pixmap, root, 1, 1);
-	    free_cookie[d - 1] = XCBFreePixmapChecked (c, pixmap);
+	    create_cookie[d - 1] = xcb_create_pixmap_checked (c, d, pixmap, root, 1, 1);
+	    free_cookie[d - 1] = xcb_free_pixmap_checked (c, pixmap);
 	    if (!create_cookie[d - 1].sequence || !free_cookie[d - 1].sequence)
 	    {
 		success = 0;
@@ -83,8 +83,8 @@ pixmap_depths_usable (XCBConnection *c, 
     for (d = 0; d < 32; d++)
 	if (create_cookie[d].sequence || free_cookie[d].sequence)
 	{
-	    XCBGenericError *create_error = XCBRequestCheck (c, create_cookie[d]);
-	    XCBGenericError *free_error = XCBRequestCheck (c, free_cookie[d]);
+	    xcb_generic_error_t *create_error = xcb_request_check (c, create_cookie[d]);
+	    xcb_generic_error_t *free_error = xcb_request_check (c, free_cookie[d]);
 	    success = success && !create_error;
 	    free(create_error);
 	    free(free_error);
@@ -93,17 +93,17 @@ pixmap_depths_usable (XCBConnection *c, 
 }
 
 static int
-has_required_depths (XCBConnection *c)
+has_required_depths (xcb_connection_t *c)
 {
-    XCBSCREENIter screens;
-    XCBPIXMAP pixmap = { -1 };
-    for (screens = XCBSetupRootsIter(XCBGetSetup(c)); screens.rem; XCBSCREENNext(&screens))
+    xcb_screen_iterator_t screens;
+    xcb_pixmap_t pixmap = { -1 };
+    for (screens = xcb_setup_roots_iterator(xcb_get_setup(c)); screens.rem; xcb_screen_next(&screens))
     {
-	XCBDEPTHIter depths;
-	CARD32 missing = REQUIRED_DEPTHS;
-	XCBDRAWABLE root;
+	xcb_depth_iterator_t depths;
+	uint32_t missing = REQUIRED_DEPTHS;
+	xcb_drawable_t root;
 
-	for (depths = XCBSCREENAllowedDepthsIter(screens.data); depths.rem; XCBDEPTHNext(&depths))
+	for (depths = xcb_screen_allowed_depths_iterator(screens.data); depths.rem; xcb_depth_next(&depths))
 	    missing &= ~DEPTH_MASK(depths.data->depth);
 	if (!missing)
 	    continue;
@@ -116,7 +116,7 @@ has_required_depths (XCBConnection *c)
 	 * work, but the only way to find out is to try them.
 	 */
 	if (pixmap.xid == -1)
-	    pixmap = XCBPIXMAPNew(c);
+	    pixmap = xcb_pixmap_new(c);
 	root.window = screens.data->root;
 	if (!pixmap_depths_usable (c, missing, pixmap, root))
 	    return 0;
@@ -125,11 +125,11 @@ has_required_depths (XCBConnection *c)
 }
 
 static connection_cache *
-find_or_create_display (XCBConnection *c)
+find_or_create_display (xcb_connection_t *c)
 {
     connection_cache *info;
-    XCBRenderQueryVersionCookie version_cookie;
-    XCBRenderQueryPictFormatsCookie formats_cookie;
+    xcb_render_query_version_cookie_t version_cookie;
+    xcb_render_query_pict_formats_cookie_t formats_cookie;
     int present;
 
     /*
@@ -149,12 +149,12 @@ find_or_create_display (XCBConnection *c
 	return NULL;
     info->c = c;
 
-    version_cookie = XCBRenderQueryVersion(c, 0, 10);
-    formats_cookie = XCBRenderQueryPictFormats(c);
-    XCBFlush(c);
+    version_cookie = xcb_render_query_version(c, 0, 10);
+    formats_cookie = xcb_render_query_pict_formats(c);
+    xcb_flush(c);
     present = has_required_depths (c);
-    info->version = XCBRenderQueryVersionReply(c, version_cookie, 0);
-    info->formats = XCBRenderQueryPictFormatsReply(c, formats_cookie, 0);
+    info->version = xcb_render_query_version_reply(c, version_cookie, 0);
+    info->formats = xcb_render_query_pict_formats_reply(c, formats_cookie, 0);
 
     if (!present || !info->version || !info->formats)
     {
@@ -178,7 +178,7 @@ find_or_create_display (XCBConnection *c
 }
 
 static connection_cache *
-find_display (XCBConnection *c)
+find_display (xcb_connection_t *c)
 {
     connection_cache *info;
 
@@ -194,8 +194,8 @@ find_display (XCBConnection *c)
     return info;
 }
 
-const XCBRenderQueryVersionRep *
-XCBRenderUtilQueryVersion (XCBConnection *c)
+const xcb_render_query_version_reply_t *
+xcb_render_util_query_version (xcb_connection_t *c)
 {
     connection_cache *info = find_display (c);
     if (!info)
@@ -203,8 +203,8 @@ XCBRenderUtilQueryVersion (XCBConnection
     return info->version;
 }
 
-const XCBRenderQueryPictFormatsRep *
-XCBRenderUtilQueryFormats (XCBConnection *c)
+const xcb_render_query_pict_formats_reply_t *
+xcb_render_util_query_formats (xcb_connection_t *c)
 {
     connection_cache *info = find_display (c);
     if (!info)
@@ -213,7 +213,7 @@ XCBRenderUtilQueryFormats (XCBConnection
 }
 
 int
-XCBRenderUtilDisconnect (XCBConnection *c)
+xcb_render_util_disconnect (xcb_connection_t *c)
 {
     connection_cache **prev, *cur = NULL;
     pthread_mutex_lock(&connections.lock);
diff --git a/xcb-util/renderutil/util.c b/xcb-util/renderutil/util.c
index 8e8074d..c405d0d 100644
--- a/xcb-util/renderutil/util.c
+++ b/xcb-util/renderutil/util.c
@@ -21,33 +21,33 @@
 
 #include "xcb_renderutil.h"
 
-XCBRenderPICTVISUAL *
-XCBRenderUtilFindVisualFormat (const XCBRenderQueryPictFormatsRep *formats,
-			       const XCBVISUALID visual)
+xcb_render_pictvisual_t *
+xcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats,
+			       const xcb_visualid_t visual)
 {
-    XCBRenderPICTSCREENIter screens;
-    XCBRenderPICTDEPTHIter depths;
-    XCBRenderPICTVISUALIter visuals;
+    xcb_render_pictscreen_iterator_t screens;
+    xcb_render_pictdepth_iterator_t depths;
+    xcb_render_pictvisual_iterator_t visuals;
     if (!formats)
 	return 0;
-    for (screens = XCBRenderQueryPictFormatsScreensIter(formats); screens.rem; XCBRenderPICTSCREENNext(&screens))
-	for (depths = XCBRenderPICTSCREENDepthsIter(screens.data); depths.rem; XCBRenderPICTDEPTHNext(&depths))
-	    for (visuals = XCBRenderPICTDEPTHVisualsIter(depths.data); visuals.rem; XCBRenderPICTVISUALNext(&visuals))
+    for (screens = xcb_render_query_pict_formats_screens_iterator(formats); screens.rem; xcb_render_pictscreen_next(&screens))
+	for (depths = xcb_render_pictscreen_depths_iterator(screens.data); depths.rem; xcb_render_pictdepth_next(&depths))
+	    for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data); visuals.rem; xcb_render_pictvisual_next(&visuals))
 		if (visuals.data->visual.id == visual.id)
 		    return visuals.data;
     return 0;
 }
 
-XCBRenderPICTFORMINFO *
-XCBRenderUtilFindFormat (const XCBRenderQueryPictFormatsRep	*formats,
+xcb_render_pictforminfo_t *
+xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t	*formats,
 			 unsigned long				mask,
-			 const XCBRenderPICTFORMINFO		*template,
+			 const xcb_render_pictforminfo_t		*template,
 			 int					count)
 {
-    XCBRenderPICTFORMINFOIter i;
+    xcb_render_pictforminfo_iterator_t i;
     if (!formats)
 	return 0;
-    for (i = XCBRenderQueryPictFormatsFormatsIter(formats); i.rem; XCBRenderPICTFORMINFONext(&i))
+    for (i = xcb_render_query_pict_formats_formats_iterator(formats); i.rem; xcb_render_pictforminfo_next(&i))
     {
 	if (mask & PictFormatID)
 	    if (template->id.xid != i.data->id.xid)
@@ -91,19 +91,19 @@ XCBRenderUtilFindFormat (const XCBRender
     return 0;
 }
 
-XCBRenderPICTFORMINFO *
-XCBRenderUtilFindStandardFormat (const XCBRenderQueryPictFormatsRep	*formats,
+xcb_render_pictforminfo_t *
+xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t	*formats,
 				 int					format)
 {
     static const struct {
-	XCBRenderPICTFORMINFO templ;
+	xcb_render_pictforminfo_t templ;
 	unsigned long	      mask;
     } standardFormats[] = {
 	/* PictStandardARGB32 */
 	{
 	    {
 		{ 0 },			    /* id */
-		XCBRenderPictTypeDirect,    /* type */
+		XCB_RENDER_PICT_TYPE_DIRECT,    /* type */
 		32,			    /* depth */
 		{ 0 },			    /* pad */
 		{			    /* direct */
@@ -133,7 +133,7 @@ XCBRenderUtilFindStandardFormat (const X
 	{
 	    {
 		{ 0 },			    /* id */
-		XCBRenderPictTypeDirect,    /* type */
+		XCB_RENDER_PICT_TYPE_DIRECT,    /* type */
 		24,			    /* depth */
 		{ 0 },			    /* pad */
 		{			    /* direct */
@@ -162,7 +162,7 @@ XCBRenderUtilFindStandardFormat (const X
 	{
 	    {
 		{ 0 },			    /* id */
-		XCBRenderPictTypeDirect,    /* type */
+		XCB_RENDER_PICT_TYPE_DIRECT,    /* type */
 		8,			    /* depth */
 		{ 0 },			    /* pad */
 		{			    /* direct */
@@ -189,7 +189,7 @@ XCBRenderUtilFindStandardFormat (const X
 	{
 	    {
 		{ 0 },			    /* id */
-		XCBRenderPictTypeDirect,    /* type */
+		XCB_RENDER_PICT_TYPE_DIRECT,    /* type */
 		4,			    /* depth */
 		{ 0 },			    /* pad */
 		{			    /* direct */
@@ -216,7 +216,7 @@ XCBRenderUtilFindStandardFormat (const X
 	{
 	    {
 		{ 0 },			    /* id */
-		XCBRenderPictTypeDirect,    /* type */
+		XCB_RENDER_PICT_TYPE_DIRECT,    /* type */
 		1,			    /* depth */
 		{ 0 },			    /* pad */
 		{			    /* direct */
@@ -244,7 +244,7 @@ XCBRenderUtilFindStandardFormat (const X
     if (format < 0 || format >= sizeof(standardFormats) / sizeof(*standardFormats))
 	return 0;
 
-    return XCBRenderUtilFindFormat (formats, 
+    return xcb_render_util_find_format (formats, 
 				    standardFormats[format].mask,
 				    &standardFormats[format].templ,
 				    0);
diff --git a/xcb-util/renderutil/xcb_renderutil.h b/xcb-util/renderutil/xcb_renderutil.h
index a535eae..51a3718 100644
--- a/xcb-util/renderutil/xcb_renderutil.h
+++ b/xcb-util/renderutil/xcb_renderutil.h
@@ -50,27 +50,27 @@ enum {
     PictStandardNUM
 };
 
-XCBRenderPICTVISUAL *
-XCBRenderUtilFindVisualFormat (const XCBRenderQueryPictFormatsRep *formats,
-			       const XCBVISUALID visual);
+xcb_render_pictvisual_t *
+xcb_render_util_find_visual_format (const xcb_render_query_pict_formats_reply_t *formats,
+			       const xcb_visualid_t visual);
 
-XCBRenderPICTFORMINFO *
-XCBRenderUtilFindFormat (const XCBRenderQueryPictFormatsRep	*formats,
+xcb_render_pictforminfo_t *
+xcb_render_util_find_format (const xcb_render_query_pict_formats_reply_t	*formats,
 			 unsigned long				mask,
-			 const XCBRenderPICTFORMINFO		*template,
+			 const xcb_render_pictforminfo_t		*template,
 			 int					count);
 
-XCBRenderPICTFORMINFO *
-XCBRenderUtilFindStandardFormat (const XCBRenderQueryPictFormatsRep	*formats,
+xcb_render_pictforminfo_t *
+xcb_render_util_find_standard_format (const xcb_render_query_pict_formats_reply_t	*formats,
 				 int					format);
 
-const XCBRenderQueryVersionRep *
-XCBRenderUtilQueryVersion (XCBConnection *c);
+const xcb_render_query_version_reply_t *
+xcb_render_util_query_version (xcb_connection_t *c);
 
-const XCBRenderQueryPictFormatsRep *
-XCBRenderUtilQueryFormats (XCBConnection *c);
+const xcb_render_query_pict_formats_reply_t *
+xcb_render_util_query_formats (xcb_connection_t *c);
 
 int
-XCBRenderUtilDisconnect (XCBConnection *c);
+xcb_render_util_disconnect (xcb_connection_t *c);
 
 #endif /* XCB_RENDERUTIL */
diff --git a/xcb-util/reply/reply.c b/xcb-util/reply/reply.c
index 5045690..8bec445 100644
--- a/xcb-util/reply/reply.c
+++ b/xcb-util/reply/reply.c
@@ -6,22 +6,22 @@
 struct node {
 	struct node *next;
 	unsigned int request;
-	GenericReplyHandler handler;
+	generic_reply_handler handler;
 	void *data;
 	char handled;
 };
 
-struct ReplyHandlers {
+struct reply_handlers {
 	pthread_mutex_t lock;
 	pthread_cond_t cond;
 	struct node *head;
-	XCBConnection *c;
+	xcb_connection_t *c;
 	char stop;
 };
 
-ReplyHandlers *allocReplyHandlers(XCBConnection *c)
+reply_handlers_t *alloc_reply_handlers(xcb_connection_t *c)
 {
-	ReplyHandlers *ret = calloc(1, sizeof(ReplyHandlers));
+	reply_handlers_t *ret = calloc(1, sizeof(reply_handlers_t));
 	if(ret)
 	{
 		static const pthread_mutex_t proto_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -33,17 +33,17 @@ ReplyHandlers *allocReplyHandlers(XCBCon
 	return ret;
 }
 
-void freeReplyHandlers(ReplyHandlers *h)
+void free_reply_handlers(reply_handlers_t *h)
 {
 	free(h);
 }
 
-XCBConnection *getXCBConnection(ReplyHandlers *h)
+xcb_connection_t *get_xcb_connection(reply_handlers_t *h)
 {
 	return h->c;
 }
 
-static void insert_handler(ReplyHandlers *h, struct node *cur)
+static void insert_handler(reply_handlers_t *h, struct node *cur)
 {
 	struct node **prev = &h->head;
 	while(*prev && (*prev)->request < cur->request)
@@ -52,17 +52,17 @@ static void insert_handler(ReplyHandlers
 	*prev = cur;
 }
 
-static int do_poll(ReplyHandlers *h)
+static int do_poll(reply_handlers_t *h)
 {
-	XCBGenericRep *reply;
-	XCBGenericError *error;
+	xcb_generic_reply_t *reply;
+	xcb_generic_error_t *error;
 	int handled;
 	struct node *cur = h->head;
 	h->head = cur->next;
 
 	pthread_mutex_unlock(&h->lock);
 	pthread_cleanup_push((void (*)(void *)) pthread_mutex_lock, &h->lock);
-	reply = XCBWaitForReply(h->c, cur->request, &error);
+	reply = xcb_wait_for_reply(h->c, cur->request, &error);
 
 	if(reply || error)
 	{
@@ -83,12 +83,12 @@ static int do_poll(ReplyHandlers *h)
 	return handled;
 }
 
-int PollReplies(ReplyHandlers *h)
+int poll_replies(reply_handlers_t *h)
 {
 	int ret = 1;
-	XCBFlush(h->c);
+	xcb_flush(h->c);
 	pthread_mutex_lock(&h->lock);
-	while(ret && h->head && XCBGetRequestRead(h->c) >= h->head->request)
+	while(ret && h->head && xcb_get_request_read(h->c) >= h->head->request)
 		ret = do_poll(h);
 	pthread_mutex_unlock(&h->lock);
 	return ret;
@@ -96,7 +96,7 @@ int PollReplies(ReplyHandlers *h)
 
 static void *reply_thread(void *hvp)
 {
-	ReplyHandlers *h = hvp;
+	reply_handlers_t *h = hvp;
 	pthread_mutex_lock(&h->lock);
 	pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, &h->lock);
 	while(1)
@@ -111,14 +111,14 @@ static void *reply_thread(void *hvp)
 	return 0;
 }
 
-pthread_t StartReplyThread(ReplyHandlers *h)
+pthread_t start_reply_thread(reply_handlers_t *h)
 {
 	pthread_t ret;
 	pthread_create(&ret, 0, reply_thread, h);
 	return ret;
 }
 
-void StopReplyThreads(ReplyHandlers *h)
+void stop_reply_threads(reply_handlers_t *h)
 {
 	pthread_mutex_lock(&h->lock);
 	h->stop = 1;
@@ -126,7 +126,7 @@ void StopReplyThreads(ReplyHandlers *h)
 	pthread_mutex_unlock(&h->lock);
 }
 
-void AddReplyHandler(ReplyHandlers *h, unsigned int request, GenericReplyHandler handler, void *data)
+void add_reply_handler(reply_handlers_t *h, unsigned int request, generic_reply_handler handler, void *data)
 {
 	struct node *cur = malloc(sizeof(struct node));
 	cur->request = request;
diff --git a/xcb-util/reply/test_reply.c b/xcb-util/reply/test_reply.c
index a8ba254..8c44c6d 100644
--- a/xcb-util/reply/test_reply.c
+++ b/xcb-util/reply/test_reply.c
@@ -6,16 +6,16 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-void fontinfo_handler(void *data, XCBConnection *c, XCBGenericRep *rg, XCBGenericError *eg)
+void fontinfo_handler(void *data, xcb_connection_t *c, xcb_generic_reply_t *rg, xcb_generic_error_t *eg)
 {
-	XCBListFontsWithInfoRep *rep = (XCBListFontsWithInfoRep *) rg;
+	xcb_list_fonts_with_info_reply_t *rep = (xcb_list_fonts_with_info_reply_t *) rg;
 	if(rep)
 	{
-		int len = XCBListFontsWithInfoNameLength(rep);
+		int len = xcb_list_fonts_with_info_name_length(rep);
 		if(len)
 			printf("(+%u) Font \"%.*s\"\n",
 					(unsigned int) rep->replies_hint,
-					len, XCBListFontsWithInfoName(rep));
+					len, xcb_list_fonts_with_info_name(rep));
 		else
 			printf("End of font list.\n");
 	}
@@ -27,8 +27,8 @@ int main(int argc, char **argv)
 {
 	int count = 10;
 	char *pattern = "*";
-	XCBConnection *c = XCBConnect(NULL, NULL);
-	ReplyHandlers *h = allocReplyHandlers(c);
+	xcb_connection_t *c = xcb_connect(NULL, NULL);
+	reply_handlers_t *h = alloc_reply_handlers(c);
 	pthread_t reply_thread;
 
 	if(argc > 1)
@@ -36,12 +36,12 @@ int main(int argc, char **argv)
 	if(argc > 2)
 		pattern = argv[2];
 	
-	AddReplyHandler(h, XCBListFontsWithInfo(c, count, strlen(pattern), pattern).sequence, fontinfo_handler, 0);
-	reply_thread = StartReplyThread(h);
+	add_reply_handler(h, xcb_list_fonts_with_info(c, count, strlen(pattern), pattern).sequence, fontinfo_handler, 0);
+	reply_thread = start_reply_thread(h);
 
-	XCBSync(c, 0);
-	StopReplyThreads(h);
+	free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), NULL));
+	stop_reply_threads(h);
 	pthread_join(reply_thread, 0);
-	XCBDisconnect(c);
+	xcb_disconnect(c);
 	exit(0);
 }
diff --git a/xcb-util/reply/xcb_reply.h b/xcb-util/reply/xcb_reply.h
index 0f52d61..781e11d 100644
--- a/xcb-util/reply/xcb_reply.h
+++ b/xcb-util/reply/xcb_reply.h
@@ -10,18 +10,18 @@ extern "C" {
 #endif
 
 
-typedef struct ReplyHandlers ReplyHandlers;
-ReplyHandlers *allocReplyHandlers(XCBConnection *c);
-void freeReplyHandlers(ReplyHandlers *h);
-XCBConnection *getXCBConnection(ReplyHandlers *h);
-
-int PollReplies(ReplyHandlers *h);
-pthread_t StartReplyThread(ReplyHandlers *h);
-void StopReplyThreads(ReplyHandlers *h);
+typedef struct reply_handlers reply_handlers_t;
+reply_handlers_t *alloc_reply_handlers(xcb_connection_t *c);
+void free_reply_handlers(reply_handlers_t *h);
+xcb_connection_t *get_xcb_connection(reply_handlers_t *h);
+
+int poll_replies(reply_handlers_t *h);
+pthread_t start_reply_thread(reply_handlers_t *h);
+void stop_reply_threads(reply_handlers_t *h);
 
-typedef void (*GenericReplyHandler)(void *data, XCBConnection *c, XCBGenericRep *reply, XCBGenericError *error);
+typedef void (*generic_reply_handler)(void *data, xcb_connection_t *c, xcb_generic_reply_t *reply, xcb_generic_error_t *error);
 
-void AddReplyHandler(ReplyHandlers *h, unsigned int request, GenericReplyHandler handler, void *data);
+void add_reply_handler(reply_handlers_t *h, unsigned int request, generic_reply_handler handler, void *data);
 
 
 #ifdef __cplusplus
diff --git a/xcb-util/wm/manage.c b/xcb-util/wm/manage.c
index 051ec30..7b69983 100644
--- a/xcb-util/wm/manage.c
+++ b/xcb-util/wm/manage.c
@@ -5,18 +5,18 @@
 Table *byChild = 0;
 Table *byParent = 0;
 
-void manageWindow(PropertyHandlers *prophs, XCBConnection *c, XCBWINDOW window, WindowAttributes wa)
+void manageWindow(property_handlers_t *prophs, xcb_connection_t *c, xcb_window_t window, WindowAttributes wa)
 {
-	XCBDRAWABLE d = { window };
-	XCBGetGeometryCookie geomc;
-	XCBGetGeometryRep *geom;
-	XCBGetWindowAttributesRep *attr = 0;
+	xcb_drawable_t d = { window };
+	xcb_get_geometry_cookie_t geomc;
+	xcb_get_geometry_reply_t *geom;
+	xcb_get_window_attributes_reply_t *attr = 0;
 	if(wa.tag == TAG_COOKIE)
 	{
-		attr = XCBGetWindowAttributesReply(c, wa.u.cookie, 0);
+		attr = xcb_get_window_attributes_reply(c, wa.u.cookie, 0);
 		if(!attr)
 			return;
-		if(attr->map_state != XCBMapStateViewable)
+		if(attr->map_state != XCB_MAP_STATE_VIEWABLE)
 		{
 			printf("Window 0x%08x is not mapped. Ignoring.\n", window.xid);
 			free(attr);
@@ -37,24 +37,24 @@ void manageWindow(PropertyHandlers *prop
 		free(attr);
 		return;
 	}
-	geomc = XCBGetGeometry(c, d);
+	geomc = xcb_get_geometry(c, d);
 	if(!attr)
 	{
 		wa.tag = TAG_COOKIE;
-		wa.u.cookie = XCBGetWindowAttributes(c, window);
-		attr = XCBGetWindowAttributesReply(c, wa.u.cookie, 0);
+		wa.u.cookie = xcb_get_window_attributes(c, window);
+		attr = xcb_get_window_attributes_reply(c, wa.u.cookie, 0);
 	}
-	geom = XCBGetGeometryReply(c, geomc, 0);
+	geom = xcb_get_geometry_reply(c, geomc, 0);
 	if(attr && geom)
 	{
 		reparentWindow(c, window, attr->visual, geom->root, geom->depth, geom->x, geom->y, geom->width, geom->height);
-		PropertyChanged(prophs, XCBPropertyNewValue, window, WM_NAME);
+		PropertyChanged(prophs, XCB_PROPERTY_NEW_VALUE, window, WM_NAME);
 	}
 	free(attr);
 	free(geom);
 }
 
-int handleMapNotifyEvent(void *prophs, XCBConnection *c, XCBMapNotifyEvent *e)
+int handleMapNotifyEvent(void *prophs, xcb_connection_t *c, xcb_map_notify_event_t *e)
 {
 	WindowAttributes wa = { TAG_VALUE };
 	wa.u.override_redirect = e->override_redirect;
@@ -63,10 +63,10 @@ int handleMapNotifyEvent(void *prophs, X
 	return 1;
 }
 
-int handleUnmapNotifyEvent(void *data, XCBConnection *c, XCBUnmapNotifyEvent *e)
+int handleUnmapNotifyEvent(void *data, xcb_connection_t *c, xcb_unmap_notify_event_t *e)
 {
 	ClientWindow *client = TableRemove(byChild, e->event.xid);
-	XCBWINDOW root;
+	xcb_window_t root;
 	printf("UnmapNotify for 0x%08x (received from 0x%08x): ", e->window.xid, e->event.xid);
 	if(!client)
 	{
@@ -74,38 +74,38 @@ int handleUnmapNotifyEvent(void *data, X
 		return 0;
 	}
 
-	root = XCBSetupRootsIter(XCBGetSetup(c)).data->root;
+	root = xcb_setup_roots_iterator(xcb_get_setup(c)).data->root;
 	printf("child of 0x%08x.\n", client->parent.xid);
-	XCBReparentWindow(c, client->child, root, 0, 0);
-	XCBDestroyWindow(c, client->parent);
-	XCBFlush(c);
+	xcb_reparent_window(c, client->child, root, 0, 0);
+	xcb_destroy_window(c, client->parent);
+	xcb_flush(c);
 	TableRemove(byParent, client->parent.xid);
 	free(client);
 	return 1;
 }
 
-void manageExistingWindows(XCBConnection *c, PropertyHandlers *prophs, XCBWINDOW root)
+void manageExistingWindows(xcb_connection_t *c, property_handlers_t *prophs, xcb_window_t root)
 {
-	XCBQueryTreeCookie wintree;
-	XCBQueryTreeRep *rep;
+	xcb_query_tree_cookie_t wintree;
+	xcb_query_tree_reply_t *rep;
 	int i, len;
-	XCBWINDOW *children;
-	XCBGetWindowAttributesCookie *cookies;
+	xcb_window_t *children;
+	xcb_get_window_attributes_cookie_t *cookies;
 
-	wintree = XCBQueryTree(c, root);
-	rep = XCBQueryTreeReply(c, wintree, 0);
+	wintree = xcb_query_tree(c, root);
+	rep = xcb_query_tree_reply(c, wintree, 0);
 	if(!rep)
 		return;
-	len = XCBQueryTreeChildrenLength(rep);
+	len = xcb_query_tree_children_length(rep);
 	cookies = malloc(len * sizeof(*cookies));
 	if(!cookies)
 	{
 		free(rep);
 		return;
 	}
-	children = XCBQueryTreeChildren(rep);
+	children = xcb_query_tree_children(rep);
 	for(i = 0; i < len; ++i)
-		cookies[i] = XCBGetWindowAttributes(c, children[i]);
+		cookies[i] = xcb_get_window_attributes(c, children[i]);
 	for(i = 0; i < len; ++i)
 	{
 		WindowAttributes wa = { TAG_COOKIE, { cookies[i] } };
diff --git a/xcb-util/wm/reply_formats.c b/xcb-util/wm/reply_formats.c
index 03cf65f..d48c9fb 100644
--- a/xcb-util/wm/reply_formats.c
+++ b/xcb-util/wm/reply_formats.c
@@ -9,7 +9,7 @@
 
 #define WINFMT "0x%08x"
 
-int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *reply)
+int formatGetWindowAttributesReply(xcb_window_t wid, xcb_get_window_attributes_reply_t *reply)
 {
     if(!reply)
     {
@@ -55,7 +55,7 @@ int formatGetWindowAttributesReply(XCBWI
     return 1;
 }
 
-int formatGetGeometryReply(XCBWINDOW wid, XCBGetGeometryRep *reply)
+int formatGetGeometryReply(xcb_window_t wid, xcb_get_geometry_reply_t *reply)
 {
     if(!reply)
     {
@@ -75,7 +75,7 @@ int formatGetGeometryReply(XCBWINDOW wid
     return 1;
 }
 
-int formatQueryTreeReply(XCBWINDOW wid, XCBQueryTreeRep *reply)
+int formatQueryTreeReply(xcb_window_t wid, xcb_query_tree_reply_t *reply)
 {
     int i;
 
@@ -95,7 +95,7 @@ int formatQueryTreeReply(XCBWINDOW wid, 
 
     for(i = 0; i < reply->children_len; ++i)
         printf("    window " WINFMT "\n",
-            (unsigned int) XCBQueryTreeChildren(reply)[i].xid);
+            (unsigned int) xcb_query_tree_children(reply)[i].xid);
 
     fflush(stdout);
     return 1;
@@ -296,22 +296,22 @@ static const char *labelSendEvent[] = {
     " (from SendEvent)",
 };
 
-int formatEvent(XCBGenericEvent *e)
+int formatEvent(xcb_generic_event_t *e)
 {
-    BYTE sendEvent;
-    CARD16 seqnum;
+    uint8_t sendEvent;
+    uint16_t seqnum;
 
     sendEvent = (e->response_type & 0x80) ? 1 : 0;
     e->response_type &= ~0x80;
-    seqnum = *((CARD16 *) e + 1);
+    seqnum = *((uint16_t *) e + 1);
 
     switch(e->response_type)
     {
     case 0:
         printf("Error %s on seqnum %d (%s).\n",
-            labelError[*((BYTE *) e + 1)],
+            labelError[*((uint8_t *) e + 1)],
             seqnum,
-            labelRequest[*((CARD8 *) e + 10)]);
+            labelRequest[*((uint8_t *) e + 10)]);
         break;
     default:
         printf("Event %s following seqnum %d%s.\n",
@@ -319,7 +319,7 @@ int formatEvent(XCBGenericEvent *e)
             seqnum,
             labelSendEvent[sendEvent]);
         break;
-    case XCBKeymapNotify:
+    case XCB_KEYMAP_NOTIFY:
         printf("Event %s%s.\n",
             labelEvent[e->response_type],
             labelSendEvent[sendEvent]);
diff --git a/xcb-util/wm/reply_formats.h b/xcb-util/wm/reply_formats.h
index 998e88d..1205a65 100644
--- a/xcb-util/wm/reply_formats.h
+++ b/xcb-util/wm/reply_formats.h
@@ -9,23 +9,23 @@
 
 #include <X11/XCB/xcb.h>
 
-int formatGetWindowAttributesReply(XCBWINDOW wid, XCBGetWindowAttributesRep *reply);
-int formatGetGeometryReply(XCBWINDOW wid, XCBGetGeometryRep *reply);
-int formatQueryTreeReply(XCBWINDOW wid, XCBQueryTreeRep *reply);
-int formatEvent(XCBGenericEvent *e);
+int formatGetWindowAttributesReply(xcb_window_t wid, xcb_get_window_attributes_reply_t *reply);
+int formatGetGeometryReply(xcb_window_t wid, xcb_get_geometry_reply_t *reply);
+int formatQueryTreeReply(xcb_window_t wid, xcb_query_tree_reply_t *reply);
+int formatEvent(xcb_generic_event_t *e);
 
 #if 0 /* not yet ready */
-int formatButtonReleaseEvent(void *data, XCBConnection *c, XCBButtonReleaseEvent *event);
-int formatEnterNotifyEvent(void *data, XCBConnection *c, XCBEnterNotifyEvent *event);
-int formatExposeEvent(void *data, XCBConnection *c, XCBExposeEvent *event);
-int formatDestroyNotifyEvent(void *data, XCBConnection *c, XCBDestroyNotifyEvent *event);
-int formatUnmapNotifyEvent(void *data, XCBConnection *c, XCBUnmapNotifyEvent *event);
-int formatMapNotifyEvent(void *data, XCBConnection *c, XCBMapNotifyEvent *event);
-int formatReparentNotifyEvent(void *data, XCBConnection *c, XCBReparentNotifyEvent *event);
-int formatConfigureNotifyEvent(void *data, XCBConnection *c, XCBConfigureNotifyEvent *event);
-int formatGravityNotifyEvent(void *data, XCBConnection *c, XCBGravityNotifyEvent *event);
-int formatCirculateNotifyEvent(void *data, XCBConnection *c, XCBCirculateNotifyEvent *event);
-int formatClientMessageEvent(void *data, XCBConnection *c, XCBClientMessageEvent *event);
+int formatButtonReleaseEvent(void *data, xcb_connection_t *c, xcb_button_release_event_t *event);
+int formatEnterNotifyEvent(void *data, xcb_connection_t *c, xcb_enter_notify_event_t *event);
+int formatExposeEvent(void *data, xcb_connection_t *c, xcb_expose_event_t *event);
+int formatDestroyNotifyEvent(void *data, xcb_connection_t *c, xcb_destroy_notify_event_t *event);
+int formatUnmapNotifyEvent(void *data, xcb_connection_t *c, xcb_unmap_notify_event_t *event);
+int formatMapNotifyEvent(void *data, xcb_connection_t *c, xcb_map_notify_event_t *event);
+int formatReparentNotifyEvent(void *data, xcb_connection_t *c, xcb_reparent_notify_event_t *event);
+int formatConfigureNotifyEvent(void *data, xcb_connection_t *c, xcb_configure_notify_event_t *event);
+int formatGravityNotifyEvent(void *data, xcb_connection_t *c, xcb_gravity_notify_event_t *event);
+int formatCirculateNotifyEvent(void *data, xcb_connection_t *c, xcb_circulate_notify_event_t *event);
+int formatClientMessageEvent(void *data, xcb_connection_t *c, xcb_client_message_event_t *event);
 #endif
 
 #endif /* REPLY_FORMATS_H */
diff --git a/xcb-util/wm/table.c b/xcb-util/wm/table.c
index 5ab33a1..7249988 100644
--- a/xcb-util/wm/table.c
+++ b/xcb-util/wm/table.c
@@ -4,7 +4,7 @@
 typedef struct node node;
 struct node {
 	node *next;
-	CARD32 key;
+	uint32_t key;
 	void *value;
 };
 
@@ -22,7 +22,7 @@ void FreeTable(Table *table)
 	free(table);
 }
 
-int TablePut(Table *table, CARD32 key, void *value)
+int TablePut(Table *table, uint32_t key, void *value)
 {
 	node *record = malloc(sizeof(node));
 	if(!record)
@@ -34,7 +34,7 @@ int TablePut(Table *table, CARD32 key, v
 	return 1;
 }
 
-void *TableGet(Table *table, CARD32 key)
+void *TableGet(Table *table, uint32_t key)
 {
 	node *cur;
 	for(cur = table->head; cur; cur = cur->next)
@@ -43,7 +43,7 @@ void *TableGet(Table *table, CARD32 key)
 	return 0;
 }
 
-void *TableRemove(Table *table, CARD32 key)
+void *TableRemove(Table *table, uint32_t key)
 {
 	node **cur;
 	for(cur = &table->head; *cur; cur = &(*cur)->next)
diff --git a/xcb-util/wm/xcb_wm.h b/xcb-util/wm/xcb_wm.h
index f856346..d3f19ce 100644
--- a/xcb-util/wm/xcb_wm.h
+++ b/xcb-util/wm/xcb_wm.h
@@ -11,39 +11,39 @@ extern "C" {
 #endif
 
 
-void reparentWindow(XCBConnection *c, XCBWINDOW child,
-		XCBVISUALID v, XCBWINDOW r, CARD8 d,
-		INT16 x, INT16 y, CARD16 width, CARD16 height);
+void reparentWindow(xcb_connection_t *c, xcb_window_t child,
+		xcb_visualid_t v, xcb_window_t r, uint8_t d,
+		int16_t x, int16_t y, uint16_t width, uint16_t height);
 
 typedef struct {
-	XCBWINDOW child;
-	XCBWINDOW parent;
+	xcb_window_t child;
+	xcb_window_t parent;
 	int name_len;
 	char *name;
-	XCBGCONTEXT titlegc;
+	xcb_gcontext_t titlegc;
 } ClientWindow;
 
 typedef struct {
 	enum tag_t tag;
 	union {
-		XCBGetWindowAttributesCookie cookie;
-		BOOL override_redirect;
+		xcb_get_window_attributes_cookie_t cookie;
+		uint8_t override_redirect;
 	} u;
 } WindowAttributes;
 
-void manageWindow(PropertyHandlers *prophs, XCBConnection *c, XCBWINDOW window, WindowAttributes wa);
-int handleMapNotifyEvent(void *prophs, XCBConnection *c, XCBMapNotifyEvent *e);
-int handleUnmapNotifyEvent(void *data, XCBConnection *c, XCBUnmapNotifyEvent *e);
-void manageExistingWindows(XCBConnection *c, PropertyHandlers *prophs, XCBWINDOW root);
+void manageWindow(property_handlers_t *prophs, xcb_connection_t *c, xcb_window_t window, WindowAttributes wa);
+int handleMapNotifyEvent(void *prophs, xcb_connection_t *c, xcb_map_notify_event_t *e);
+int handleUnmapNotifyEvent(void *data, xcb_connection_t *c, xcb_unmap_notify_event_t *e);
+void manageExistingWindows(xcb_connection_t *c, property_handlers_t *prophs, xcb_window_t root);
 
 typedef struct Table Table;
 
 Table *AllocTable();
 void FreeTable(Table *table);
 
-int TablePut(Table *table, CARD32 key, void *value);
-void *TableGet(Table *table, CARD32 key);
-void *TableRemove(Table *table, CARD32 key);
+int TablePut(Table *table, uint32_t key, void *value);
+void *TableGet(Table *table, uint32_t key);
+void *TableRemove(Table *table, uint32_t key);
 
 extern Table *byChild;
 extern Table *byParent;
diff --git a/xcb-util/wm/xcbwm-test.c b/xcb-util/wm/xcbwm-test.c
index 87e1e70..078c7d9 100644
--- a/xcb-util/wm/xcbwm-test.c
+++ b/xcb-util/wm/xcbwm-test.c
@@ -20,15 +20,15 @@ static const int RIGHT = 5;
 static const int TEST_THREADS = 1;
 static const int TEST_WATCH_ROOT = 1;
 
-static INT16 move_from_x = -1;
-static INT16 move_from_y = -1;
+static int16_t move_from_x = -1;
+static int16_t move_from_y = -1;
 
-static int handleEvent(void *ignored, XCBConnection *c, XCBGenericEvent *e)
+static int handleEvent(void *ignored, xcb_connection_t *c, xcb_generic_event_t *e)
 {
 	return formatEvent(e);
 }
 
-static int handleButtonPressEvent(void *data, XCBConnection *c, XCBButtonPressEvent *e)
+static int handleButtonPressEvent(void *data, xcb_connection_t *c, xcb_button_press_event_t *e)
 {
 	if(move_from_x != -1 && move_from_y != -1)
 	{
@@ -40,9 +40,9 @@ static int handleButtonPressEvent(void *
 	return 1;
 }
 
-static int handleButtonReleaseEvent(void *data, XCBConnection *c, XCBButtonReleaseEvent *e)
+static int handleButtonReleaseEvent(void *data, xcb_connection_t *c, xcb_button_release_event_t *e)
 {
-	CARD32 values[2];
+	uint32_t values[2];
 	if(move_from_x == -1 && move_from_y == -1)
 	{
 		printf("Weird. Got ButtonRelease without ButtonPress.\n");
@@ -50,14 +50,14 @@ static int handleButtonReleaseEvent(void
 	}
 	values[0] = /* x */ e->root_x;
 	values[1] = /* y */ e->root_y;
-	XCBConfigureWindow(c, e->event, XCBConfigWindowX | XCBConfigWindowY, values);
-	XCBFlush(c);
+	xcb_configure_window(c, e->event, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, values);
+	xcb_flush(c);
 	move_from_x = -1;
 	move_from_y = -1;
 	return 1;
 }
 
-static int addClientWindow(XCBWINDOW child, XCBWINDOW parent, XCBGCONTEXT titlegc)
+static int addClientWindow(xcb_window_t child, xcb_window_t parent, xcb_gcontext_t titlegc)
 {
 	int success;
 	ClientWindow *record = malloc(sizeof(ClientWindow));
@@ -73,66 +73,66 @@ static int addClientWindow(XCBWINDOW chi
 	return 1;
 }
 
-void reparentWindow(XCBConnection *c, XCBWINDOW child,
-		XCBVISUALID v, XCBWINDOW r, CARD8 d,
-		INT16 x, INT16 y, CARD16 width, CARD16 height)
-{
-	XCBWINDOW w;
-	XCBDRAWABLE drawable;
-	CARD32 mask = 0;
-	CARD32 values[3];
-	XCBSCREEN *root = XCBSetupRootsIter(XCBGetSetup(c)).data;
-	XCBGCONTEXT titlegc;
+void reparentWindow(xcb_connection_t *c, xcb_window_t child,
+		xcb_visualid_t v, xcb_window_t r, uint8_t d,
+		int16_t x, int16_t y, uint16_t width, uint16_t height)
+{
+	xcb_window_t w;
+	xcb_drawable_t drawable;
+	uint32_t mask = 0;
+	uint32_t values[3];
+	xcb_screen_t *root = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
+	xcb_gcontext_t titlegc;
 
-	w = XCBWINDOWNew(c);
+	w = xcb_window_new(c);
 
-	mask |= XCBCWBackPixel;
+	mask |= XCB_CW_BACK_PIXEL;
 	values[0] = root->white_pixel;
 
-	mask |= XCBCWOverrideRedirect;
+	mask |= XCB_CW_OVERRIDE_REDIRECT;
 	values[1] = 1;
 
-	mask |= XCBCWEventMask;
-	values[2] = XCBEventMaskButtonPress | XCBEventMaskButtonRelease
-		| XCBEventMaskExposure /* | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow */;
+	mask |= XCB_CW_EVENT_MASK;
+	values[2] = XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE
+		| XCB_EVENT_MASK_EXPOSURE /* | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW */;
 
 	printf("Reparenting 0x%08x under 0x%08x.\n", child.xid, w.xid);
-	XCBCreateWindow(c, d, w, r, x, y,
+	xcb_create_window(c, d, w, r, x, y,
 			width + LEFT + RIGHT, height + TOP + BOTTOM,
-			/* border_width */ 0, XCBWindowClassInputOutput, v, mask, values);
-	XCBChangeSaveSet(c, XCBSetModeInsert, child);
-	XCBMapWindow(c, w);
+			/* border_width */ 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, v, mask, values);
+	xcb_change_save_set(c, XCB_SET_MODE_INSERT, child);
+	xcb_map_window(c, w);
 
-	titlegc = XCBGCONTEXTNew(c);
+	titlegc = xcb_gcontext_new(c);
 
-	mask = XCBGCForeground | XCBGCBackground;
+	mask = XCB_GC_FOREGROUND | XCB_GC_BACKGROUND;
 	values[0] = root->black_pixel;
 	values[1] = root->white_pixel;
 	drawable.window = w;
-	XCBCreateGC(c, titlegc, drawable, mask, values);
+	xcb_create_gc(c, titlegc, drawable, mask, values);
 	addClientWindow(child, w, titlegc);
 
-	XCBReparentWindow(c, child, w, LEFT - 1, TOP - 1);
+	xcb_reparent_window(c, child, w, LEFT - 1, TOP - 1);
 
-	mask = XCBCWEventMask;
-	values[0] = XCBEventMaskPropertyChange | XCBEventMaskStructureNotify;
-	XCBChangeWindowAttributes(c, child, mask, values);
+	mask = XCB_CW_EVENT_MASK;
+	values[0] = XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+	xcb_change_window_attributes(c, child, mask, values);
 
-	XCBFlush(c);
+	xcb_flush(c);
 }
 
-static void redrawWindow(XCBConnection *c, ClientWindow *client)
+static void redrawWindow(xcb_connection_t *c, ClientWindow *client)
 {
-	XCBDRAWABLE d = { client->parent };
+	xcb_drawable_t d = { client->parent };
 	if(!client->name_len)
 		return;
-	XCBClearArea(c, 0, d.window, 0, 0, 0, 0);
-	XCBImageText8(c, client->name_len, d, client->titlegc,
+	xcb_clear_area(c, 0, d.window, 0, 0, 0, 0);
+	xcb_image_text_8(c, client->name_len, d, client->titlegc,
 			LEFT - 1, TOP - 4, client->name);
-	XCBFlush(c);
+	xcb_flush(c);
 }
 
-static int handleExposeEvent(void *data, XCBConnection *c, XCBExposeEvent *e)
+static int handleExposeEvent(void *data, xcb_connection_t *c, xcb_expose_event_t *e)
 {
 	ClientWindow *client = TableGet(byParent, e->window.xid);
 	if(!client || e->count != 0)
@@ -141,7 +141,7 @@ static int handleExposeEvent(void *data,
 	return 1;
 }
 
-static int handleWMNameChange(void *data, XCBConnection *c, BYTE state, XCBWINDOW window, XCBATOM atom, XCBGetPropertyRep *prop)
+static int handleWMNameChange(void *data, xcb_connection_t *c, uint8_t state, xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop)
 {
 	ClientWindow *client = TableGet(byChild, window.xid);
 	printf("WM_NAME change: Window 0x%08x ", window.xid);
@@ -163,10 +163,10 @@ static int handleWMNameChange(void *data
 		return 1;
 	}
 
-	client->name_len = XCBGetPropertyValueLength(prop);
+	client->name_len = xcb_get_property_value_length(prop);
 	client->name = malloc(client->name_len);
 	assert(client->name);
-	strncpy(client->name, XCBGetPropertyValue(prop), client->name_len);
+	strncpy(client->name, xcb_get_property_value(prop), client->name_len);
 	printf("is named \"%.*s\".\n", client->name_len, client->name);
 
 	redrawWindow(c, client);
@@ -175,10 +175,10 @@ static int handleWMNameChange(void *data
 
 int main(int argc, char **argv)
 {
-	XCBConnection *c;
-	EventHandlers *evenths;
-	PropertyHandlers *prophs;
-	XCBWINDOW root;
+	xcb_connection_t *c;
+	event_handlers_t *evenths;
+	property_handlers_t *prophs;
+	xcb_window_t root;
 	pthread_t event_thread;
         int screen_nbr;
 	int i;
@@ -186,36 +186,36 @@ int main(int argc, char **argv)
 	byChild = AllocTable();
 	byParent = AllocTable();
 
-	c = XCBConnect(NULL, &screen_nbr);
+	c = xcb_connect(NULL, &screen_nbr);
 
-	evenths = allocEventHandlers(c);
+	evenths = alloc_event_handlers(c);
 
 	for(i = 2; i < 128; ++i)
-		setEventHandler(evenths, i, handleEvent, 0);
+		set_event_handler(evenths, i, handleEvent, 0);
 	for(i = 0; i < 256; ++i)
-		setErrorHandler(evenths, i, (GenericErrorHandler) handleEvent, 0);
-	setButtonPressEventHandler(evenths, handleButtonPressEvent, 0);
-	setButtonReleaseEventHandler(evenths, handleButtonReleaseEvent, 0);
-	setUnmapNotifyEventHandler(evenths, handleUnmapNotifyEvent, 0);
-	setExposeEventHandler(evenths, handleExposeEvent, 0);
+		set_error_handler(evenths, i, (generic_error_handler) handleEvent, 0);
+	set_button_press_event_handler(evenths, handleButtonPressEvent, 0);
+	set_button_release_event_handler(evenths, handleButtonReleaseEvent, 0);
+	set_unmap_notify_event_handler(evenths, handleUnmapNotifyEvent, 0);
+	set_expose_event_handler(evenths, handleExposeEvent, 0);
 
-	prophs = AllocPropertyHandlers(evenths);
-	setMapNotifyEventHandler(evenths, handleMapNotifyEvent, prophs);
+	prophs = alloc_property_handlers(evenths);
+	set_map_notify_event_handler(evenths, handleMapNotifyEvent, prophs);
 	WatchWMName(prophs, 40, handleWMNameChange, 0);
 
 	if(TEST_THREADS)
 	{
-		pthread_create(&event_thread, 0, (void *(*)(void *))eventLoop, evenths);
+		pthread_create(&event_thread, 0, (void *(*)(void *))event_loop, evenths);
 	}
 
-	root = XCBAuxGetScreen(c, screen_nbr)->root;
+	root = xcb_aux_get_screen(c, screen_nbr)->root;
 
 	{
-		CARD32 mask = XCBCWEventMask;
-		CARD32 values[] = { XCBEventMaskSubstructureNotify | XCBEventMaskPropertyChange };
-		XCBChangeWindowAttributes(c, root, mask, values);
+		uint32_t mask = XCB_CW_EVENT_MASK;
+		uint32_t values[] = { XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_PROPERTY_CHANGE };
+		xcb_change_window_attributes(c, root, mask, values);
 	}
-	XCBFlush(c);
+	xcb_flush(c);
 
 	manageExistingWindows(c, prophs, root);
 
@@ -223,7 +223,7 @@ int main(int argc, char **argv)
 	if(TEST_THREADS)
 		pthread_join(event_thread, 0);
 	else
-		eventLoop(evenths);
+		event_loop(evenths);
 
 	exit(0);
 	/*NOTREACHED*/


More information about the xcb-commit mailing list