[Xcb-commit] 2 commits - xcb xcb-demo

Ian Osgood iano at kemper.freedesktop.org
Sun Sep 24 14:24:43 PDT 2006


 xcb-demo/app/xte/xte.c     |  106 +++++------
 xcb-demo/dpms.c            |   36 +--
 xcb-demo/hypnomoire.c      |  104 +++++------
 xcb-demo/neko/xcbneko.c    |  408 ++++++++++++++++++++++-----------------------
 xcb-demo/rendertest.c      |  276 +++++++++++++++---------------
 xcb-demo/reply_formats.c   |   22 +-
 xcb-demo/reply_formats.h   |    8 
 xcb-demo/tests/flames.c    |  128 +++++++-------
 xcb-demo/tests/julia.c     |  108 +++++------
 xcb-demo/tests/julia.h     |   16 -
 xcb-demo/tests/lissajoux.c |  106 +++++------
 xcb-demo/tests/lissajoux.h |   12 -
 xcb-demo/xcb-test.c        |  136 +++++++--------
 xcb-demo/xcbdpyinfo.c      |   52 ++---
 xcb-demo/xcbrandr.c        |   97 +++++-----
 xcb-demo/xcbxf86dri.c      |   20 +-
 xcb-demo/xcbxvinfo.c       |  136 +++++++--------
 xcb/tools/constants        |    1 
 18 files changed, 888 insertions(+), 884 deletions(-)

New commits:
diff-tree fcb8a6180a61e710676f0ac09195aa3eec624e97 (from 81bd5f94f9538c020eca114025181c85e2559f7b)
Author: Ian Osgood <iano at quirkster.com>
Date:   Sun Sep 24 14:24:23 2006 -0700

    All XCB demos compile and work after the Great Renaming.

diff --git a/xcb-demo/app/xte/xte.c b/xcb-demo/app/xte/xte.c
index f7b18a6..3a63f47 100644
--- a/xcb-demo/app/xte/xte.c
+++ b/xcb-demo/app/xte/xte.c
@@ -46,11 +46,11 @@
 
 #define XK_Shift_L                       0xffe1  /* Left shift */
 
-XCBKeySymbols *syms = NULL;
+xcb_key_symbols_t *syms = NULL;
 
-BYTE thing_to_keycode( XCBConnection *c, char *thing ) {
-  XCBKEYCODE kc;
-  XCBKEYSYM ks;
+uint8_t thing_to_keycode( xcb_connection_t *c, char *thing ) {
+  xcb_keycode_t kc;
+  xcb_keysym_t ks;
   
 #if 0   /* There is no XCB equivalent to XStringToKeysym */
   ks = XStringToKeysym( thing );
@@ -60,10 +60,10 @@ BYTE thing_to_keycode( XCBConnection *c,
   }
 #else
   /* For now, assume thing[0] == Latin-1 keysym */
-  ks.id = (BYTE)thing[0];
+  ks.id = (uint8_t)thing[0];
 #endif  
 
-  kc = XCBKeySymbolsGetKeycode( syms, ks );
+  kc = xcb_key_symbols_get_keycode( syms, ks );
 
   dmsg( 1, "String '%s' maps to keysym '%d'\n", thing, ks );
   dmsg( 1, "String '%s' maps to keycode '%d'\n", thing, kc );
@@ -71,30 +71,30 @@ BYTE thing_to_keycode( XCBConnection *c,
   return( kc.id );
 }
 
-/* XCBTestFakeInput(type,detail,time,window,x,y,device) */
+/* xcb_test_fake_input(type,detail,time,window,x,y,device) */
 
 static void
-fake_input(XCBConnection *c, BYTE type, BYTE detail)
+fake_input(xcb_connection_t *c, uint8_t type, uint8_t detail)
 {
-  XCBWINDOW none = { XCBNone };
+  xcb_window_t none = { XCB_NONE };
 
-  XCBTestFakeInput( c, type, detail, 0, none, 0, 0, 0 );
+  xcb_test_fake_input( c, type, detail, 0, none, 0, 0, 0 );
 }
 
 static void
-fake_motion(XCBConnection *c, BOOL relative, CARD16 x, CARD16 y)
+fake_motion(xcb_connection_t *c, uint8_t relative, uint16_t x, uint16_t y)
 {
-  XCBWINDOW window = { XCBNone };
+  xcb_window_t window = { XCB_NONE };
 
   if (!relative) {
-    window = XCBSetupRootsIter(XCBGetSetup(c)).data->root;
+    window = xcb_setup_roots_iterator(xcb_get_setup(c)).data->root;
   }
-  XCBTestFakeInput( c, XCBMotionNotify, relative, 0, window, x, y, 0 );
+  xcb_test_fake_input( c, XCB_MOTION_NOTIFY, relative, 0, window, x, y, 0 );
 }
 
-void send_key( XCBConnection *c, char *thing ) {
-  static XCBKEYSYM shift = { XK_Shift_L };
-  BYTE code, wrap_code = 0;
+void send_key( xcb_connection_t *c, char *thing ) {
+  static xcb_keysym_t shift = { XK_Shift_L };
+  uint8_t code, wrap_code = 0;
 
   dmsg( 1, "Sending key '%s'\n", thing );
 
@@ -105,7 +105,7 @@ void send_key( XCBConnection *c, char *t
     if( strcmp( thing, problems[ probidx ] ) == 0 ) {
       /*wrap_key = problems[ probidx + 1 ]; */
       if (problems[ probidx + 1 ] != NULL) {
-        wrap_code = XCBKeySymbolsGetKeycode( syms, shift ).id;
+        wrap_code = xcb_key_symbols_get_keycode( syms, shift ).id;
       }
       thing = problems[ probidx + 2 ];
       break;
@@ -117,39 +117,39 @@ void send_key( XCBConnection *c, char *t
   const char *cap = "~!@#$%^&*()_+{}|:\"<>?";
   
   if (thing[0] >= 'A' && thing[0] <= 'Z')
-    wrap_code = XCBKeySymbolsGetKeycode( syms, shift ).id;
+    wrap_code = xcb_key_symbols_get_keycode( syms, shift ).id;
   else if (strchr(cap, thing[0]) != NULL)
-    wrap_code = XCBKeySymbolsGetKeycode( syms, shift ).id;
+    wrap_code = xcb_key_symbols_get_keycode( syms, shift ).id;
 #endif
   code = thing_to_keycode( c, thing );
 
   if( wrap_code )
-    fake_input( c, XCBKeyPress, wrap_code );
+    fake_input( c, XCB_KEY_PRESS, wrap_code );
 
-  fake_input( c, XCBKeyPress, code );
-  fake_input( c, XCBKeyRelease, code );
+  fake_input( c, XCB_KEY_PRESS, code );
+  fake_input( c, XCB_KEY_RELEASE, code );
 
   if( wrap_code )
-    fake_input( c, XCBKeyRelease, wrap_code );
+    fake_input( c, XCB_KEY_RELEASE, wrap_code );
 }
 
-void mouse_click( XCBConnection *c, int button ) {
+void mouse_click( xcb_connection_t *c, int button ) {
   dmsg( 1, "Clicking mouse button %d\n", button );
-  fake_input( c, XCBButtonPress, button );
-  fake_input( c, XCBButtonRelease, button );
+  fake_input( c, XCB_BUTTON_PRESS, button );
+  fake_input( c, XCB_BUTTON_RELEASE, button );
 }
 
-void mouse_move( XCBConnection *c, int x, int y ) {
+void mouse_move( xcb_connection_t *c, int x, int y ) {
   dmsg( 1, "Moving mouse to %c,%d\n", x, y );
   fake_motion( c, 0, x, y );
 }
 
-void mouse_rel_move( XCBConnection *c, int x, int y ) {
+void mouse_rel_move( xcb_connection_t *c, int x, int y ) {
   dmsg( 1, "Moving mouse relatively by %c,%d\n", x, y );
   fake_motion( c, 1, x, y );
 }
 
-void process_command( XCBConnection *c, const char *cmd ) {
+void process_command( xcb_connection_t *c, const char *cmd ) {
   /* Process a command */
   int tmpx,tmpy;
   char str[ 128 ];
@@ -164,10 +164,10 @@ void process_command( XCBConnection *c, 
     send_key( c, str );
   }else if( IS_CMD( cmd, "keydown " ) ) {
     strncpy( str, &cmd[ 8 ], 128 );
-    fake_input( c, XCBKeyPress, thing_to_keycode( c, str ) );
+    fake_input( c, XCB_KEY_PRESS, thing_to_keycode( c, str ) );
   }else if( IS_CMD( cmd, "keyup " ) ) {
     strncpy( str, &cmd[ 6 ], 128 );
-    fake_input( c, XCBKeyRelease, thing_to_keycode( c, str ) );
+    fake_input( c, XCB_KEY_RELEASE, thing_to_keycode( c, str ) );
   }else if( IS_CMD( cmd, "mousemove " ) ) {
     sscanf( cmd, "mousemove %d %d", &tmpx, &tmpy );
     mouse_move( c, tmpx, tmpy );
@@ -185,11 +185,11 @@ void process_command( XCBConnection *c, 
   }else if( IS_CMD( cmd, "mousedown " ) ) {
     sscanf( cmd, "mousedown %d", &tmpx );
     tmpx = tmpx<1 ? 1 : (tmpx>5 ? 5 : tmpx);
-    fake_input( c, XCBButtonPress, tmpx );
+    fake_input( c, XCB_BUTTON_PRESS, tmpx );
   }else if( IS_CMD( cmd, "mouseup " ) ) {
     sscanf( cmd, "mouseup %d", &tmpx );
     tmpx = tmpx<1 ? 1 : (tmpx>5 ? 5 : tmpx);
-    fake_input( c, XCBButtonRelease, tmpx );
+    fake_input( c, XCB_BUTTON_RELEASE, tmpx );
   }else if( IS_CMD( cmd, "str " ) ) {
     cmd += 4;
     while( cmd[ 0 ] != 0 ) {
@@ -199,29 +199,29 @@ void process_command( XCBConnection *c, 
     }
   /* in the absence of XStringToKeysym, allow sending hex syms directly */
   }else if( IS_CMD( cmd, "sym " ) ) {
-    XCBKEYSYM sym;
-    XCBKEYCODE code;
+    xcb_keysym_t sym;
+    xcb_keycode_t code;
     sscanf( str, "sym %x", &sym.id );
-    code = XCBKeySymbolsGetKeycode( syms, sym );
-    fake_input( c, XCBKeyPress, code.id );
-    fake_input( c, XCBKeyRelease, code.id );
+    code = xcb_key_symbols_get_keycode( syms, sym );
+    fake_input( c, XCB_KEY_PRESS, code.id );
+    fake_input( c, XCB_KEY_RELEASE, code.id );
   }else if( IS_CMD( cmd, "symdown " ) ) {
-    XCBKEYSYM sym;
+    xcb_keysym_t sym;
     sscanf( str, "symdown %x", &sym.id );
-    fake_input( c, XCBKeyPress, XCBKeySymbolsGetKeycode( syms, sym ).id );
+    fake_input( c, XCB_KEY_PRESS, xcb_key_symbols_get_keycode( syms, sym ).id );
   }else if( IS_CMD( cmd, "symup " ) ) {
-    XCBKEYSYM sym;
+    xcb_keysym_t sym;
     sscanf( str, "symup %x", &sym.id );
-    fake_input( c, XCBKeyRelease, XCBKeySymbolsGetKeycode( syms, sym ).id );
+    fake_input( c, XCB_KEY_RELEASE, xcb_key_symbols_get_keycode( syms, sym ).id );
   }else{
     fprintf( stderr, "Unknown command '%s'\n", cmd );
   }
 
-  XCBFlush( c );
+  xcb_flush( c );
 }
 
 int main( int argc, char *argv[] ) {
-  XCBConnection *c = NULL;
+  xcb_connection_t *c = NULL;
   int cnt;  /*, tmp_i; */
   char *buf, *display = NULL;
   int opt;
@@ -310,19 +310,19 @@ int main( int argc, char *argv[] ) {
     }
   }
 
-  c = XCBConnect( display, NULL );
+  c = xcb_connect( display, NULL );
   if( c == NULL ) {
     fprintf( stderr, "Unable to open display '%s'\n", display == NULL ? "default" : display );
     exit( 1 );
   }
   
   /* do XTest init and version check (need 2.1) */
-  /* XCBTestInit( c );   required? none of the other extension demos do this */
+  /* xcb_test_init( c );   required? none of the other extension demos do this */
   
-  XCBTestGetVersionCookie cookie = XCBTestGetVersion( c, 2, 1 );
+  xcb_test_get_version_cookie_t cookie = xcb_test_get_version( c, 2, 1 );
 
-  XCBGenericError *e = NULL;
-  XCBTestGetVersionRep *xtest_reply = XCBTestGetVersionReply ( c, cookie, &e );
+  xcb_generic_error_t *e = NULL;
+  xcb_test_get_version_reply_t *xtest_reply = xcb_test_get_version_reply ( c, cookie, &e );
   if (xtest_reply) {
     fprintf( stderr, "XTest version %u.%u\n",
       (unsigned int)xtest_reply->major_version,
@@ -336,7 +336,7 @@ int main( int argc, char *argv[] ) {
   
   
   /* prep for keysym-->keycode conversion */
-  syms = XCBKeySymbolsAlloc( c );
+  syms = xcb_key_symbols_alloc( c );
 
   if( argc - optind >= 1 ) {
     /* Arg mode */
@@ -352,8 +352,8 @@ int main( int argc, char *argv[] ) {
     }
   }
   
-  XCBKeySymbolsFree( syms );
+  xcb_key_symbols_free( syms );
 
-  XCBDisconnect( c );
+  xcb_disconnect( c );
   exit( 0 );
 }
diff --git a/xcb-demo/dpms.c b/xcb-demo/dpms.c
index a739f97..822b124 100644
--- a/xcb-demo/dpms.c
+++ b/xcb-demo/dpms.c
@@ -12,23 +12,23 @@
 
 int main(int argc, char **argv)
 {
-	XCBConnection *c = XCBConnect(0, 0);
-	XCBDPMSGetVersionCookie vc;
-	XCBDPMSGetVersionRep *ver;
-	XCBDPMSCapableCookie cc;
-	XCBDPMSCapableRep *cap;
-	XCBDPMSGetTimeoutsCookie tc;
-	XCBDPMSGetTimeoutsRep *time;
-
-	XCBPrefetchExtensionData(c, &XCBDPMSId);
-
-	vc = XCBDPMSGetVersion(c, 1, 1);
-	cc = XCBDPMSCapable(c);
-	tc = XCBDPMSGetTimeouts(c);
-
-	ver = XCBDPMSGetVersionReply(c, vc, 0);
-	cap = XCBDPMSCapableReply(c, cc, 0);
-	time = XCBDPMSGetTimeoutsReply(c, tc, 0);
+	xcb_connection_t *c = xcb_connect(0, 0);
+	xcb_dpms_get_version_cookie_t vc;
+	xcb_dpms_get_version_reply_t *ver;
+	xcb_dpms_capable_cookie_t cc;
+	xcb_dpms_capable_reply_t *cap;
+	xcb_dpms_get_timeouts_cookie_t tc;
+	xcb_dpms_get_timeouts_reply_t *time;
+
+	xcb_prefetch_extension_data(c, &xcb_dpms_id);
+
+	vc = xcb_dpms_get_version(c, 1, 1);
+	cc = xcb_dpms_capable(c);
+	tc = xcb_dpms_get_timeouts(c);
+
+	ver = xcb_dpms_get_version_reply(c, vc, 0);
+	cap = xcb_dpms_capable_reply(c, cc, 0);
+	time = xcb_dpms_get_timeouts_reply(c, tc, 0);
 
 	assert(ver);
 	assert(ver->server_major_version == 1);
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
 		time->standby_timeout, time->suspend_timeout, time->off_timeout);
 	free(time);
 
-	XCBDisconnect(c);
+	xcb_disconnect(c);
 
 	exit(0);
 	/*NOTREACHED*/
diff --git a/xcb-demo/hypnomoire.c b/xcb-demo/hypnomoire.c
index 46e2999..0f98b23 100644
--- a/xcb-demo/hypnomoire.c
+++ b/xcb-demo/hypnomoire.c
@@ -21,17 +21,17 @@
 
 #define PI 3.14159265
 
-static XCBConnection *c;
-static XCBSCREEN *root;
-static XCBGCONTEXT white, black;
+static xcb_connection_t *c;
+static xcb_screen_t *root;
+static xcb_gcontext_t white, black;
 static int depth;
 
 #define WINS 8
 static struct {
-	XCBDRAWABLE w;
-	XCBDRAWABLE p;
-	CARD16 width;
-	CARD16 height;
+	xcb_drawable_t w;
+	xcb_drawable_t p;
+	uint16_t width;
+	uint16_t height;
 	float angv;
 } windows[WINS];
 
@@ -40,9 +40,9 @@ void *event_thread(void *param);
 
 static void get_depth()
 {
-	XCBDRAWABLE drawable = { root->root };
-	XCBGetGeometryRep *geom;
-	geom = XCBGetGeometryReply(c, XCBGetGeometry(c, drawable), 0);
+	xcb_drawable_t drawable = { root->root };
+	xcb_get_geometry_reply_t *geom;
+	geom = xcb_get_geometry_reply(c, xcb_get_geometry(c, drawable), 0);
 	if(!geom)
 	{
 		perror("GetGeometry(root) failed");
@@ -60,28 +60,28 @@ int main()
 	pthread_t thr;
 	int i;
 
-	CARD32 mask = XCBGCForeground | XCBGCGraphicsExposures;
-	CARD32 values[2];
-	XCBDRAWABLE rootwin;
+	uint32_t mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
+	uint32_t values[2];
+	xcb_drawable_t rootwin;
 	int screen_num;
 
-	c = XCBConnect(0, &screen_num);
-	root = XCBAuxGetScreen(c, screen_num);
+	c = xcb_connect(0, &screen_num);
+	root = xcb_aux_get_screen(c, screen_num);
 	get_depth();
 
 	rootwin.window = root->root;
-	white = XCBGCONTEXTNew(c);
-	black = XCBGCONTEXTNew(c);
+	white = xcb_gcontext_new(c);
+	black = xcb_gcontext_new(c);
 
 	pthread_create(&thr, 0, event_thread, 0);
 
 	values[1] = 0; /* no graphics exposures */
 
 	values[0] = root->white_pixel;
-	XCBCreateGC(c, white, rootwin, mask, values);
+	xcb_create_gc(c, white, rootwin, mask, values);
 
 	values[0] = root->black_pixel;
-	XCBCreateGC(c, black, rootwin, mask, values);
+	xcb_create_gc(c, black, rootwin, mask, values);
 
 	for(i = 1; i < WINS; ++i)
 		pthread_create(&thr, 0, run, (void*)i);
@@ -93,14 +93,16 @@ int main()
 
 void paint(int idx)
 {
-	XCBCopyArea(c, windows[idx].p, windows[idx].w, white, 0, 0, 0, 0,
+	xcb_copy_area(c, windows[idx].p, windows[idx].w, white, 0, 0, 0, 0,
 		windows[idx].width, windows[idx].height);
-	/* TODO: better error detection for broken pipe */
-	if(!XCBSync(c, 0))
+	/* FIXME: better error detection for broken pipe
+	if(!xcb_sync(c, 0))
 	{
-		perror("XCBSync failed");
+		perror("xcb_sync_t failed");
 		abort();
 	}
+	*/
+	xcb_aux_sync(c);
 }
 
 void *run(void *param)
@@ -110,10 +112,10 @@ void *run(void *param)
 	int xo, yo;
 	double r, theta = 0;
 
-	XCBPOINT line[2];
+	xcb_point_t line[2];
 
-	windows[idx].w.window = XCBWINDOWNew(c);
-	windows[idx].p.pixmap = XCBPIXMAPNew(c);
+	windows[idx].w.window = xcb_window_new(c);
+	windows[idx].p.pixmap = xcb_pixmap_new(c);
 	windows[idx].width = 300;
 	line[0].x = xo = windows[idx].width / 2;
 	windows[idx].height = 300;
@@ -127,41 +129,41 @@ void *run(void *param)
 	}
 
 	{
-		CARD32 mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
-		CARD32 values[3];
-		XCBRECTANGLE rect = { 0, 0, windows[idx].width, windows[idx].height };
+		uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
+		uint32_t values[3];
+		xcb_rectangle_t rect = { 0, 0, windows[idx].width, windows[idx].height };
 		values[0] = root->white_pixel;
-		values[1] = XCBEventMaskButtonRelease | XCBEventMaskExposure;
-		values[2] = XCBEventMaskButtonPress;
+		values[1] = XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE;
+		values[2] = XCB_EVENT_MASK_BUTTON_PRESS;
 
-		XCBCreateWindow(c, depth, windows[idx].w.window, root->root,
+		xcb_create_window(c, depth, windows[idx].w.window, root->root,
 			/* x */ 0, /* y */ 0,
 			windows[idx].width, windows[idx].height,
-			/* border */ 0, XCBWindowClassInputOutput,
+			/* border */ 0, XCB_WINDOW_CLASS_INPUT_OUTPUT,
 			/* visual */ root->root_visual,
 			mask, values);
 
-		XCBMapWindow(c, windows[idx].w.window);
+		xcb_map_window(c, windows[idx].w.window);
 
-		XCBCreatePixmap(c, depth,
+		xcb_create_pixmap(c, depth,
 			windows[idx].p.pixmap, windows[idx].w,
 			windows[idx].width, windows[idx].height);
 
-		XCBPolyFillRectangle(c, windows[idx].p, white, 1, &rect);
+		xcb_poly_fill_rectangle(c, windows[idx].p, white, 1, &rect);
 	}
 
-	XCBFlush(c);
+	xcb_flush(c);
 
 	while(1)
 	{
 		line[1].x = xo + r * cos(theta);
 		line[1].y = yo + r * sin(theta);
-		XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, black,
+		xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, windows[idx].p, black,
 			2, line);
 
 		line[1].x = xo + r * cos(theta + LAG);
 		line[1].y = yo + r * sin(theta + LAG);
-		XCBPolyLine(c, XCBCoordModeOrigin, windows[idx].p, white,
+		xcb_poly_line(c, XCB_COORD_MODE_ORIGIN, windows[idx].p, white,
 			2, line);
 
 		paint(idx);
@@ -177,7 +179,7 @@ void *run(void *param)
         return 0;
 }
 
-int lookup_window(XCBWINDOW w)
+int lookup_window(xcb_window_t w)
 {
 	int i;
 	for(i = 0; i < WINS; ++i)
@@ -188,42 +190,42 @@ int lookup_window(XCBWINDOW w)
 
 void *event_thread(void *param)
 {
-	XCBGenericEvent *e;
+	xcb_generic_event_t *e;
 	int idx;
 
 	while(1)
 	{
-		e = XCBWaitForEvent(c);
+		e = xcb_wait_for_event(c);
 		if(!formatEvent(e))
 			return 0;
-		if(e->response_type == XCBExpose)
+		if(e->response_type == XCB_EXPOSE)
 		{
-			XCBExposeEvent *ee = (XCBExposeEvent *) e;
+			xcb_expose_event_t *ee = (xcb_expose_event_t *) e;
 			idx = lookup_window(ee->window);
 			if(idx == -1)
 				fprintf(stderr, "Expose on unknown window!\n");
 			else
 			{
-				XCBCopyArea(c, windows[idx].p, windows[idx].w,
+				xcb_copy_area(c, windows[idx].p, windows[idx].w,
 					white, ee->x, ee->y, ee->x, ee->y,
 					ee->width, ee->height);
 				if(ee->count == 0)
-					XCBFlush(c);
+					xcb_flush(c);
 			}
 		}
-		else if(e->response_type == XCBButtonRelease)
+		else if(e->response_type == XCB_BUTTON_RELEASE)
 		{
-			XCBButtonReleaseEvent *bre = (XCBButtonReleaseEvent *) e;
+			xcb_button_release_event_t *bre = (xcb_button_release_event_t *) e;
 			idx = lookup_window(bre->event);
 			if(idx == -1)
 				fprintf(stderr, "ButtonRelease on unknown window!\n");
 			else
 			{
-				if(bre->detail.id == XCBButton1)
+				if(bre->detail.id == XCB_BUTTON_INDEX_1)
 					windows[idx].angv = -windows[idx].angv;
-				else if(bre->detail.id == XCBButton4)
+				else if(bre->detail.id == XCB_BUTTON_INDEX_4)
 					windows[idx].angv += 0.001;
-				else if(bre->detail.id == XCBButton5)
+				else if(bre->detail.id == XCB_BUTTON_INDEX_5)
 					windows[idx].angv -= 0.001;
 			}
 		}
diff --git a/xcb-demo/neko/xcbneko.c b/xcb-demo/neko/xcbneko.c
index b0b6311..9bc38fa 100644
--- a/xcb-demo/neko/xcbneko.c
+++ b/xcb-demo/neko/xcbneko.c
@@ -24,7 +24,7 @@
 #define X_H   /* make sure we aren't using symbols from X.h */
 #include <X11/XCB/xcb.h>
 /*#include <X11/XCB/xcb_image.h>*/
-#include <X11/XCB/xcb_aux.h>		/* XCBAuxGetScreen */
+#include <X11/XCB/xcb_aux.h>		/* xcb_aux_get_screen_t */
 #include <X11/XCB/xcb_icccm.h>
 #include <X11/XCB/xcb_atom.h>		/* STRING atom */
 #include <X11/XCB/xcb_keysyms.h>
@@ -93,10 +93,10 @@ typedef enum { False, True } Bool;
 #define	DEFAULT_WIN_Y		1
 #define	AVAIL_KEYBUF		255
 
-#define	EVENT_MASK       ( XCBEventMaskKeyPress | XCBEventMaskButtonPress | \
-						   XCBEventMaskExposure | XCBEventMaskStructureNotify )
+#define	EVENT_MASK       ( XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_BUTTON_PRESS | \
+						   XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY )
 
-#define	EVENT_MASK_ROOT  ( XCBEventMaskKeyPress | XCBEventMaskExposure )
+#define	EVENT_MASK_ROOT  ( XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_EXPOSURE )
 
 #define	MAX_TICK		9999		/* Odd Only! */
 #define	INTERVAL		125000L
@@ -141,14 +141,14 @@ char        *fgColor, *bgColor;
 
 static char  *ProgramName;
 
-XCBConnection	*xc;
-XCBSCREEN      *theScreen;		/* instead of macro(theDisplay, int theScreen) */
+xcb_connection_t	*xc;
+xcb_screen_t      *theScreen;		/* instead of macro(theDisplay, int theScreen) */
 unsigned long  theFgPixel;
 unsigned long  theBgPixel;
-XCBWINDOW         theWindow;
-XCBCURSOR         theCursor;
-XCBKeySymbols	*theKeySyms;
-XCBATOM deleteWindowAtom;
+xcb_window_t         theWindow;
+xcb_cursor_t         theCursor;
+xcb_key_symbols_t	*theKeySyms;
+xcb_atom_t deleteWindowAtom;
 
 static unsigned int  WindowWidth;
 static unsigned int  WindowHeight;
@@ -179,92 +179,92 @@ int		NekoMoveDy;
 
 int		NekoLastX;
 int		NekoLastY;
-XCBGCONTEXT		NekoLastGC;
+xcb_gcontext_t		NekoLastGC;
 
 double	NekoSpeed = (double)NEKO_SPEED;
 
 double	SinPiPer8Times3;
 double	SinPiPer8;
 
-XCBPIXMAP	SpaceXbm;
+xcb_pixmap_t	SpaceXbm;
 
-XCBPIXMAP	Mati2Xbm;
-XCBPIXMAP	Jare2Xbm;
-XCBPIXMAP	Kaki1Xbm;
-XCBPIXMAP	Kaki2Xbm;
-XCBPIXMAP	Mati3Xbm;
-XCBPIXMAP	Sleep1Xbm;
-XCBPIXMAP	Sleep2Xbm;
-
-XCBPIXMAP	AwakeXbm;
-
-XCBPIXMAP	Up1Xbm;
-XCBPIXMAP	Up2Xbm;
-XCBPIXMAP	Down1Xbm;
-XCBPIXMAP	Down2Xbm;
-XCBPIXMAP	Left1Xbm;
-XCBPIXMAP	Left2Xbm;
-XCBPIXMAP	Right1Xbm;
-XCBPIXMAP	Right2Xbm;
-XCBPIXMAP	UpLeft1Xbm;
-XCBPIXMAP	UpLeft2Xbm;
-XCBPIXMAP	UpRight1Xbm;
-XCBPIXMAP	UpRight2Xbm;
-XCBPIXMAP	DownLeft1Xbm;
-XCBPIXMAP	DownLeft2Xbm;
-XCBPIXMAP	DownRight1Xbm;
-XCBPIXMAP	DownRight2Xbm;
-
-XCBPIXMAP	UpTogi1Xbm;
-XCBPIXMAP	UpTogi2Xbm;
-XCBPIXMAP	DownTogi1Xbm;
-XCBPIXMAP	DownTogi2Xbm;
-XCBPIXMAP	LeftTogi1Xbm;
-XCBPIXMAP	LeftTogi2Xbm;
-XCBPIXMAP	RightTogi1Xbm;
-XCBPIXMAP	RightTogi2Xbm;
-
-XCBGCONTEXT	SpaceGC;
-
-XCBGCONTEXT	Mati2GC;
-XCBGCONTEXT	Jare2GC;
-XCBGCONTEXT	Kaki1GC;
-XCBGCONTEXT	Kaki2GC;
-XCBGCONTEXT	Mati3GC;
-XCBGCONTEXT	Sleep1GC;
-XCBGCONTEXT	Sleep2GC;
-
-XCBGCONTEXT	AwakeGC;
-
-XCBGCONTEXT	Up1GC;
-XCBGCONTEXT	Up2GC;
-XCBGCONTEXT	Down1GC;
-XCBGCONTEXT	Down2GC;
-XCBGCONTEXT	Left1GC;
-XCBGCONTEXT	Left2GC;
-XCBGCONTEXT	Right1GC;
-XCBGCONTEXT	Right2GC;
-XCBGCONTEXT	UpLeft1GC;
-XCBGCONTEXT	UpLeft2GC;
-XCBGCONTEXT	UpRight1GC;
-XCBGCONTEXT	UpRight2GC;
-XCBGCONTEXT	DownLeft1GC;
-XCBGCONTEXT	DownLeft2GC;
-XCBGCONTEXT	DownRight1GC;
-XCBGCONTEXT	DownRight2GC;
-
-XCBGCONTEXT	UpTogi1GC;
-XCBGCONTEXT	UpTogi2GC;
-XCBGCONTEXT	DownTogi1GC;
-XCBGCONTEXT	DownTogi2GC;
-XCBGCONTEXT	LeftTogi1GC;
-XCBGCONTEXT	LeftTogi2GC;
-XCBGCONTEXT	RightTogi1GC;
-XCBGCONTEXT	RightTogi2GC;
+xcb_pixmap_t	Mati2Xbm;
+xcb_pixmap_t	Jare2Xbm;
+xcb_pixmap_t	Kaki1Xbm;
+xcb_pixmap_t	Kaki2Xbm;
+xcb_pixmap_t	Mati3Xbm;
+xcb_pixmap_t	Sleep1Xbm;
+xcb_pixmap_t	Sleep2Xbm;
+
+xcb_pixmap_t	AwakeXbm;
+
+xcb_pixmap_t	Up1Xbm;
+xcb_pixmap_t	Up2Xbm;
+xcb_pixmap_t	Down1Xbm;
+xcb_pixmap_t	Down2Xbm;
+xcb_pixmap_t	Left1Xbm;
+xcb_pixmap_t	Left2Xbm;
+xcb_pixmap_t	Right1Xbm;
+xcb_pixmap_t	Right2Xbm;
+xcb_pixmap_t	UpLeft1Xbm;
+xcb_pixmap_t	UpLeft2Xbm;
+xcb_pixmap_t	UpRight1Xbm;
+xcb_pixmap_t	UpRight2Xbm;
+xcb_pixmap_t	DownLeft1Xbm;
+xcb_pixmap_t	DownLeft2Xbm;
+xcb_pixmap_t	DownRight1Xbm;
+xcb_pixmap_t	DownRight2Xbm;
+
+xcb_pixmap_t	UpTogi1Xbm;
+xcb_pixmap_t	UpTogi2Xbm;
+xcb_pixmap_t	DownTogi1Xbm;
+xcb_pixmap_t	DownTogi2Xbm;
+xcb_pixmap_t	LeftTogi1Xbm;
+xcb_pixmap_t	LeftTogi2Xbm;
+xcb_pixmap_t	RightTogi1Xbm;
+xcb_pixmap_t	RightTogi2Xbm;
+
+xcb_gcontext_t	SpaceGC;
+
+xcb_gcontext_t	Mati2GC;
+xcb_gcontext_t	Jare2GC;
+xcb_gcontext_t	Kaki1GC;
+xcb_gcontext_t	Kaki2GC;
+xcb_gcontext_t	Mati3GC;
+xcb_gcontext_t	Sleep1GC;
+xcb_gcontext_t	Sleep2GC;
+
+xcb_gcontext_t	AwakeGC;
+
+xcb_gcontext_t	Up1GC;
+xcb_gcontext_t	Up2GC;
+xcb_gcontext_t	Down1GC;
+xcb_gcontext_t	Down2GC;
+xcb_gcontext_t	Left1GC;
+xcb_gcontext_t	Left2GC;
+xcb_gcontext_t	Right1GC;
+xcb_gcontext_t	Right2GC;
+xcb_gcontext_t	UpLeft1GC;
+xcb_gcontext_t	UpLeft2GC;
+xcb_gcontext_t	UpRight1GC;
+xcb_gcontext_t	UpRight2GC;
+xcb_gcontext_t	DownLeft1GC;
+xcb_gcontext_t	DownLeft2GC;
+xcb_gcontext_t	DownRight1GC;
+xcb_gcontext_t	DownRight2GC;
+
+xcb_gcontext_t	UpTogi1GC;
+xcb_gcontext_t	UpTogi2GC;
+xcb_gcontext_t	DownTogi1GC;
+xcb_gcontext_t	DownTogi2GC;
+xcb_gcontext_t	LeftTogi1GC;
+xcb_gcontext_t	LeftTogi2GC;
+xcb_gcontext_t	RightTogi1GC;
+xcb_gcontext_t	RightTogi2GC;
 
 typedef struct {
-  XCBGCONTEXT            *GCCreatePtr;
-  XCBPIXMAP        *BitmapCreatePtr;
+  xcb_gcontext_t            *GCCreatePtr;
+  xcb_pixmap_t        *BitmapCreatePtr;
   char          *PixelPattern;
   unsigned int  PixelWidth;
   unsigned int  PixelHeight;
@@ -314,8 +314,8 @@ BitmapGCData	BitmapGCDataTable[] = {
 };
 
 typedef struct {
-  XCBGCONTEXT  *TickEvenGCPtr;
-  XCBGCONTEXT  *TickOddGCPtr;
+  xcb_gcontext_t  *TickEvenGCPtr;
+  xcb_gcontext_t  *TickOddGCPtr;
 } Animation;
 
 Animation  AnimationPattern[] = {
@@ -399,23 +399,23 @@ SwapBits(
 
 /* CrPFBData.c and CrBFData.c (very similar) */
 /*  if depth==1, behaves like CreateBitmapFromData */
-XCBPIXMAP CreatePixmapFromBitmapData( XCBConnection *c,
-	XCBWINDOW window, char *data, CARD16 w, CARD16 h,
-	CARD32 fg, CARD32 bg, CARD32 depth)
+xcb_pixmap_t CreatePixmapFromBitmapData( xcb_connection_t *c,
+	xcb_window_t window, char *data, uint16_t w, uint16_t h,
+	uint32_t fg, uint32_t bg, uint32_t depth)
 {
-  XCBDRAWABLE drawable;
-  XCBPIXMAP bitmap = XCBPIXMAPNew( c );
+  xcb_drawable_t drawable;
+  xcb_pixmap_t bitmap = xcb_pixmap_new( c );
 
   drawable.window = window;
-  XCBCreatePixmap( c, depth, bitmap, drawable, w, h );
+  xcb_create_pixmap( c, depth, bitmap, drawable, w, h );
   
-  XCBGCONTEXT gc = XCBGCONTEXTNew( c );
+  xcb_gcontext_t gc = xcb_gcontext_new( c );
   
-  CARD32 mask = (depth==1 ? 0 : XCBGCForeground | XCBGCBackground);
-  CARD32 values[] = { fg, bg };
+  uint32_t mask = (depth==1 ? 0 : XCB_GC_FOREGROUND | XCB_GC_BACKGROUND);
+  uint32_t values[] = { fg, bg };
 
   drawable.pixmap = bitmap;
-  XCBCreateGC( c, gc, drawable, mask, values );
+  xcb_create_gc( c, gc, drawable, mask, values );
   
   /* XImage attributes: bpp=1, xoffset=0,
        byte_order=bit_order=LSB, unit=8, pad=8,   bpl=(w+7/8) */
@@ -424,20 +424,20 @@ XCBPIXMAP CreatePixmapFromBitmapData( XC
   
   /* Mac X Server: byte_order=bit_order=MSB, unit=32, padding=32 */
   long bpl = (w+7)/8;
-  long pad = XCBGetSetup(c)->bitmap_format_scanline_pad;
+  long pad = xcb_get_setup(c)->bitmap_format_scanline_pad;
   long bpd = ROUNDUP(w, pad)>>3;
   long bufLen = bpd * h;
-  BYTE buf[1024];
-  if (XCBGetSetup(c)->bitmap_format_scanline_unit == 32 &&
-      XCBGetSetup(c)->bitmap_format_bit_order == XCBImageOrderMSBFirst &&
-      XCBGetSetup(c)->image_byte_order == XCBImageOrderMSBFirst)
+  uint8_t buf[1024];
+  if (xcb_get_setup(c)->bitmap_format_scanline_unit == 32 &&
+      xcb_get_setup(c)->bitmap_format_bit_order == XCB_IMAGE_ORDER_MSB_FIRST &&
+      xcb_get_setup(c)->image_byte_order == XCB_IMAGE_ORDER_MSB_FIRST)
   {
     SwapBits((unsigned char *)data, buf, bpl, bpl, bpd, h);
   }
   else if (bpl != bpd)
   {
     int i;
-    BYTE *src = (BYTE *)data, *dest = buf;
+    uint8_t *src = (uint8_t *)data, *dest = buf;
     for (i=0; i<h; i++, dest += bpd, src += bpl)
       memcpy(dest, src, bpl);
   }
@@ -447,50 +447,50 @@ XCBPIXMAP CreatePixmapFromBitmapData( XC
   /* note: CBfD uses XYPixmap, but CPfBD uses XYBitmap
            there shouldn't be a difference when depth==1,
            but the neko images are corrupt if using XYPixmap */
-  CARD8 format = (depth==1 ? XCBImageFormatXYPixmap : XCBImageFormatXYBitmap);
+  uint8_t format = (depth==1 ? XCB_IMAGE_FORMAT_XY_PIXMAP : XCB_IMAGE_FORMAT_XY_BITMAP);
   
   /* PutImage.c: left_pad = (image->xoffset + req->xoffset) & (dpy->bitmap_unit-1)
        screen->bitmap_format_scanline_unit
        left_pad = (0 + 0) & (32 - 1) = 0 */
 
-  XCBPutImage( c, format, drawable, gc,
+  xcb_put_image( c, format, drawable, gc,
   	w, h, 0, 0,
   	0, 1,		/* left_pad, depth */
   	bufLen, buf);
 
 #if DEBUG
-  XCBGenericError *error = NULL;
-  XCBSync( c, &error );
+  xcb_generic_error_t *error = NULL;
+  xcb_sync( c, &error );
   if (error) {
     printf("error code %d", (int)error->error_code);
     free(error);
   }
 #endif
 
-  XCBFreeGC( c, gc );
+  xcb_free_gc( c, gc );
   
-  /* later: XCBFreePixmap( c, bitmap ); */
+  /* later: xcb_free_pixmap( c, bitmap ); */
   return bitmap;
 }
 
-XCBPIXMAP CreateBitmapFromData(XCBConnection *c, XCBWINDOW window,
-	char *data, CARD16 w, CARD16 h)
+xcb_pixmap_t CreateBitmapFromData(xcb_connection_t *c, xcb_window_t window,
+	char *data, uint16_t w, uint16_t h)
 {
-	CARD32 depth = 1;
+	uint32_t depth = 1;
 	return CreatePixmapFromBitmapData(c, window, data, w, h, 0, 0, depth);
 }
 
 void  InitBitmapAndGCs(void) {
   BitmapGCData	*BitmapGCDataTablePtr;
-  CARD32 theGCValues[5];
-  XCBDRAWABLE drawable;   drawable.window = theWindow;
+  uint32_t theGCValues[5];
+  xcb_drawable_t drawable;   drawable.window = theWindow;
 
-  theGCValues[0] = XCBGXcopy;
+  theGCValues[0] = XCB_GX_COPY;
 
   theGCValues[1] = theFgPixel;
   theGCValues[2] = theBgPixel;
 
-  theGCValues[3] = XCBFillStyleTiled;
+  theGCValues[3] = XCB_FILL_STYLE_TILED;
   
   /* TODO: latency: make all the bitmaps, then all the contexts? */
 
@@ -507,23 +507,23 @@ void  InitBitmapAndGCs(void) {
 
 	theGCValues[4] = BitmapGCDataTablePtr->BitmapCreatePtr->xid; /* tile */
 	
-	*(BitmapGCDataTablePtr->GCCreatePtr) = XCBGCONTEXTNew( xc );
-	XCBCreateGC( xc, *(BitmapGCDataTablePtr->GCCreatePtr), drawable,
-		  XCBGCFunction | XCBGCForeground | XCBGCBackground |
-		  XCBGCFillStyle | XCBGCTile,
+	*(BitmapGCDataTablePtr->GCCreatePtr) = xcb_gcontext_new( xc );
+	xcb_create_gc( xc, *(BitmapGCDataTablePtr->GCCreatePtr), drawable,
+		  XCB_GC_FUNCTION | XCB_GC_FOREGROUND | XCB_GC_BACKGROUND |
+		  XCB_GC_FILL_STYLE | XCB_GC_TILE,
 		  theGCValues );
   }
   
-  /* later: XCBFreePixmap( c, bitmap ); */
-  /* later: XCBFreeGC( c, gc ); */
+  /* later: xcb_free_pixmap( c, bitmap ); */
+  /* later: xcb_free_gc( c, gc ); */
 }
 
-XCBATOM
-GetAtom(XCBConnection *c, const char *atomName)
+xcb_atom_t
+GetAtom(xcb_connection_t *c, const char *atomName)
 {
-	XCBATOM atom = { XCBNone };
-	XCBInternAtomRep *r = XCBInternAtomReply(c,
-		XCBInternAtom(c, 0, strlen(atomName), atomName), NULL);
+	xcb_atom_t atom = { XCB_NONE };
+	xcb_intern_atom_reply_t *r = xcb_intern_atom_reply(c,
+		xcb_intern_atom(c, 0, strlen(atomName), atomName), NULL);
 	if (r) {
 		atom = r->atom;
 		free(r);
@@ -534,13 +534,13 @@ GetAtom(XCBConnection *c, const char *at
 void
 InitScreen( char *DisplayName, char *theGeometry, char *theTitle, Bool iconicState )
 {
-  XCBPIXMAP		theCursorSource;
-  XCBPIXMAP		theCursorMask;
+  xcb_pixmap_t		theCursorSource;
+  xcb_pixmap_t		theCursorMask;
   unsigned int   theDepth;
-  XCBCOLORMAP		theColormap;
+  xcb_colormap_t		theColormap;
   int screen;
   
-  if ( ( xc = XCBConnect( DisplayName, &screen ) ) == NULL ) {
+  if ( ( xc = xcb_connect( DisplayName, &screen ) ) == NULL ) {
 	fprintf( stderr, "%s: Can't open connection", ProgramName );
 	if ( DisplayName != NULL )
 	  fprintf( stderr, " %s.\n", DisplayName );
@@ -549,7 +549,7 @@ InitScreen( char *DisplayName, char *the
 	exit( 1 );
   }
   
-  theScreen = XCBAuxGetScreen(xc, screen);
+  theScreen = xcb_aux_get_screen(xc, screen);
   if (theScreen == NULL) {
 	fprintf( stderr, "%s: Can't get default screen", ProgramName );
 	exit( 1 );
@@ -586,19 +586,19 @@ InitScreen( char *DisplayName, char *the
   if ( bgColor == NULL) bgColor = "white";
   if ( fgColor == NULL) fgColor = "black";
   
-  XCBAllocNamedColorCookie bgCookie = XCBAllocNamedColor ( xc,
+  xcb_alloc_named_color_cookie_t bgCookie = xcb_alloc_named_color ( xc,
 		theColormap,  strlen(bgColor), bgColor );
 
-  XCBAllocNamedColorCookie fgCookie = XCBAllocNamedColor ( xc,
+  xcb_alloc_named_color_cookie_t fgCookie = xcb_alloc_named_color ( xc,
 		theColormap,  strlen(fgColor), fgColor );
 
   /* mouse cursor is always black and white */
-  XCBAllocNamedColorCookie blackCookie = XCBAllocNamedColor ( xc,
+  xcb_alloc_named_color_cookie_t blackCookie = xcb_alloc_named_color ( xc,
 		theColormap,  strlen("black"), "black" );
-  XCBAllocNamedColorCookie whiteCookie = XCBAllocNamedColor ( xc,
+  xcb_alloc_named_color_cookie_t whiteCookie = xcb_alloc_named_color ( xc,
 		theColormap,  strlen("white"), "white" );
 		
-  XCBAllocNamedColorRep *bgRep = XCBAllocNamedColorReply( xc, bgCookie, 0 );
+  xcb_alloc_named_color_reply_t *bgRep = xcb_alloc_named_color_reply( xc, bgCookie, 0 );
   if (!bgRep) {
 	fprintf( stderr,
 			"%s: Can't allocate the background color %s.\n", ProgramName, bgColor );
@@ -606,7 +606,7 @@ InitScreen( char *DisplayName, char *the
   }
   theBgPixel = bgRep->pixel;
 
-  XCBAllocNamedColorRep *fgRep = XCBAllocNamedColorReply( xc, fgCookie, 0 );
+  xcb_alloc_named_color_reply_t *fgRep = xcb_alloc_named_color_reply( xc, fgCookie, 0 );
   if (!fgRep) {
 	fprintf( stderr,
 			"%s: Can't allocate the foreground color %s.\n", ProgramName, fgColor );
@@ -614,21 +614,21 @@ InitScreen( char *DisplayName, char *the
   }
   theFgPixel = fgRep->pixel;
 
-  XCBAllocNamedColorRep *blackRep = XCBAllocNamedColorReply( xc, blackCookie, 0 );
+  xcb_alloc_named_color_reply_t *blackRep = xcb_alloc_named_color_reply( xc, blackCookie, 0 );
   if (!blackRep) {
 	fprintf( stderr,
 			"%s: Can't allocate the black color.\n", ProgramName );
 	exit( 1 );
   }
-  XCBAllocNamedColorRep *whiteRep = XCBAllocNamedColorReply( xc, whiteCookie, 0 );
+  xcb_alloc_named_color_reply_t *whiteRep = xcb_alloc_named_color_reply( xc, whiteCookie, 0 );
   if (!whiteRep) {
 	fprintf( stderr,
 			"%s: Can't allocate the white color.\n", ProgramName );
 	exit( 1 );
   }
   
-  theCursor = XCBCURSORNew( xc );
-  XCBCreateCursor ( xc, theCursor, theCursorSource, theCursorMask,
+  theCursor = xcb_cursor_new( xc );
+  xcb_create_cursor ( xc, theCursor, theCursorSource, theCursorMask,
   	blackRep->visual_red, blackRep->visual_green, blackRep->visual_blue,
   	whiteRep->visual_red, whiteRep->visual_green, whiteRep->visual_blue,
   	cursor_x_hot, cursor_y_hot );
@@ -639,17 +639,17 @@ InitScreen( char *DisplayName, char *the
   free(whiteRep);
 
   if ( useRoot ) {
-    CARD32 rootAttributes[] = { theBgPixel, EVENT_MASK_ROOT, theCursor.xid };
+    uint32_t rootAttributes[] = { theBgPixel, EVENT_MASK_ROOT, theCursor.xid };
 	theWindow = theScreen->root;
-	XCBChangeWindowAttributes(xc, theWindow,
-		XCBCWBackPixel | XCBCWEventMask | XCBCWCursor, rootAttributes );
+	xcb_change_window_attributes(xc, theWindow,
+		XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_CURSOR, rootAttributes );
 	
 	/* XClearWindow: clear area with all dimensions 0 */
-	XCBClearArea( xc, False, theWindow, 0, 0, 0, 0 );
+	xcb_clear_area( xc, False, theWindow, 0, 0, 0, 0 );
 	
-	XCBDRAWABLE d = { theWindow };
-	XCBGetGeometryRep *geometry = XCBGetGeometryReply( xc,
-	  XCBGetGeometry( xc, d ), NULL);
+	xcb_drawable_t d = { theWindow };
+	xcb_get_geometry_reply_t *geometry = xcb_get_geometry_reply( xc,
+	  xcb_get_geometry( xc, d ), NULL);
 	if (geometry) {
 	  /* only width & height are used by the program */
 	  WindowWidth  = geometry->width;
@@ -660,31 +660,31 @@ InitScreen( char *DisplayName, char *the
 	/* TODO: grab key Alt-Q to quit gracefully? */
   }
   else {
-	XCBPIXMAP                theIconPixmap;
+	xcb_pixmap_t                theIconPixmap;
 
-	CARD32 theWindowAttributes[] = {
+	uint32_t theWindowAttributes[] = {
 		theBgPixel,    /* background */
 		theFgPixel,    /* border */
 		False,         /* override_redirect */
 		EVENT_MASK,
 		theCursor.xid };
 
-	unsigned long theWindowMask = XCBCWBackPixel | XCBCWBorderPixel |
-	  XCBCWOverrideRedirect | XCBCWEventMask | XCBCWCursor;
+	unsigned long theWindowMask = XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL |
+	  XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | XCB_CW_CURSOR;
 	
-	theWindow = XCBWINDOWNew( xc );
-	XCBCreateWindow( xc,
+	theWindow = xcb_window_new( xc );
+	xcb_create_window( xc,
 		theDepth,
 		theWindow,
 		theScreen->root,
 		WindowPointX, WindowPointY,
 		WindowWidth, WindowHeight,
 		BorderWidth,
-		XCBWindowClassInputOutput,
+		XCB_WINDOW_CLASS_INPUT_OUTPUT,
 		theScreen->root_visual, /* CopyFromParent */
 		theWindowMask, theWindowAttributes );
 
-	/* new: obey the window-delete protocol, look for XCBClientMessage */
+	/* new: obey the window-delete protocol, look for XCB_CLIENT_MESSAGE */
 	deleteWindowAtom = GetAtom(xc, "WM_DELETE_WINDOW");
 	SetWMProtocols( xc, theWindow, 1, &deleteWindowAtom );
 
@@ -719,19 +719,19 @@ InitScreen( char *DisplayName, char *the
 	SetWMName( xc, theWindow, STRING, strlen(theTitle), theTitle );
 	SetWMIconName( xc, theWindow, STRING, strlen(theTitle), theTitle );
 
-	XCBMapWindow( xc, theWindow );
+	xcb_map_window( xc, theWindow );
 
   }
   
   InitBitmapAndGCs();
 
-  XCBFlush(xc);
+  xcb_flush(xc);
 
   /* latency: ask for keysyms now, and receive them later */
-  theKeySyms = XCBKeySymbolsAlloc( xc );
+  theKeySyms = xcb_key_symbols_alloc( xc );
 
-  /* later: XCBKeySymbolsFree( keysyms ); */
-  /* later: XCBRefreshKeyboardMapping ( keysyms, mappingEvent ); */
+  /* later: xcb_key_symbols_free( keysyms ); */
+  /* later: xcb_refresh_keyboard_mapping ( keysyms, mappingEvent ); */
 }
 
 
@@ -782,26 +782,26 @@ SetNekoState( int SetValue )
      defeat this mechanism */
 
 void
-DrawNeko( int x, int y, XCBGCONTEXT DrawGC )
+DrawNeko( int x, int y, xcb_gcontext_t DrawGC )
 {
-  XCBDRAWABLE drawable;  drawable.window = theWindow;
-  XCBRECTANGLE rect = { NekoLastX, NekoLastY, BITMAP_WIDTH, BITMAP_HEIGHT };
+  xcb_drawable_t drawable;  drawable.window = theWindow;
+  xcb_rectangle_t rect = { NekoLastX, NekoLastY, BITMAP_WIDTH, BITMAP_HEIGHT };
 
   if ( (x != NekoLastX || y != NekoLastY) && (EventState != DEBUG_LIST) )
   {
-	XCBPolyFillRectangle( xc, drawable, SpaceGC, 1, &rect );
+	xcb_poly_fill_rectangle( xc, drawable, SpaceGC, 1, &rect );
 	rect.x = x; rect.y = y;
 
   }
 
-  CARD32 originMask = XCBGCTileStippleOriginX | XCBGCTileStippleOriginY;
-  CARD32 origin[2] = { x, y };
-  XCBChangeGC( xc, DrawGC, originMask, origin );
+  uint32_t originMask = XCB_GC_TILE_STIPPLE_ORIGIN_X | XCB_GC_TILE_STIPPLE_ORIGIN_Y;
+  uint32_t origin[2] = { x, y };
+  xcb_change_gc( xc, DrawGC, originMask, origin );
   /* XSetTSOrigin( theDisplay, DrawGC, x, y ); */
 
-  XCBPolyFillRectangle( xc, drawable, DrawGC, 1, &rect );
+  xcb_poly_fill_rectangle( xc, drawable, DrawGC, 1, &rect );
 
-  XCBFlush( xc );
+  xcb_flush( xc );
 
   NekoLastX = x;
   NekoLastY = y;
@@ -811,12 +811,12 @@ DrawNeko( int x, int y, XCBGCONTEXT Draw
 
 
 void  RedrawNeko(void) {
-  XCBDRAWABLE drawable;  drawable.window = theWindow;
-  XCBRECTANGLE rect = { NekoLastX, NekoLastY, BITMAP_WIDTH, BITMAP_HEIGHT };
+  xcb_drawable_t drawable;  drawable.window = theWindow;
+  xcb_rectangle_t rect = { NekoLastX, NekoLastY, BITMAP_WIDTH, BITMAP_HEIGHT };
 
-  XCBPolyFillRectangle( xc, drawable, NekoLastGC, 1, &rect );
+  xcb_poly_fill_rectangle( xc, drawable, NekoLastGC, 1, &rect );
 
-  XCBFlush( xc );
+  xcb_flush( xc );
 }
 
 
@@ -926,8 +926,8 @@ void  CalcDxDy(void) {
   
   /* TODO: replace query with pointer motion notification? */
 
-  XCBQueryPointerRep *reply = XCBQueryPointerReply( xc,
-	XCBQueryPointer( xc, theWindow ), NULL);
+  xcb_query_pointer_reply_t *reply = xcb_query_pointer_reply( xc,
+	xcb_query_pointer( xc, theWindow ), NULL);
 	
   RelativeX = reply->win_x;
   RelativeY = reply->win_y;
@@ -1108,18 +1108,18 @@ void  DisplayCharacters() {
 #endif	/* DEBUG */
 
 Bool
-ProcessKeyPress( XCBKeyPressEvent *theKeyEvent )
+ProcessKeyPress( xcb_key_press_event_t *theKeyEvent )
 {
   Bool ReturnState = True;
 
   /* quit on Meta-Q (Alt-Q) */
-  XCBKEYSYM theKeySym;
+  xcb_keysym_t theKeySym;
 
   /* last param is "int col". What? add enumeration to xcb_keysyms.h */
-  theKeySym = XCBKeyPressLookupKeysym( theKeySyms, theKeyEvent, 1 );
+  theKeySym = xcb_key_press_lookup_keysym( theKeySyms, theKeyEvent, 1 );
 
   /* KeySym XK_Q == 'Q' */
-  if (theKeySym.id == 'Q' && (theKeyEvent->state & XCBModMask1))
+  if (theKeySym.id == 'Q' && (theKeyEvent->state & XCB_MOD_MASK_1))
     ReturnState = False;
 
 #ifdef	DEBUG
@@ -1181,26 +1181,26 @@ void  NekoAdjust(void) {
 	NekoY = WindowHeight - BITMAP_HEIGHT;
 }
 
-int IsDeleteMessage(XCBClientMessageEvent *msg)
+int IsDeleteMessage(xcb_client_message_event_t *msg)
 {
 	return msg->data.data32[0] == deleteWindowAtom.xid;
 }
 
 Bool  ProcessEvent(void) {
-  XCBGenericEvent *theEvent;
-  XCBConfigureNotifyEvent *theConfigureNotification;
-  XCBExposeEvent *theExposure;
-  XCBButtonPressEvent *theButtonPress;
+  xcb_generic_event_t *theEvent;
+  xcb_configure_notify_event_t *theConfigureNotification;
+  xcb_expose_event_t *theExposure;
+  xcb_button_press_event_t *theButtonPress;
   Bool	ContinueState = True;
   int error = 0;
   
   switch ( EventState ) {
   case NORMAL_STATE:
     while ( ContinueState &&
-            NULL != (theEvent = XCBPollForEvent( xc, &error )) ) {  /*while ( XCheckMaskEvent( theDisplay, EVENT_MASK, &theEvent ) ) {*/
+            NULL != (theEvent = xcb_poll_for_event( xc, &error )) ) {  /*while ( XCheckMaskEvent( theDisplay, EVENT_MASK, &theEvent ) ) {*/
 	  switch ( theEvent->response_type & 0x7f ) {
-	  case XCBConfigureNotify:
-	    theConfigureNotification = (XCBConfigureNotifyEvent *)theEvent;
+	  case XCB_CONFIGURE_NOTIFY:
+	    theConfigureNotification = (xcb_configure_notify_event_t *)theEvent;
 		WindowWidth = theConfigureNotification->width;
 		WindowHeight = theConfigureNotification->height;
 		WindowPointX = theConfigureNotification->x;
@@ -1208,24 +1208,24 @@ Bool  ProcessEvent(void) {
 		BorderWidth = theConfigureNotification->border_width;
 		NekoAdjust();
 		break;
-	  case XCBExpose:
-	    theExposure = (XCBExposeEvent *)theEvent;
+	  case XCB_EXPOSE:
+	    theExposure = (xcb_expose_event_t *)theEvent;
 		if ( theExposure->count == 0 )
 		  RedrawNeko();
 		break;
-	  case XCBMapNotify:
+	  case XCB_MAP_NOTIFY:
 		RedrawNeko();
 		break;
-	  case XCBKeyPress:
-		ContinueState = ProcessKeyPress( (XCBKeyPressEvent *)theEvent );
+	  case XCB_KEY_PRESS:
+		ContinueState = ProcessKeyPress( (xcb_key_press_event_t *)theEvent );
 		break;
-	  case XCBButtonPress:
-	    theButtonPress = (XCBButtonPressEvent *)theEvent;
+	  case XCB_BUTTON_PRESS:
+	    theButtonPress = (xcb_button_press_event_t *)theEvent;
 		ContinueState = ( theButtonPress->detail.id != 3 );	/* xbutton.button */
 		break;
 	  /* new: handle ClientMessage */
-	  case XCBClientMessage:
-	    ContinueState = !IsDeleteMessage((XCBClientMessageEvent *)theEvent);
+	  case XCB_CLIENT_MESSAGE:
+	    ContinueState = !IsDeleteMessage((xcb_client_message_event_t *)theEvent);
 	    break;
 	  default:
 		/* Unknown Event */
@@ -1535,10 +1535,10 @@ GetArguments( int argc, char *argv[],
   return( iconicState );
 }
 
-void UndefineCursor( XCBConnection *c, XCBWINDOW w)
+void UndefineCursor( xcb_connection_t *c, xcb_window_t w)
 {
-	CARD32 none[] = { XCBNone };
-	XCBChangeWindowAttributes( c, w, XCBCWCursor, none );
+	uint32_t none[] = { XCB_NONE };
+	xcb_change_window_attributes( c, w, XCB_CW_CURSOR, none );
 }
 
 int
@@ -1575,6 +1575,6 @@ main( int argc, char *argv[] )
 #endif
 
   UndefineCursor( xc, theWindow );
-  XCBDisconnect( xc );
+  xcb_disconnect( xc );
   exit( 0 );
 }
diff --git a/xcb-demo/rendertest.c b/xcb-demo/rendertest.c
index ac8af9d..1955590 100644
--- a/xcb-demo/rendertest.c
+++ b/xcb-demo/rendertest.c
@@ -9,39 +9,39 @@
 /*
  * FUNCTION PROTOTYPES
  */
-void print_version_info(XCBRenderQueryVersionRep *reply);
-int print_formats_info(XCBRenderQueryPictFormatsRep *reply);
-int draw_window(XCBConnection *conn, XCBRenderQueryPictFormatsRep *reply);
-XCBRenderPICTFORMAT get_pictformat_from_visual(XCBRenderQueryPictFormatsRep *reply, XCBVISUALID visual);
-XCBRenderPICTFORMINFO *get_pictforminfo(XCBRenderQueryPictFormatsRep *reply, XCBRenderPICTFORMINFO *query);
+void print_version_info(xcb_render_query_version_reply_t *reply);
+int print_formats_info(xcb_render_query_pict_formats_reply_t *reply);
+int draw_window(xcb_connection_t *conn, xcb_render_query_pict_formats_reply_t *reply);
+xcb_render_pictformat_t get_pictformat_from_visual(xcb_render_query_pict_formats_reply_t *reply, xcb_visualid_t visual);
+xcb_render_pictforminfo_t *get_pictforminfo(xcb_render_query_pict_formats_reply_t *reply, xcb_render_pictforminfo_t *query);
 
-XCBConnection   *c;
-XCBRenderPICTFORMAT pf;
+xcb_connection_t   *c;
+xcb_render_pictformat_t pf;
 
-XCBRenderFIXED make_fixed(INT16 i, INT16 f)
+xcb_render_fixed_t make_fixed(int16_t i, int16_t f)
 {
     return (i << 16) | (f & 0xffff);
 }
 
-void print_version_info(XCBRenderQueryVersionRep *reply)
+void print_version_info(xcb_render_query_version_reply_t *reply)
 {
     
     fprintf(stdout, "Render Version: %d.%d\n", reply->major_version, 
             reply->minor_version);
 }
 
-int print_formats_info(XCBRenderQueryPictFormatsRep *reply)
+int print_formats_info(xcb_render_query_pict_formats_reply_t *reply)
 {
-    XCBRenderPICTFORMINFO *first_forminfo;
+    xcb_render_pictforminfo_t *first_forminfo;
     int num_formats;
     int num_screens;
     int num_depths;
     int num_visuals;
-    XCBRenderPICTFORMINFOIter forminfo_iter;
-    XCBRenderPICTSCREENIter     screen_iter;
+    xcb_render_pictforminfo_iterator_t forminfo_iter;
+    xcb_render_pictscreen_iterator_t     screen_iter;
     
-    forminfo_iter = XCBRenderQueryPictFormatsFormatsIter(reply);
-    screen_iter =  XCBRenderQueryPictFormatsScreensIter(reply);
+    forminfo_iter = xcb_render_query_pict_formats_formats_iterator(reply);
+    screen_iter =  xcb_render_query_pict_formats_screens_iterator(reply);
 
     fprintf(stdout, "Number of PictFormInfo iterations: %d\n", forminfo_iter.rem);
 
@@ -50,7 +50,7 @@ int print_formats_info(XCBRenderQueryPic
     pf = first_forminfo->id;
     while(forminfo_iter.rem)
     {
-        XCBRenderPICTFORMINFO *forminfo = (XCBRenderPICTFORMINFO *)forminfo_iter.data;
+        xcb_render_pictforminfo_t *forminfo = (xcb_render_pictforminfo_t *)forminfo_iter.data;
 
         fprintf(stdout, "PICTFORMINFO #%d\n", 1 + num_formats - forminfo_iter.rem);
         fprintf(stdout, "    PICTFORMAT ID:          %d\n", forminfo->id.xid);
@@ -65,83 +65,83 @@ int print_formats_info(XCBRenderQueryPic
         fprintf(stdout, "        Direct AlphaShift:  %d\n", forminfo->direct.alpha_shift);
         fprintf(stdout, "        Direct AlphaMask:   %d\n", forminfo->direct.alpha_mask);
         fprintf(stdout, "\n");
-        XCBRenderPICTFORMINFONext(&forminfo_iter);
+        xcb_render_pictforminfo_next(&forminfo_iter);
     }
 
     num_screens = reply->num_screens;
     while(screen_iter.rem)
     {
-        XCBRenderPICTDEPTHIter depth_iter;
-        XCBRenderPICTSCREEN *cscreen = screen_iter.data;
+        xcb_render_pictdepth_iterator_t depth_iter;
+        xcb_render_pictscreen_t *cscreen = screen_iter.data;
         
         fprintf(stdout, "Screen #%d\n", 1 + num_screens - screen_iter.rem);
         fprintf(stdout, "    Depths for this screen:    %d\n", cscreen->num_depths);
         fprintf(stdout, "    Fallback PICTFORMAT:       %d\n", cscreen->fallback.xid);
-        depth_iter = XCBRenderPICTSCREENDepthsIter(cscreen);
+        depth_iter = xcb_render_pictscreen_depths_iterator(cscreen);
 
         num_depths = cscreen->num_depths;
         while(depth_iter.rem)
         {
-            XCBRenderPICTVISUALIter    visual_iter;
-            XCBRenderPICTDEPTH *cdepth = depth_iter.data;
+            xcb_render_pictvisual_iterator_t    visual_iter;
+            xcb_render_pictdepth_t *cdepth = depth_iter.data;
 
             fprintf(stdout, "    Depth #%d\n", 1 + num_depths - depth_iter.rem);
             fprintf(stdout, "        Visuals for this depth:    %d\n", cdepth->num_visuals);
             fprintf(stdout, "        Depth:                     %d\n", cdepth->depth);
-            visual_iter = XCBRenderPICTDEPTHVisualsIter(cdepth);
+            visual_iter = xcb_render_pictdepth_visuals_iterator(cdepth);
 
             num_visuals = cdepth->num_visuals;
             while(visual_iter.rem)
             {
-                XCBRenderPICTVISUAL *cvisual = visual_iter.data;
+                xcb_render_pictvisual_t *cvisual = visual_iter.data;
                 
                 fprintf(stdout, "        Visual #%d\n", 1 + num_visuals - visual_iter.rem);
                 fprintf(stdout, "            VISUALID:      %d\n", cvisual->visual.id);
                 fprintf(stdout, "            PICTFORMAT:    %d\n", cvisual->format.xid);
-                XCBRenderPICTVISUALNext(&visual_iter);
+                xcb_render_pictvisual_next(&visual_iter);
             }
-            XCBRenderPICTDEPTHNext(&depth_iter);
+            xcb_render_pictdepth_next(&depth_iter);
         }
-        XCBRenderPICTSCREENNext(&screen_iter);
+        xcb_render_pictscreen_next(&screen_iter);
     }
     return 0;
 }
 
-int draw_window(XCBConnection *conn, XCBRenderQueryPictFormatsRep *reply)
+int draw_window(xcb_connection_t *conn, xcb_render_query_pict_formats_reply_t *reply)
 {
-    XCBWINDOW          window;
-    XCBDRAWABLE        window_drawable, tmp, root_drawable;
-    XCBPIXMAP          surfaces[4], alpha_surface;
-    XCBRenderPICTFORMAT      alpha_mask_format, window_format, surface_format, no_format = {0};
-    XCBRenderPICTURE         window_pict, pict_surfaces[4], alpha_pict, 
+    xcb_window_t          window;
+    xcb_drawable_t        window_drawable, tmp, root_drawable;
+    xcb_pixmap_t          surfaces[4], alpha_surface;
+    xcb_render_pictformat_t      alpha_mask_format, window_format, surface_format, no_format = {0};
+    xcb_render_picture_t         window_pict, pict_surfaces[4], alpha_pict, 
                         no_picture = {0}, root_picture;
-    XCBRenderPICTFORMINFO    *forminfo_ptr, *alpha_forminfo_ptr, query;
-    CARD32          value_mask, value_list[4];
-    XCBRECTANGLE       pict_rect[1], window_rect;
-    XCBRenderCOLOR           pict_color[4], back_color, alpha_color;
-    XCBSCREEN          *root;
-    XCBRenderTRAPEZOID       traps[4];
-    XCBRenderTRIANGLE        triangles[4];
-    XCBRenderPOINTFIX        tristrips[9];
-    XCBRenderPOINTFIX        trifans[9];
+    xcb_render_pictforminfo_t    *forminfo_ptr, *alpha_forminfo_ptr, query;
+    uint32_t          value_mask, value_list[4];
+    xcb_rectangle_t       pict_rect[1], window_rect;
+    xcb_render_color_t           pict_color[4], back_color, alpha_color;
+    xcb_screen_t          *root;
+    xcb_render_trapezoid_t       traps[4];
+    xcb_render_triangle_t        triangles[4];
+    xcb_render_pointfix_t        tristrips[9];
+    xcb_render_pointfix_t        trifans[9];
     int index;
 
-    root = XCBSetupRootsIter(XCBGetSetup(c)).data;
+    root = xcb_setup_roots_iterator(xcb_get_setup(c)).data;
     root_drawable.window = root->root;
    
     /* Setting query so that it will search for an 8 bit alpha surface. */
     query.id.xid = 0;
-    query.type = XCBRenderPictTypeDirect;
+    query.type = XCB_RENDER_PICT_TYPE_DIRECT;
     query.depth = 8;
     query.direct.red_mask = 0;
     query.direct.green_mask = 0;
     query.direct.blue_mask = 0;
     query.direct.alpha_mask = 255;
 
-    /* Get the XCBRenderPICTFORMAT associated with the window. */
+    /* Get the xcb_render_pictformat_t associated with the window. */
     window_format = get_pictformat_from_visual(reply, root->root_visual);
 
-    /* Get the XCBRenderPICTFORMAT we will use for the alpha mask */
+    /* Get the xcb_render_pictformat_t we will use for the alpha mask */
     alpha_forminfo_ptr = get_pictforminfo(reply, &query);
     alpha_mask_format.xid = alpha_forminfo_ptr->id.xid;
     
@@ -149,45 +149,45 @@ int draw_window(XCBConnection *conn, XCB
     query.depth = 32;
     query.direct.alpha_mask = 0;
   
-    /* Get the surface forminfo and XCBRenderPICTFORMAT */
+    /* Get the surface forminfo and xcb_render_pictformat_t */
     forminfo_ptr = get_pictforminfo(reply, &query);
     surface_format.xid = forminfo_ptr->id.xid;
     
     /* assign XIDs to all of the drawables and pictures */
     for(index = 0; index < 4; index++)
     {
-        surfaces[index] = XCBPIXMAPNew(conn);
-        pict_surfaces[index] = XCBRenderPICTURENew(conn);
+        surfaces[index] = xcb_pixmap_new(conn);
+        pict_surfaces[index] = xcb_render_picture_new(conn);
     }
-    alpha_surface = XCBPIXMAPNew(conn);
-    alpha_pict = XCBRenderPICTURENew(conn);
-    window = XCBWINDOWNew(conn);
-    window_pict = XCBRenderPICTURENew(conn);
+    alpha_surface = xcb_pixmap_new(conn);
+    alpha_pict = xcb_render_picture_new(conn);
+    window = xcb_window_new(conn);
+    window_pict = xcb_render_picture_new(conn);
     window_drawable.window = window;
-    root_picture = XCBRenderPICTURENew(conn);
+    root_picture = xcb_render_picture_new(conn);
     
     /* Here we will create the pixmaps that we will use */
     for(index = 0; index < 4; index++)
     {
-        surfaces[index] = XCBPIXMAPNew(conn);
-        XCBCreatePixmap(conn, 32, surfaces[index], root_drawable, 600, 600);
+        surfaces[index] = xcb_pixmap_new(conn);
+        xcb_create_pixmap(conn, 32, surfaces[index], root_drawable, 600, 600);
     }
-    alpha_surface = XCBPIXMAPNew(conn);
-    XCBCreatePixmap(conn, 8, alpha_surface, root_drawable, 600, 600);
+    alpha_surface = xcb_pixmap_new(conn);
+    xcb_create_pixmap(conn, 8, alpha_surface, root_drawable, 600, 600);
     
     /* initialize the value list */
-    value_mask = XCBCWEventMask;
-    value_list[0] = XCBExpose;
+    value_mask = XCB_CW_EVENT_MASK;
+    value_list[0] = XCB_EXPOSE;
     
     /* Create the window */
-    XCBCreateWindow(conn, /* XCBConnection */
+    xcb_create_window(conn, /* xcb_connection_t */
             0,  /* depth, 0 means it will copy it from the parent */
             window, root_drawable.window, /* window and parent */
             0, 0,   /* x and y */
             600, 600,   /* width and height */
             0,  /* border width */
-            XCBWindowClassInputOutput,    /* class */
-            root->root_visual,   /* XCBVISUALID */
+            XCB_WINDOW_CLASS_INPUT_OUTPUT,    /* class */
+            root->root_visual,   /* xcb_visualid_t */
             value_mask, value_list); /* LISTofVALUES */
     
     /* 
@@ -196,17 +196,17 @@ int draw_window(XCBConnection *conn, XCB
     value_mask = 1<<0; /* repeat (still needs to be added to xcb_render.m4) */
     value_list[0] = 1;
 
-    XCBRenderCreatePicture(conn, root_picture, root_drawable, window_format,
+    xcb_render_create_picture(conn, root_picture, root_drawable, window_format,
             value_mask, value_list);
-    XCBRenderCreatePicture(conn, window_pict, window_drawable, window_format,
+    xcb_render_create_picture(conn, window_pict, window_drawable, window_format,
             value_mask, value_list);
     tmp.pixmap = alpha_surface;
-    XCBRenderCreatePicture(conn, alpha_pict, tmp, alpha_mask_format,
+    xcb_render_create_picture(conn, alpha_pict, tmp, alpha_mask_format,
             value_mask, value_list);
     for(index = 0; index < 4; index++)
     {
         tmp.pixmap = surfaces[index];
-        XCBRenderCreatePicture(conn, pict_surfaces[index], tmp, surface_format,
+        xcb_render_create_picture(conn, pict_surfaces[index], tmp, surface_format,
                 value_mask, value_list);
     }
 
@@ -317,122 +317,122 @@ int draw_window(XCBConnection *conn, XCB
     /* 
      * Map the window
      */
-    XCBMapWindow(conn, window);
+    xcb_map_window(conn, window);
     
     /*
      * Play around with Render
      */
 
-    XCBRenderFillRectangles(conn, XCBRenderPictOpSrc, alpha_pict, alpha_color, 1, pict_rect);
-    XCBRenderFillRectangles(conn, XCBRenderPictOpSrc, pict_surfaces[0], pict_color[0], 1, pict_rect);
-    XCBRenderFillRectangles(conn, XCBRenderPictOpSrc, pict_surfaces[1], pict_color[1], 1, pict_rect);
-    XCBRenderFillRectangles(conn, XCBRenderPictOpSrc, pict_surfaces[2], pict_color[2], 1, pict_rect);
-    XCBRenderFillRectangles(conn, XCBRenderPictOpSrc, pict_surfaces[3], pict_color[3], 1, pict_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, alpha_pict, alpha_color, 1, pict_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, pict_surfaces[0], pict_color[0], 1, pict_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, pict_surfaces[1], pict_color[1], 1, pict_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, pict_surfaces[2], pict_color[2], 1, pict_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_SRC, pict_surfaces[3], pict_color[3], 1, pict_rect);
 
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
 
-    XCBRenderFillRectangles(conn, XCBRenderPictOpOver, window_pict, back_color, 1, &window_rect);
+    xcb_render_fill_rectangles(conn, XCB_RENDER_PICT_OP_OVER, window_pict, back_color, 1, &window_rect);
 
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
 
 
     /* Composite the first pict_surface onto the window picture */
-    XCBRenderComposite(conn, XCBRenderPictOpOver, pict_surfaces[0], no_picture /* alpha_pict */, window_pict,
+    xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[0], no_picture /* alpha_pict */, window_pict,
             0, 0, 0, 0, 200, 200,
             400, 400);
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
 /*
-    XCBRenderComposite(conn, XCBRenderPictOpOver, pict_surfaces[0], alpha_pict, window_pict,
+    xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[0], alpha_pict, window_pict,
             0, 0, 0, 0, 0, 0,
             200, 200);
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
 */
-    XCBRenderComposite(conn, XCBRenderPictOpOver, pict_surfaces[1], no_picture /* alpha_pict */, window_pict,
+    xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[1], no_picture /* alpha_pict */, window_pict,
             0, 0, 0, 0, 0, 0,
             400, 400);
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
     
-    XCBRenderComposite(conn, XCBRenderPictOpOver, pict_surfaces[2], no_picture /* alpha_pict */, window_pict,
+    xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[2], no_picture /* alpha_pict */, window_pict,
             0, 0, 0, 0, 200, 0,
             400, 400);
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
     
-    XCBRenderComposite(conn, XCBRenderPictOpOver, pict_surfaces[3],  no_picture /* alpha_pict */, window_pict,
+    xcb_render_composite(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[3],  no_picture /* alpha_pict */, window_pict,
             0, 0, 0, 0, 0, 200,
             400, 400);
-    XCBFlush(conn);
+    xcb_flush(conn);
     sleep(1);
 
-    XCBRenderTrapezoids(conn, XCBRenderPictOpOver, pict_surfaces[0], window_pict, alpha_mask_format, 0, 0, 1, &traps[0]);
-    XCBFlush(conn);
+    xcb_render_trapezoids(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[0], window_pict, alpha_mask_format, 0, 0, 1, &traps[0]);
+    xcb_flush(conn);
     sleep(1);
 
-    XCBRenderTriangles(conn, XCBRenderPictOpOver, pict_surfaces[1], window_pict, no_format, 0, 0, 1, &triangles[0]);
-    XCBFlush(conn);
+    xcb_render_triangles(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[1], window_pict, no_format, 0, 0, 1, &triangles[0]);
+    xcb_flush(conn);
     sleep(1);
     
-    XCBRenderTriStrip(conn, XCBRenderPictOpOver, pict_surfaces[2], window_pict, no_format, 0, 0, 9, &tristrips[0]);
-    XCBFlush(conn);
+    xcb_render_tri_strip(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[2], window_pict, no_format, 0, 0, 9, &tristrips[0]);
+    xcb_flush(conn);
     sleep(1);
     
-    XCBRenderTriFan(conn, XCBRenderPictOpOver, pict_surfaces[3], window_pict, no_format, 0, 0, 8, &trifans[0]);
-    XCBFlush(conn);
+    xcb_render_tri_fan(conn, XCB_RENDER_PICT_OP_OVER, pict_surfaces[3], window_pict, no_format, 0, 0, 8, &trifans[0]);
+    xcb_flush(conn);
     sleep(2);
     
     
     /* Free up all of the resources we used */
     for(index = 0; index < 4; index++)
     {
-        XCBFreePixmap(conn, surfaces[index]);
-        XCBRenderFreePicture(conn, pict_surfaces[index]);
+        xcb_free_pixmap(conn, surfaces[index]);
+        xcb_render_free_picture(conn, pict_surfaces[index]);
     }
-    XCBFreePixmap(conn, alpha_surface);
-    XCBRenderFreePicture(conn, alpha_pict);
-    XCBRenderFreePicture(conn, window_pict);
-    XCBRenderFreePicture(conn, root_picture);
+    xcb_free_pixmap(conn, alpha_surface);
+    xcb_render_free_picture(conn, alpha_pict);
+    xcb_render_free_picture(conn, window_pict);
+    xcb_render_free_picture(conn, root_picture);
    
     /* sync up and leave the function */
-    XCBFlush(conn);
+    xcb_flush(conn);
     return 0;
 }
 
 
 /**********************************************************
  * This function searches through the reply for a 
- * PictVisual who's XCBVISUALID is the same as the one
+ * PictVisual who's xcb_visualid_t is the same as the one
  * specified in query. The function will then return the
- * XCBRenderPICTFORMAT from that PictVIsual structure. 
- * This is useful for getting the XCBRenderPICTFORMAT that is
+ * xcb_render_pictformat_t from that PictVIsual structure. 
+ * This is useful for getting the xcb_render_pictformat_t that is
  * the same visual type as the root window.
  **********************************************************/
-XCBRenderPICTFORMAT get_pictformat_from_visual(XCBRenderQueryPictFormatsRep *reply, XCBVISUALID query)
+xcb_render_pictformat_t get_pictformat_from_visual(xcb_render_query_pict_formats_reply_t *reply, xcb_visualid_t query)
 {
-    XCBRenderPICTSCREENIter screen_iter;
-    XCBRenderPICTSCREEN    *cscreen;
-    XCBRenderPICTDEPTHIter  depth_iter;
-    XCBRenderPICTDEPTH     *cdepth;
-    XCBRenderPICTVISUALIter visual_iter; 
-    XCBRenderPICTVISUAL    *cvisual;
-    XCBRenderPICTFORMAT  return_value;
+    xcb_render_pictscreen_iterator_t screen_iter;
+    xcb_render_pictscreen_t    *cscreen;
+    xcb_render_pictdepth_iterator_t  depth_iter;
+    xcb_render_pictdepth_t     *cdepth;
+    xcb_render_pictvisual_iterator_t visual_iter; 
+    xcb_render_pictvisual_t    *cvisual;
+    xcb_render_pictformat_t  return_value;
     
-    screen_iter = XCBRenderQueryPictFormatsScreensIter(reply);
+    screen_iter = xcb_render_query_pict_formats_screens_iterator(reply);
 
     while(screen_iter.rem)
     {
         cscreen = screen_iter.data;
         
-        depth_iter = XCBRenderPICTSCREENDepthsIter(cscreen);
+        depth_iter = xcb_render_pictscreen_depths_iterator(cscreen);
         while(depth_iter.rem)
         {
             cdepth = depth_iter.data;
 
-            visual_iter = XCBRenderPICTDEPTHVisualsIter(cdepth);
+            visual_iter = xcb_render_pictdepth_visuals_iterator(cdepth);
             while(visual_iter.rem)
             {
                 cvisual = visual_iter.data;
@@ -441,27 +441,27 @@ XCBRenderPICTFORMAT get_pictformat_from_
                 {
                     return cvisual->format;
                 }
-                XCBRenderPICTVISUALNext(&visual_iter);
+                xcb_render_pictvisual_next(&visual_iter);
             }
-            XCBRenderPICTDEPTHNext(&depth_iter);
+            xcb_render_pictdepth_next(&depth_iter);
         }
-        XCBRenderPICTSCREENNext(&screen_iter);
+        xcb_render_pictscreen_next(&screen_iter);
     }
     return_value.xid = 0;
     return return_value;
 }
 
-XCBRenderPICTFORMINFO *get_pictforminfo(XCBRenderQueryPictFormatsRep *reply, XCBRenderPICTFORMINFO *query)
+xcb_render_pictforminfo_t *get_pictforminfo(xcb_render_query_pict_formats_reply_t *reply, xcb_render_pictforminfo_t *query)
 {
-    XCBRenderPICTFORMINFOIter forminfo_iter;
+    xcb_render_pictforminfo_iterator_t forminfo_iter;
     
-    forminfo_iter = XCBRenderQueryPictFormatsFormatsIter(reply);
+    forminfo_iter = xcb_render_query_pict_formats_formats_iterator(reply);
 
     while(forminfo_iter.rem)
     {
-        XCBRenderPICTFORMINFO *cformat;
+        xcb_render_pictforminfo_t *cformat;
         cformat  = forminfo_iter.data;
-        XCBRenderPICTFORMINFONext(&forminfo_iter);
+        xcb_render_pictforminfo_next(&forminfo_iter);
 
         if( (query->id.xid != 0) && (query->id.xid != cformat->id.xid) )
         {
@@ -508,33 +508,33 @@ XCBRenderPICTFORMINFO *get_pictforminfo(
 
 int main(int argc, char *argv[])
 {
-    XCBRenderQueryVersionCookie version_cookie;
-    XCBRenderQueryVersionRep    *version_reply;
-    XCBRenderQueryPictFormatsCookie formats_cookie;
-    XCBRenderQueryPictFormatsRep *formats_reply;
-    XCBRenderPICTFORMAT  rootformat;
-    XCBSCREEN *root;
+    xcb_render_query_version_cookie_t version_cookie;
+    xcb_render_query_version_reply_t    *version_reply;
+    xcb_render_query_pict_formats_cookie_t formats_cookie;
+    xcb_render_query_pict_formats_reply_t *formats_reply;
+    xcb_render_pictformat_t  rootformat;
+    xcb_screen_t *root;
     int screen_num;
     
-    XCBRenderPICTFORMINFO  forminfo_query, *forminfo_result;
+    xcb_render_pictforminfo_t  forminfo_query, *forminfo_result;
     
-    c = XCBConnect(0, &screen_num);
-    root = XCBAuxGetScreen(c, screen_num);
+    c = xcb_connect(0, &screen_num);
+    root = xcb_aux_get_screen(c, screen_num);
     
-    version_cookie = XCBRenderQueryVersion(c, (CARD32)0, (CARD32)3);
-    version_reply = XCBRenderQueryVersionReply(c, version_cookie, 0);
+    version_cookie = xcb_render_query_version(c, (uint32_t)0, (uint32_t)3);
+    version_reply = xcb_render_query_version_reply(c, version_cookie, 0);
 
     print_version_info(version_reply);
     
-    formats_cookie = XCBRenderQueryPictFormats(c);
-    formats_reply = XCBRenderQueryPictFormatsReply(c, formats_cookie, 0);
+    formats_cookie = xcb_render_query_pict_formats(c);
+    formats_reply = xcb_render_query_pict_formats_reply(c, formats_cookie, 0);
 
     draw_window(c, formats_reply);
     
     print_formats_info(formats_reply);
    
     forminfo_query.id.xid = 0;
-    forminfo_query.type = XCBRenderPictTypeDirect;
+    forminfo_query.type = XCB_RENDER_PICT_TYPE_DIRECT;
     forminfo_query.depth = 8;
     forminfo_query.direct.red_mask = 0;
     forminfo_query.direct.green_mask = 0;
@@ -555,7 +555,7 @@ int main(int argc, char *argv[])
     free(version_reply);
     free(formats_reply);
 
-    XCBDisconnect(c);
+    xcb_disconnect(c);
 
     exit(0);
 }
diff --git a/xcb-demo/reply_formats.c b/xcb-demo/reply_formats.c
index bb25108..c7300cd 100644
--- a/xcb-demo/reply_formats.c
+++ b/xcb-demo/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,10 +296,10 @@ 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;
 
     if(!e)
     {
@@ -309,15 +309,15 @@ int formatEvent(XCBGenericEvent *e)
 
     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",
@@ -325,7 +325,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-demo/reply_formats.h b/xcb-demo/reply_formats.h
index 431eca1..612d83c 100644
--- a/xcb-demo/reply_formats.h
+++ b/xcb-demo/reply_formats.h
@@ -9,9 +9,9 @@
 
 #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);
 
 #endif /* REPLY_FORMATS_H */
diff --git a/xcb-demo/tests/flames.c b/xcb-demo/tests/flames.c
index 66764e0..810dee5 100644
--- a/xcb-demo/tests/flames.c
+++ b/xcb-demo/tests/flames.c
@@ -49,12 +49,12 @@ typedef struct
 {
   struct
   {
-    XCBConnection *c;
-    XCBDRAWABLE    draw;
-    XCBDRAWABLE    pixmap;
-    XCBCOLORMAP    cmap;
-    CARD8          depth;
-    XCBGCONTEXT    gc;
+    xcb_connection_t *c;
+    xcb_drawable_t    draw;
+    xcb_drawable_t    pixmap;
+    xcb_colormap_t    cmap;
+    uint8_t          depth;
+    xcb_gcontext_t    gc;
   }xcb;
   
   /* the palette */
@@ -82,68 +82,68 @@ flame *
 flame_init ()
 {
   flame       *f;
-  XCBSCREEN   *screen;
-  XCBGCONTEXT  gc = { 0 };
+  xcb_screen_t   *screen;
+  xcb_gcontext_t  gc = { 0 };
   int          screen_nbr;
-  CARD32       mask;
-  CARD32       values[2];
+  uint32_t       mask;
+  uint32_t       values[2];
   int          size;
   int          flame_width;
   int          flame_height;
-  XCBRECTANGLE rect_coord = { 0, 0, BG_W, BG_H};
+  xcb_rectangle_t rect_coord = { 0, 0, BG_W, BG_H};
 
   f = (flame *)malloc (sizeof (flame));
   if (!f)
     return NULL;
 
-  f->xcb.c = XCBConnect (NULL, &screen_nbr);
+  f->xcb.c = xcb_connect (NULL, &screen_nbr);
   if (!f->xcb.c)
     {
       free (f);
       return NULL;
     }
-  screen = XCBAuxGetScreen (f->xcb.c, screen_nbr);
+  screen = xcb_aux_get_screen (f->xcb.c, screen_nbr);
 
   f->xcb.draw.window = screen->root;
-  f->xcb.gc = XCBGCONTEXTNew (f->xcb.c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  f->xcb.gc = xcb_gcontext_new (f->xcb.c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   values[0] = screen->black_pixel;
   values[1] = 0; /* no graphics exposures */
-  XCBCreateGC (f->xcb.c, f->xcb.gc, f->xcb.draw, mask, values);
+  xcb_create_gc (f->xcb.c, f->xcb.gc, f->xcb.draw, mask, values);
 
-  gc = XCBGCONTEXTNew (f->xcb.c);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  gc = xcb_gcontext_new (f->xcb.c);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   values[0] = screen->white_pixel;
   values[1] = 0; /* no graphics exposures */
-  XCBCreateGC (f->xcb.c, gc, f->xcb.draw, mask, values);
+  xcb_create_gc (f->xcb.c, gc, f->xcb.draw, mask, values);
 
-  f->xcb.depth = XCBAuxGetDepth (f->xcb.c, screen);
-  mask = XCBCWBackPixel | XCBCWEventMask;
+  f->xcb.depth = xcb_aux_get_depth (f->xcb.c, screen);
+  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK;
   values[0] = screen->white_pixel;
-  values[1] = XCBEventMaskExposure | XCBEventMaskButtonPress;
-  f->xcb.draw.window = XCBWINDOWNew (f->xcb.c);
-  XCBCreateWindow (f->xcb.c, f->xcb.depth,
+  values[1] = XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_BUTTON_PRESS;
+  f->xcb.draw.window = xcb_window_new (f->xcb.c);
+  xcb_create_window (f->xcb.c, f->xcb.depth,
 		   f->xcb.draw.window,
 		   screen->root,
 		   0, 0, BG_W, BG_H,
 		   0,
-		   XCBWindowClassInputOutput,
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,
 		   screen->root_visual,
 		   mask, values);
   title_set (f, "XCB Flames");
   
-  f->xcb.pixmap.pixmap = XCBPIXMAPNew (f->xcb.c);
-  XCBCreatePixmap (f->xcb.c, f->xcb.depth,
+  f->xcb.pixmap.pixmap = xcb_pixmap_new (f->xcb.c);
+  xcb_create_pixmap (f->xcb.c, f->xcb.depth,
 		   f->xcb.pixmap.pixmap, f->xcb.draw,
 		   BG_W, BG_H);
-  XCBPolyFillRectangle(f->xcb.c, f->xcb.pixmap, gc, 1, &rect_coord);
+  xcb_poly_fill_rectangle(f->xcb.c, f->xcb.pixmap, gc, 1, &rect_coord);
 
-  XCBMapWindow (f->xcb.c, f->xcb.draw.window);
-  XCBFlush (f->xcb.c);
+  xcb_map_window (f->xcb.c, f->xcb.draw.window);
+  xcb_flush (f->xcb.c);
 
-  f->xcb.cmap = XCBCOLORMAPNew (f->xcb.c);
-  XCBCreateColormap (f->xcb.c,
-		     XCBColormapAllocNone,
+  f->xcb.cmap = xcb_colormap_new (f->xcb.c);
+  xcb_create_colormap (f->xcb.c,
+		     XCB_COLORMAP_ALLOC_NONE,
 		     f->xcb.cmap,
 		     f->xcb.draw.window,
 		     screen->root_visual);
@@ -156,7 +156,7 @@ flame_init ()
   f->flame = (unsigned int *)malloc (size);
   if (! f->flame)
     {
-      XCBDisconnect (f->xcb.c);
+      xcb_disconnect (f->xcb.c);
       free (f);
       return NULL;
     }
@@ -164,7 +164,7 @@ flame_init ()
   if (! f->flame2)
     {
       free (f->flame);
-      XCBDisconnect (f->xcb.c);
+      xcb_disconnect (f->xcb.c);
       free (f);
       return NULL;
     }
@@ -186,7 +186,7 @@ flame_shutdown (flame *f)
 
   free (f->flame2);
   free (f->flame);
-  XCBDisconnect (f->xcb.c);
+  xcb_disconnect (f->xcb.c);
   free (f);
 }
 
@@ -194,8 +194,8 @@ int
 main ()
 {
   flame *f;
-  XCBGenericEvent *e;
-  XCBGCONTEXT gc = { 0 };
+  xcb_generic_event_t *e;
+  xcb_gcontext_t gc = { 0 };
 
   f = flame_init ();
   if (!f)
@@ -209,16 +209,16 @@ main ()
 
   while (1)
     {
-      if ((e = XCBPollForEvent (f->xcb.c, NULL)))
+      if ((e = xcb_poll_for_event (f->xcb.c, NULL)))
 	{
 	  switch (e->response_type)
 	    {
-	    case XCBExpose:
-	      XCBCopyArea(f->xcb.c, f->xcb.pixmap, f->xcb.draw, gc,
+	    case XCB_EXPOSE:
+	      xcb_copy_area(f->xcb.c, f->xcb.pixmap, f->xcb.draw, gc,
 		          0, 0, 0, 0, BG_W, BG_H);
-	      XCBFlush (f->xcb.c);
+	      xcb_flush (f->xcb.c);
 	      break;
-            case XCBButtonPress:
+            case XCB_BUTTON_PRESS:
               printf ("Exiting...\n");
               free (e);
               goto sortie;
@@ -226,7 +226,7 @@ main ()
 	  free (e);
         }
       flame_draw_flame (f);
-      XCBFlush (f->xcb.c);
+      xcb_flush (f->xcb.c);
     }
 
  sortie:
@@ -237,14 +237,14 @@ main ()
 
 static void title_set (flame *f, const char *title)
 {
-  XCBInternAtomRep *rep;
-  XCBATOM           encoding;
+  xcb_intern_atom_reply_t *rep;
+  xcb_atom_t           encoding;
   char             *atom_name;
 
   /* encoding */
   atom_name = "UTF8_STRING";
-  rep = XCBInternAtomReply (f->xcb.c,
-                            XCBInternAtom (f->xcb.c,
+  rep = xcb_intern_atom_reply (f->xcb.c,
+                            xcb_intern_atom (f->xcb.c,
                                            0,
                                            strlen (atom_name),
                                            atom_name),
@@ -257,13 +257,13 @@ static void title_set (flame *f, const c
 
   /* NETWM */
   atom_name = "_NET_WM_NAME";
-  rep = XCBInternAtomReply (f->xcb.c,
-                            XCBInternAtom (f->xcb.c,
+  rep = xcb_intern_atom_reply (f->xcb.c,
+                            xcb_intern_atom (f->xcb.c,
                                            0,
                                            strlen (atom_name),
                                            atom_name),
                             NULL);
-  XCBChangeProperty(f->xcb.c, XCBPropModeReplace,
+  xcb_change_property(f->xcb.c, XCB_PROP_MODE_REPLACE,
                     f->xcb.draw.window,
                     rep->atom, encoding, 8, strlen (title), title);
   free (rep);
@@ -272,7 +272,7 @@ static void title_set (flame *f, const c
 static void
 flame_draw_flame (flame *f)
 {
-  XCBImage     *image;
+  xcb_image_t     *image;
   unsigned int *ptr;
   int           x;
   int           y;
@@ -289,9 +289,9 @@ flame_draw_flame (flame *f)
   /* process the flame array, propagating the flames up the array */
   flame_process_flame (f);
 
-  image = XCBImageGet (f->xcb.c, f->xcb.draw,
+  image = xcb_image_get (f->xcb.c, f->xcb.draw,
 		       0, 0, BG_W, BG_H,
-		       XCBAllPlanes, XCBImageFormatZPixmap);
+		       XCB_ALL_PLANES, XCB_IMAGE_FORMAT_Z_PIXMAP);
   f->im = (unsigned int *)image->data;
 
   for (y = 0 ; y < ((BG_H >> 1) - 1) ; y++)
@@ -311,31 +311,31 @@ flame_draw_flame (flame *f)
 	  cl4 = (int)*ptr;
 
           
-          XCBImagePutPixel (image,
+          xcb_image_put_pixel (image,
                             xx, yy,
                             f->pal[cl]);
-          XCBImagePutPixel (image,
+          xcb_image_put_pixel (image,
                             xx + 1, yy,
                             f->pal[((cl1+cl2) >> 1)]);
-          XCBImagePutPixel (image,
+          xcb_image_put_pixel (image,
                             xx, yy + 1,
                             f->pal[((cl1 + cl3) >> 1)]);
-          XCBImagePutPixel (image,
+          xcb_image_put_pixel (image,
                             xx + 1, yy + 1,
                             f->pal[((cl1 + cl4) >> 1)]);
 	}
     }
-  XCBImagePut (f->xcb.c, f->xcb.draw, f->xcb.gc, image,
+  xcb_image_put (f->xcb.c, f->xcb.draw, f->xcb.gc, image,
 	       0, 0, 0, 0, BG_W, BG_H);
-  XCBImageDestroy (image);
+  xcb_image_destroy (image);
 }
 
 /* set the flame palette */
 static void
 flame_set_palette (flame *f)
 {
-  XCBAllocColorCookie cookies[IMAX];
-  XCBAllocColorRep *rep;
+  xcb_alloc_color_cookie_t cookies[IMAX];
+  xcb_alloc_color_reply_t *rep;
   int               i;
   int               r;
   int               g;
@@ -354,13 +354,13 @@ flame_set_palette (flame *f)
       if (b < 0)   b = 0;
       if (b > 255) b = 255;
 
-      cookies[i] = XCBAllocColor (f->xcb.c, f->xcb.cmap,
+      cookies[i] = xcb_alloc_color (f->xcb.c, f->xcb.cmap,
                                   r << 8, g << 8, b << 8);
     }
 
   for (i = 0 ; i < IMAX ; i++)
     {
-      rep = XCBAllocColorReply (f->xcb.c, cookies[i], NULL);
+      rep = xcb_alloc_color_reply (f->xcb.c, cookies[i], NULL);
       f->pal[i] = rep->pixel;
       free (rep);
     }
diff --git a/xcb-demo/tests/julia.c b/xcb-demo/tests/julia.c
index b22cd5d..089267f 100644
--- a/xcb-demo/tests/julia.c
+++ b/xcb-demo/tests/julia.c
@@ -41,28 +41,28 @@ int cmax = 316;
 void
 palette_julia (Data *datap)
 {
-  XCBAllocColorRep *rep;
+  xcb_alloc_color_reply_t *rep;
   int               i;
 
-  datap->palette = (CARD32 *)malloc (sizeof (CARD32) * cmax);
+  datap->palette = (uint32_t *)malloc (sizeof (uint32_t) * cmax);
   
   for (i = 0 ; i < cmax ; i++)
     {
       if (i < 128)
-	rep = XCBAllocColorReply (datap->conn,
-				  XCBAllocColor (datap->conn,
+	rep = xcb_alloc_color_reply (datap->conn,
+				  xcb_alloc_color (datap->conn,
 						 datap->cmap,
 						 i<<9, 0, 0),
 				  0);
       else if (i < 255)
-	rep = XCBAllocColorReply (datap->conn,
-				  XCBAllocColor (datap->conn,
+	rep = xcb_alloc_color_reply (datap->conn,
+				  xcb_alloc_color (datap->conn,
 						 datap->cmap,
 						 65535, (i-127)<<9, 0),
 				  0);
       else
-	rep = XCBAllocColorReply (datap->conn,
-				  XCBAllocColor (datap->conn,
+	rep = xcb_alloc_color_reply (datap->conn,
+				  xcb_alloc_color (datap->conn,
 						 datap->cmap,
 						 65535, 65535, (i-255)<<10),
 				  0);
@@ -83,9 +83,9 @@ draw_julia (Data *datap)
   int       c;
   int       i, j;
   
-  datap->image = XCBImageGet (datap->conn, datap->draw,
+  datap->image = xcb_image_get (datap->conn, datap->draw,
 		       0, 0, W_W, W_H,
-		       XCBAllPlanes, datap->format);
+		       XCB_ALL_PLANES, datap->format);
   
   for (i = 0 ; i < datap->image->width ; i++)
     for (j = 0 ; j < datap->image->height ; j++)
@@ -101,12 +101,12 @@ draw_julia (Data *datap)
 	    zi = 2.0*t*zi + ci;
 	    c++;
 	  }
-	XCBImagePutPixel (datap->image,
+	xcb_image_put_pixel (datap->image,
 			  i,j,
 			  datap->palette[c]);
       }
 
-  XCBImagePut (datap->conn, datap->draw, datap->gc, datap->image,
+  xcb_image_put (datap->conn, datap->draw, datap->gc, datap->image,
 	       0, 0, 0, 0, W_W, W_H);
 }
 
@@ -114,92 +114,92 @@ int
 main (int argc, char *argv[])
 {
   Data             data;
-  XCBSCREEN       *screen;
-  XCBDRAWABLE      win;
-  XCBDRAWABLE      rect;
-  XCBGCONTEXT      bgcolor;
-  CARD32           mask;
-  CARD32           valgc[2];
-  CARD32           valwin[3];
-  XCBRECTANGLE     rect_coord = { 0, 0, W_W, W_H};
-  XCBGenericEvent *e;
+  xcb_screen_t       *screen;
+  xcb_drawable_t      win;
+  xcb_drawable_t      rect;
+  xcb_gcontext_t      bgcolor;
+  uint32_t           mask;
+  uint32_t           valgc[2];
+  uint32_t           valwin[3];
+  xcb_rectangle_t     rect_coord = { 0, 0, W_W, W_H};
+  xcb_generic_event_t *e;
   int              screen_num;
   
-  data.conn = XCBConnect (0, &screen_num);
-  screen = XCBAuxGetScreen (data.conn, screen_num);
-  data.depth = XCBAuxGetDepth (data.conn, screen);
+  data.conn = xcb_connect (0, &screen_num);
+  screen = xcb_aux_get_screen (data.conn, screen_num);
+  data.depth = xcb_aux_get_depth (data.conn, screen);
 
   win.window = screen->root;
 
-  data.gc = XCBGCONTEXTNew (data.conn);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  data.gc = xcb_gcontext_new (data.conn);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC (data.conn, data.gc, win, mask, valgc);
+  xcb_create_gc (data.conn, data.gc, win, mask, valgc);
 
-  bgcolor = XCBGCONTEXTNew (data.conn);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  bgcolor = xcb_gcontext_new (data.conn);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC (data.conn, bgcolor, win, mask, valgc);
+  xcb_create_gc (data.conn, bgcolor, win, mask, valgc);
 
-  data.draw.window = XCBWINDOWNew (data.conn);
-  mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
+  data.draw.window = xcb_window_new (data.conn);
+  mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE;
   valwin[0] = screen->white_pixel;
-  valwin[1] = XCBEventMaskKeyRelease | XCBEventMaskButtonRelease | XCBEventMaskExposure;
-  valwin[2] = XCBEventMaskButtonPress;
-  XCBCreateWindow (data.conn, 0,
+  valwin[1] = XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE;
+  valwin[2] = XCB_EVENT_MASK_BUTTON_PRESS;
+  xcb_create_window (data.conn, 0,
 		   data.draw.window,
 		   screen->root,
 		   0, 0, W_W, W_H,
 		   10,
-		   XCBWindowClassInputOutput,
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,
 		   screen->root_visual,
 		   mask, valwin);
-  XCBMapWindow (data.conn, data.draw.window);
+  xcb_map_window (data.conn, data.draw.window);
 
-  rect.pixmap = XCBPIXMAPNew (data.conn);
-  XCBCreatePixmap (data.conn, data.depth,
+  rect.pixmap = xcb_pixmap_new (data.conn);
+  xcb_create_pixmap (data.conn, data.depth,
 		   rect.pixmap, data.draw,
 		   W_W, W_H);
-  XCBPolyFillRectangle(data.conn, rect, bgcolor, 1, &rect_coord);
+  xcb_poly_fill_rectangle(data.conn, rect, bgcolor, 1, &rect_coord);
 
-  XCBMapWindow (data.conn, data.draw.window);
+  xcb_map_window (data.conn, data.draw.window);
 
-  data.format = XCBImageFormatZPixmap;
+  data.format = XCB_IMAGE_FORMAT_Z_PIXMAP;
 
-  data.cmap = XCBCOLORMAPNew (data.conn);
-  XCBCreateColormap (data.conn,
-		     XCBColormapAllocNone,
+  data.cmap = xcb_colormap_new (data.conn);
+  xcb_create_colormap (data.conn,
+		     XCB_COLORMAP_ALLOC_NONE,
 		     data.cmap,
 		     data.draw.window,
 		     screen->root_visual);
 
   palette_julia (&data);
 
-  XCBFlush (data.conn); 
+  xcb_flush (data.conn); 
 
-  while ((e = XCBWaitForEvent(data.conn)))
+  while ((e = xcb_wait_for_event(data.conn)))
     {
       switch (e->response_type)
 	{
-	case XCBExpose:
+	case XCB_EXPOSE:
 	  {
-	    XCBCopyArea(data.conn, rect, data.draw, bgcolor,
+	    xcb_copy_area(data.conn, rect, data.draw, bgcolor,
 			0, 0, 0, 0, W_W, W_H);
 	    draw_julia (&data);
-	    XCBFlush (data.conn);
+	    xcb_flush (data.conn);
 	    break;
 	  }
-	case XCBKeyRelease:
-	case XCBButtonRelease:
+	case XCB_KEY_RELEASE:
+	case XCB_BUTTON_RELEASE:
 	  {
             if (data.palette)
               free (data.palette);
             if (data.image)
-              XCBImageDestroy (data.image);
+              xcb_image_destroy (data.image);
             free (e);
-            XCBDisconnect (data.conn);
+            xcb_disconnect (data.conn);
             exit (0);
 	    break;
 	  }
diff --git a/xcb-demo/tests/julia.h b/xcb-demo/tests/julia.h
index f0b2321..88b35fb 100644
--- a/xcb-demo/tests/julia.h
+++ b/xcb-demo/tests/julia.h
@@ -5,15 +5,15 @@ typedef struct Data_ Data;
 
 struct Data_
 {
-  XCBConnection *conn;
-  CARD8          depth;
-  XCBDRAWABLE    draw;
-  XCBGCONTEXT    gc;
-  XCBCOLORMAP    cmap;
-  CARD8          format;
+  xcb_connection_t *conn;
+  uint8_t          depth;
+  xcb_drawable_t    draw;
+  xcb_gcontext_t    gc;
+  xcb_colormap_t    cmap;
+  uint8_t          format;
 
-  XCBImage      *image;
-  CARD32        *palette;
+  xcb_image_t      *image;
+  uint32_t        *palette;
 };
 
 #endif /* __TEST_H__ */
diff --git a/xcb-demo/tests/lissajoux.c b/xcb-demo/tests/lissajoux.c
index 1e787bf..0bd1bf9 100644
--- a/xcb-demo/tests/lissajoux.c
+++ b/xcb-demo/tests/lissajoux.c
@@ -27,7 +27,7 @@ int    do_shm = 0;
 double tab_cos[3600];
 double tab_sin[3600];
 
-XCBShmSegmentInfo shminfo;
+xcb_shm_segment_info_t shminfo;
 
 double
 get_time(void)
@@ -49,17 +49,17 @@ draw_lissajoux (Data *datap)
   
   if (do_shm)
     { 
-      i = XCBImageSHMGet (datap->conn, datap->draw,
+      i = xcb_image_shm_get (datap->conn, datap->draw,
 			  datap->image, shminfo,
 			  0, 0,
-			  XCBAllPlanes);
+			  XCB_ALL_PLANES);
       assert(i);
     }
   else
     {
-      datap->image = XCBImageGet (datap->conn, datap->draw,
+      datap->image = xcb_image_get (datap->conn, datap->draw,
                                   0, 0, W_W, W_H,
-                                  XCBAllPlanes, datap->format);
+                                  XCB_ALL_PLANES, datap->format);
       assert(datap->image);
     }
   
@@ -75,7 +75,7 @@ draw_lissajoux (Data *datap)
       {
 	x = tab_cos[(int)(a1*i + p1*nbr) % 3600];
 	y = tab_sin[(int)(a2*i + p2*nbr) % 3600];
-	XCBImagePutPixel (datap->image,
+	xcb_image_put_pixel (datap->image,
 			  (int)((double)(W_W-5)*(x+1)/2.0),
 			  (int)((double)(W_H-5)*(y+1)/2.0), 65535);
       }
@@ -87,20 +87,20 @@ draw_lissajoux (Data *datap)
       {
 	x = tab_cos[(int)(a1*i + p1*nbr) % 3600];
 	y = tab_sin[(int)(a2*i + p2*nbr) % 3600];
-	XCBImagePutPixel (datap->image,
+	xcb_image_put_pixel (datap->image,
 			  (int)((double)(W_W-5)*(x+1)/2.0),
 			  (int)((double)(W_H-5)*(y+1)/2.0), 0);
       }
 
   if (do_shm)
-    XCBImageSHMPut (datap->conn, datap->draw, datap->gc,
+    xcb_image_shm_put (datap->conn, datap->draw, datap->gc,
 		    datap->image, shminfo,
 		    0, 0, 0, 0, W_W, W_H, 0);
   else
     {
-      XCBImagePut (datap->conn, datap->draw, datap->gc, datap->image,
+      xcb_image_put (datap->conn, datap->draw, datap->gc, datap->image,
                    0, 0, 0, 0, W_W, W_H);
-      XCBImageDestroy (datap->image);
+      xcb_image_destroy (datap->image);
     }
 }
 
@@ -120,8 +120,8 @@ step (Data *datap)
       printf("TIME.........: %3.3f seconds\n", t);
       printf("AVERAGE FPS..: %3.3f fps\n", (double)loop_count / t);
       if (do_shm)
-        XCBImageSHMDestroy (datap->image);
-      XCBDisconnect (datap->conn);
+        xcb_image_shm_destroy (datap->image);
+      xcb_disconnect (datap->conn);
       exit(0);
     }
 }
@@ -130,14 +130,14 @@ step (Data *datap)
 void
 shm_test (Data *datap)
 {
-  XCBShmQueryVersionRep *rep;
+  xcb_shm_query_version_reply_t *rep;
 
-  rep = XCBShmQueryVersionReply (datap->conn,
-				 XCBShmQueryVersion (datap->conn),
+  rep = xcb_shm_query_version_reply (datap->conn,
+				 xcb_shm_query_version (datap->conn),
 				 NULL);
   if (rep)
     {
-      CARD8 format;
+      uint8_t format;
       int shmctl_status;
       
       if (rep->shared_pixmaps && 
@@ -145,7 +145,7 @@ shm_test (Data *datap)
 	format = rep->pixmap_format;
       else
 	format = 0;
-      datap->image = XCBImageSHMCreate (datap->conn, datap->depth,
+      datap->image = xcb_image_shm_create (datap->conn, datap->depth,
                                         format, NULL, W_W, W_H);
       assert(datap->image);
 
@@ -157,8 +157,8 @@ shm_test (Data *datap)
       assert(shminfo.shmaddr);
       datap->image->data = shminfo.shmaddr;
 
-      shminfo.shmseg = XCBShmSEGNew (datap->conn);
-      XCBShmAttach (datap->conn, shminfo.shmseg,
+      shminfo.shmseg = xcb_shm_seg_new (datap->conn);
+      xcb_shm_attach (datap->conn, shminfo.shmseg,
 		    shminfo.shmid, 0);
       shmctl_status = shmctl(shminfo.shmid, IPC_RMID, 0);
       assert(shmctl_status != -1);
@@ -183,15 +183,15 @@ int
 main (int argc, char *argv[])
 {
   Data             data;
-  XCBSCREEN       *screen;
-  XCBDRAWABLE      win;
-  XCBDRAWABLE      rect;
-  XCBGCONTEXT      bgcolor;
-  CARD32           mask;
-  CARD32           valgc[2];
-  CARD32           valwin[3];
-  XCBRECTANGLE     rect_coord = { 0, 0, W_W, W_H};
-  XCBGenericEvent *e;
+  xcb_screen_t       *screen;
+  xcb_drawable_t      win;
+  xcb_drawable_t      rect;
+  xcb_gcontext_t      bgcolor;
+  uint32_t           mask;
+  uint32_t           valgc[2];
+  uint32_t           valwin[3];
+  xcb_rectangle_t     rect_coord = { 0, 0, W_W, W_H};
+  xcb_generic_event_t *e;
   int              try_shm;
   int              screen_num;
   int              i;
@@ -211,47 +211,47 @@ main (int argc, char *argv[])
   if (try_shm != 0)
     try_shm = 1;
 
-  data.conn = XCBConnect (0, &screen_num);
-  screen = XCBAuxGetScreen(data.conn, screen_num);
-  data.depth = XCBAuxGetDepth (data.conn, screen);
+  data.conn = xcb_connect (0, &screen_num);
+  screen = xcb_aux_get_screen(data.conn, screen_num);
+  data.depth = xcb_aux_get_depth (data.conn, screen);
 
   win.window = screen->root;
 
-  data.gc = XCBGCONTEXTNew (data.conn);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  data.gc = xcb_gcontext_new (data.conn);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->black_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC (data.conn, data.gc, win, mask, valgc);
+  xcb_create_gc (data.conn, data.gc, win, mask, valgc);
 
-  bgcolor = XCBGCONTEXTNew (data.conn);
-  mask = XCBGCForeground | XCBGCGraphicsExposures;
+  bgcolor = xcb_gcontext_new (data.conn);
+  mask = XCB_GC_FOREGROUND | XCB_GC_GRAPHICS_EXPOSURES;
   valgc[0] = screen->white_pixel;
   valgc[1] = 0; /* no graphics exposures */
-  XCBCreateGC (data.conn, bgcolor, win, mask, valgc);
+  xcb_create_gc (data.conn, bgcolor, win, mask, valgc);
 
-  data.draw.window = XCBWINDOWNew (data.conn);
-  mask = XCBCWBackPixel | XCBCWEventMask | XCBCWDontPropagate;
+  data.draw.window = xcb_window_new (data.conn);
+  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 (data.conn, 0,
+  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 (data.conn, 0,
 		   data.draw.window,
 		   screen->root,
 		   0, 0, W_W, W_H,
 		   10,
-		   XCBWindowClassInputOutput,
+		   XCB_WINDOW_CLASS_INPUT_OUTPUT,
 		   screen->root_visual,
 		   mask, valwin);
-  XCBMapWindow (data.conn, data.draw.window);
+  xcb_map_window (data.conn, data.draw.window);
 
-  rect.pixmap = XCBPIXMAPNew (data.conn);
-  XCBCreatePixmap (data.conn, data.depth,
+  rect.pixmap = xcb_pixmap_new (data.conn);
+  xcb_create_pixmap (data.conn, data.depth,
 		   rect.pixmap, data.draw,
 		   W_W, W_H);
-  XCBPolyFillRectangle(data.conn, rect, bgcolor, 1, &rect_coord);
+  xcb_poly_fill_rectangle(data.conn, rect, bgcolor, 1, &rect_coord);
 
-  data.format = XCBImageFormatZPixmap;
-  XCBFlush (data.conn); 
+  data.format = XCB_IMAGE_FORMAT_Z_PIXMAP;
+  xcb_flush (data.conn); 
 
   if (try_shm)
     shm_test (&data);
@@ -265,20 +265,20 @@ main (int argc, char *argv[])
   t_previous = 0.0;
   while (1)
     {
-      e = XCBPollForEvent(data.conn, NULL);
+      e = xcb_poll_for_event(data.conn, NULL);
       if (e)
 	{
 	  switch (e->response_type)
 	    {
-	    case XCBExpose:
-	      XCBCopyArea(data.conn, rect, data.draw, bgcolor,
+	    case XCB_EXPOSE:
+	      xcb_copy_area(data.conn, rect, data.draw, bgcolor,
 		          0, 0, 0, 0, W_W, W_H);
 	      break;
 	    }
 	  free (e);
         }
       step (&data);
-      XCBFlush (data.conn);
+      xcb_flush (data.conn);
       t_previous = t;
     }
   /*NOTREACHED*/
diff --git a/xcb-demo/tests/lissajoux.h b/xcb-demo/tests/lissajoux.h
index 922b576..1b43c21 100644
--- a/xcb-demo/tests/lissajoux.h
+++ b/xcb-demo/tests/lissajoux.h
@@ -5,12 +5,12 @@ typedef struct Data_ Data;
 
 struct Data_
 {
-  XCBConnection *conn;
-  CARD8          depth;
-  XCBDRAWABLE    draw;
-  XCBGCONTEXT    gc;
-  CARD8          format;
-  XCBImage      *image;
+  xcb_connection_t *conn;
+  uint8_t          depth;
+  xcb_drawable_t    draw;
+  xcb_gcontext_t    gc;
+  uint8_t          format;
+  xcb_image_t      *image;
 };
 
 #endif /* __TEST_H__ */
diff --git a/xcb-demo/xcb-test.c b/xcb-demo/xcb-test.c
index 110ac19..90eeeaf 100644
--- a/xcb-demo/xcb-test.c
+++ b/xcb-demo/xcb-test.c
@@ -30,41 +30,41 @@
 #include <stdio.h>
 #endif
 
-void try_events(XCBConnection *c);
-void wait_events(XCBConnection *c);
+void try_events(xcb_connection_t *c);
+void wait_events(xcb_connection_t *c);
 
-static XCBConnection *c;
-static XCBWINDOW window;
+static xcb_connection_t *c;
+static xcb_window_t window;
 
 int main(int argc, char **argv)
 {
-    CARD32 mask = 0;
-    CARD32 values[6];
-    XCBDRAWABLE d;
-    XCBSCREEN *root;
+    uint32_t mask = 0;
+    uint32_t values[6];
+    xcb_drawable_t d;
+    xcb_screen_t *root;
 #ifdef TEST_GET_GEOMETRY
-    XCBGetGeometryCookie geom[3];
-    XCBGetGeometryRep *geomrep[3];
+    xcb_get_geometry_cookie_t geom[3];
+    xcb_get_geometry_reply_t *geomrep[3];
 #endif
 #ifdef TEST_QUERY_TREE
-    XCBQueryTreeCookie tree[3];
-    XCBQueryTreeRep *treerep[3];
+    xcb_query_tree_cookie_t tree[3];
+    xcb_query_tree_reply_t *treerep[3];
 #endif
 #ifdef TEST_GET_WINDOW_ATTRIBUTES
-    XCBGetWindowAttributesCookie attr[1];
-    XCBGetWindowAttributesRep *attrrep[1];
+    xcb_get_window_attributes_cookie_t attr[1];
+    xcb_get_window_attributes_reply_t *attrrep[1];
 #endif
 #ifdef TEST_ICCCM
-    XCBInternAtomCookie atom[2];
-    XCBInternAtomRep *atomrep[2];
+    xcb_intern_atom_cookie_t atom[2];
+    xcb_intern_atom_reply_t *atomrep[2];
 #endif
 #ifdef TEST_THREADS
     pthread_t event_thread;
 #endif
     int screen_num;
 
-    c = XCBConnect(0, &screen_num);
-    root = XCBAuxGetScreen(c, screen_num);
+    c = xcb_connect(0, &screen_num);
+    root = xcb_aux_get_screen(c, screen_num);
 
 #ifdef TEST_THREADS
 # ifdef VERBOSE
@@ -75,95 +75,95 @@ int main(int argc, char **argv)
 #endif
 
 #if 1
-    window = XCBWINDOWNew(c);
+    window = xcb_window_new(c);
 #else
     window = 0; /* should be an invalid ID */
 #endif
 
-    mask |= XCBCWBackPixel;
+    mask |= XCB_CW_BACK_PIXEL;
     values[0] = root->white_pixel;
 
-    mask |= XCBCWBorderPixel;
+    mask |= XCB_CW_BORDER_PIXEL;
     values[1] = root->black_pixel;
 
-    mask |= XCBCWBackingStore;
-    values[2] = XCBBackingStoreAlways;
+    mask |= XCB_CW_BACKING_STORE;
+    values[2] = XCB_BACKING_STORE_ALWAYS;
 
-    mask |= XCBCWOverrideRedirect;
+    mask |= XCB_CW_OVERRIDE_REDIRECT;
     values[3] = 0;
 
-    mask |= XCBCWEventMask;
-    values[4] = XCBEventMaskButtonRelease
-        | XCBEventMaskExposure | XCBEventMaskStructureNotify
-        | XCBEventMaskEnterWindow | XCBEventMaskLeaveWindow;
+    mask |= XCB_CW_EVENT_MASK;
+    values[4] = XCB_EVENT_MASK_BUTTON_RELEASE
+        | XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY
+        | XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW;
 
-    mask |= XCBCWDontPropagate;
-    values[5] = XCBEventMaskButtonPress;
+    mask |= XCB_CW_DONT_PROPAGATE;
+    values[5] = XCB_EVENT_MASK_BUTTON_PRESS;
 
-    XCBCreateWindow(c, /* depth */ 0,
+    xcb_create_window(c, /* depth */ 0,
         window, root->root,
         /* x */ 20, /* y */ 200, /* width */ 150, /* height */ 150,
-        /* border_width */ 10, /* class */ XCBWindowClassInputOutput,
+        /* border_width */ 10, /* class */ XCB_WINDOW_CLASS_INPUT_OUTPUT,
         /* visual */ root->root_visual, mask, values);
 #ifdef TEST_ICCCM
-    atom[0] = XCBInternAtom(c, 0, sizeof("WM_PROTOCOLS")-1, "WM_PROTOCOLS");
-    atom[1] = XCBInternAtom(c, 0, sizeof("WM_DELETE_WINDOW")-1, "WM_DELETE_WINDOW");
-    atomrep[1] = XCBInternAtomReply(c, atom[1], 0);
-    atomrep[0] = XCBInternAtomReply(c, atom[0], 0);
+    atom[0] = xcb_intern_atom(c, 0, sizeof("WM_PROTOCOLS")-1, "WM_PROTOCOLS");
+    atom[1] = xcb_intern_atom(c, 0, sizeof("WM_DELETE_WINDOW")-1, "WM_DELETE_WINDOW");
+    atomrep[1] = xcb_intern_atom_reply(c, atom[1], 0);
+    atomrep[0] = xcb_intern_atom_reply(c, atom[0], 0);
     {
-        XCBATOM XA_WM_NAME = { 39 };
-        XCBATOM XA_STRING = { 31 };
-        XCBChangeProperty(c, XCBPropModeReplace, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]);
+        xcb_atom_t XA_WM_NAME = { 39 };
+        xcb_atom_t XA_STRING = { 31 };
+        xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, XA_WM_NAME, XA_STRING, 8, strlen(argv[0]), argv[0]);
     }
     if(atomrep[0] && atomrep[1])
     {
-        XCBATOM WM_PROTOCOLS = atomrep[0]->atom;
-        XCBATOM WM_DELETE_WINDOW = atomrep[1]->atom;
-        XCBATOM XA_ATOM = { 4 };
-        XCBChangeProperty(c, XCBPropModeReplace, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW);
+        xcb_atom_t WM_PROTOCOLS = atomrep[0]->atom;
+        xcb_atom_t WM_DELETE_WINDOW = atomrep[1]->atom;
+        xcb_atom_t XA_ATOM = { 4 };
+        xcb_change_property(c, XCB_PROP_MODE_REPLACE, window, WM_PROTOCOLS, XA_ATOM, 32, 1, &WM_DELETE_WINDOW);
     }
     free(atomrep[0]);
     free(atomrep[1]);
 #endif
     try_events(c);
 
-    XCBMapWindow(c, window);
-    XCBFlush(c);
+    xcb_map_window(c, window);
+    xcb_flush(c);
 
     /* Send off a collection of requests */
 #ifdef TEST_GET_WINDOW_ATTRIBUTES
-    attr[0] = XCBGetWindowAttributes(c, window);
+    attr[0] = xcb_get_window_attributes(c, window);
 #endif
 #ifdef TEST_GET_GEOMETRY
     d.window = root->root;
-    geom[0] = XCBGetGeometry(c, d);
+    geom[0] = xcb_get_geometry(c, d);
     d.window = window;
-    geom[1] = XCBGetGeometry(c, d);
+    geom[1] = xcb_get_geometry(c, d);
 #endif
 #ifdef TEST_QUERY_TREE
 # ifdef SUPERVERBOSE /* this produces a lot of output :) */
-    tree[0] = XCBQueryTree(c, root->root);
+    tree[0] = xcb_query_tree(c, root->root);
 # endif
-    tree[1] = XCBQueryTree(c, window);
+    tree[1] = xcb_query_tree(c, window);
 #endif
 
     /* Start reading replies and possibly events */
 #ifdef TEST_GET_GEOMETRY
-    geomrep[0] = XCBGetGeometryReply(c, geom[0], 0);
+    geomrep[0] = xcb_get_geometry_reply(c, geom[0], 0);
     formatGetGeometryReply(root->root, geomrep[0]);
     free(geomrep[0]);
 #endif
 
 #ifdef TEST_QUERY_TREE
 # ifdef SUPERVERBOSE /* this produces a lot of output :) */
-    treerep[0] = XCBQueryTreeReply(c, tree[0], 0);
+    treerep[0] = xcb_query_tree_reply(c, tree[0], 0);
     formatQueryTreeReply(root->root, treerep[0]);
     free(treerep[0]);
 # endif
 #endif
 
 #ifdef TEST_GET_GEOMETRY
-    geomrep[1] = XCBGetGeometryReply(c, geom[1], 0);
+    geomrep[1] = xcb_get_geometry_reply(c, geom[1], 0);
     formatGetGeometryReply(window, geomrep[1]);
     free(geomrep[1]);
 #endif
@@ -172,22 +172,22 @@ int main(int argc, char **argv)
 
     /* Mix in some more requests */
 #ifdef TEST_QUERY_TREE
-    treerep[1] = XCBQueryTreeReply(c, tree[1], 0);
+    treerep[1] = xcb_query_tree_reply(c, tree[1], 0);
     formatQueryTreeReply(window, treerep[1]);
 
     if(treerep[1] && treerep[1]->parent.xid && treerep[1]->parent.xid != root->root.xid)
     {
-        tree[2] = XCBQueryTree(c, treerep[1]->parent);
+        tree[2] = xcb_query_tree(c, treerep[1]->parent);
 
 # ifdef TEST_GET_GEOMETRY
         d.window = treerep[1]->parent;
-        geom[2] = XCBGetGeometry(c, d);
-        geomrep[2] = XCBGetGeometryReply(c, geom[2], 0);
+        geom[2] = xcb_get_geometry(c, d);
+        geomrep[2] = xcb_get_geometry_reply(c, geom[2], 0);
         formatGetGeometryReply(treerep[1]->parent, geomrep[2]);
         free(geomrep[2]);
 # endif
 
-        treerep[2] = XCBQueryTreeReply(c, tree[2], 0);
+        treerep[2] = xcb_query_tree_reply(c, tree[2], 0);
         formatQueryTreeReply(treerep[1]->parent, treerep[2]);
         free(treerep[2]);
     }
@@ -200,7 +200,7 @@ int main(int argc, char **argv)
     /* Get the last reply of the first batch */
 #if 1 /* if 0, leaves a reply in the reply queue */
 #ifdef TEST_GET_WINDOW_ATTRIBUTES
-    attrrep[0] = XCBGetWindowAttributesReply(c, attr[0], 0);
+    attrrep[0] = xcb_get_window_attributes_reply(c, attr[0], 0);
     formatGetWindowAttributesReply(window, attrrep[0]);
     free(attrrep[0]);
 #endif
@@ -211,38 +211,38 @@ int main(int argc, char **argv)
 #else
     wait_events(c);
 #endif
-    XCBDisconnect(c);
+    xcb_disconnect(c);
     exit(0);
     /*NOTREACHED*/
 }
 
-int show_event(XCBGenericEvent *e)
+int show_event(xcb_generic_event_t *e)
 {
     int ret = 1;
     if(!formatEvent(e))
         return 0;
 
-    if(e->response_type == XCBButtonRelease)
+    if(e->response_type == XCB_BUTTON_RELEASE)
         ret = 0; /* They clicked, therefore, we're done. */
     free(e);
     return ret;
 }
 
-void try_events(XCBConnection *c)
+void try_events(xcb_connection_t *c)
 {
-    XCBGenericEvent *e;
-    while((e = XCBPollForEvent(c, 0)) && show_event(e))
+    xcb_generic_event_t *e;
+    while((e = xcb_poll_for_event(c, 0)) && show_event(e))
         /* empty statement */ ;
 }
 
-void wait_events(XCBConnection *c)
+void wait_events(xcb_connection_t *c)
 {
-    XCBGenericEvent *e;
+    xcb_generic_event_t *e;
 #ifdef TEST_THREADS
 # ifdef VERBOSE
     printf("wait_events() thread ID: %ld\n", pthread_self());
 # endif
 #endif
-    while((e = XCBWaitForEvent(c)) && show_event(e))
+    while((e = xcb_wait_for_event(c)) && show_event(e))
         /* empty statement */ ;
 }
diff --git a/xcb-demo/xcbdpyinfo.c b/xcb-demo/xcbdpyinfo.c
index 55c9ff3..711c29e 100644
--- a/xcb-demo/xcbdpyinfo.c
+++ b/xcb-demo/xcbdpyinfo.c
@@ -3,7 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-XCBConnection *c;
+xcb_connection_t *c;
 
 void print_setup();
 void print_formats();
@@ -11,14 +11,14 @@ void list_extensions(void (*)(int, char 
 void print_extension(int, char *);
 void query_extension(int, char *);
 void list_screens();
-void print_screen(XCBSCREEN *s);
+void print_screen(xcb_screen_t *s);
 
 int main(int argc, char **argv)
 {
     void (*ext_printer)(int, char *) = print_extension;
     int screen;
 
-    c = XCBConnect(0, &screen);
+    c = xcb_connect(0, &screen);
     if(!c)
     {
 	fputs("Connect failed.\n", stderr);
@@ -37,32 +37,32 @@ int main(int argc, char **argv)
     list_screens();
     fputs("\n", stdout);
 
-    XCBDisconnect(c);
+    xcb_disconnect(c);
 
     exit(0);
 }
 
 void print_setup()
 {
-    printf("version number:    %d.%d", XCBGetSetup(c)->protocol_major_version, XCBGetSetup(c)->protocol_minor_version);
+    printf("version number:    %d.%d", xcb_get_setup(c)->protocol_major_version, xcb_get_setup(c)->protocol_minor_version);
     fputs("\n" "vendor string:    ", stdout);
-    fwrite(XCBSetupVendor(XCBGetSetup(c)), 1, XCBSetupVendorLength(XCBGetSetup(c)), stdout);
-    printf("\n" "vendor release number:    %d", (int) XCBGetSetup(c)->release_number);
+    fwrite(xcb_setup_vendor(xcb_get_setup(c)), 1, xcb_setup_vendor_length(xcb_get_setup(c)), stdout);
+    printf("\n" "vendor release number:    %d", (int) xcb_get_setup(c)->release_number);
     /* "\n" "XFree86 version: %d.%d.%d.%d" */
-    printf("\n" "maximum request size:  %d bytes", XCBGetSetup(c)->maximum_request_length * 4);
-    printf("\n" "motion buffer size:  %d", (int)XCBGetSetup(c)->motion_buffer_size);
-    printf("\n" "bitmap unit, bit order, padding:    %d, %s, %d", XCBGetSetup(c)->bitmap_format_scanline_unit, (XCBGetSetup(c)->bitmap_format_bit_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst", XCBGetSetup(c)->bitmap_format_scanline_pad);
-    printf("\n" "image byte order:    %s", (XCBGetSetup(c)->image_byte_order == XCBImageOrderLSBFirst) ? "LSBFirst" : "MSBFirst");
+    printf("\n" "maximum request size:  %d bytes", xcb_get_setup(c)->maximum_request_length * 4);
+    printf("\n" "motion buffer size:  %d", (int)xcb_get_setup(c)->motion_buffer_size);
+    printf("\n" "bitmap unit, bit order, padding:    %d, %s, %d", xcb_get_setup(c)->bitmap_format_scanline_unit, (xcb_get_setup(c)->bitmap_format_bit_order == XCB_IMAGE_ORDER_LSB_FIRST) ? "LSBFirst" : "MSBFirst", xcb_get_setup(c)->bitmap_format_scanline_pad);
+    printf("\n" "image byte order:    %s", (xcb_get_setup(c)->image_byte_order == XCB_IMAGE_ORDER_LSB_FIRST) ? "LSBFirst" : "MSBFirst");
 
     print_formats();
 
-    printf("\n" "keycode range:    minimum %d, maximum %d", XCBGetSetup(c)->min_keycode.id, XCBGetSetup(c)->max_keycode.id);
+    printf("\n" "keycode range:    minimum %d, maximum %d", xcb_get_setup(c)->min_keycode.id, xcb_get_setup(c)->max_keycode.id);
 }
 
 void print_formats()
 {
-    int i = XCBSetupPixmapFormatsLength(XCBGetSetup(c));
-    XCBFORMAT *p = XCBSetupPixmapFormats(XCBGetSetup(c));
+    int i = xcb_setup_pixmap_formats_length(xcb_get_setup(c));
+    xcb_format_t *p = xcb_setup_pixmap_formats(xcb_get_setup(c));
     printf("\n" "number of supported pixmap formats:    %d", i);
     fputs("\n" "supported pixmap formats:", stdout);
     for(--i; i >= 0; --i, ++p)
@@ -71,22 +71,22 @@ void print_formats()
 
 void list_extensions(void (*ext_printer)(int, char *))
 {
-    XCBListExtensionsRep *r;
-    XCBSTRIter i;
+    xcb_list_extensions_reply_t *r;
+    xcb_str_iterator_t i;
 
-    r = XCBListExtensionsReply(c, XCBListExtensions(c), 0);
+    r = xcb_list_extensions_reply(c, xcb_list_extensions(c), 0);
     if(!r)
     {
 	fputs("ListExtensions failed.\n", stderr);
 	return;
     }
 
-    i = XCBListExtensionsNamesIter(r);
+    i = xcb_list_extensions_names_iterator(r);
     printf("\n" "number of extensions:    %d", i.rem);
-    for(; i.rem; XCBSTRNext(&i))
+    for(; i.rem; xcb_str_next(&i))
     {
 	fputs("\n" "    ", stdout);
-	ext_printer(XCBSTRNameLength(i.data), XCBSTRName(i.data));
+	ext_printer(xcb_str_name_length(i.data), xcb_str_name(i.data));
     }
     free(r);
 }
@@ -98,10 +98,10 @@ void print_extension(int len, char *name
 
 void query_extension(int len, char *name)
 {
-    XCBQueryExtensionRep *r;
+    xcb_query_extension_reply_t *r;
     int comma = 0;
 
-    r = XCBQueryExtensionReply(c, XCBQueryExtension(c, len, name), 0);
+    r = xcb_query_extension_reply(c, xcb_query_extension(c, len, name), 0);
     if(!r)
     {
 	fputs("QueryExtension failed.\n", stderr);
@@ -133,19 +133,19 @@ void query_extension(int len, char *name
 
 void list_screens()
 {
-    XCBSCREENIter i;
+    xcb_screen_iterator_t i;
     int cur;
 
-    i = XCBSetupRootsIter(XCBGetSetup(c));
+    i = xcb_setup_roots_iterator(xcb_get_setup(c));
     printf("\n" "number of screens:    %d" "\n", i.rem);
-    for(cur = 1; i.rem; XCBSCREENNext(&i), ++cur)
+    for(cur = 1; i.rem; xcb_screen_next(&i), ++cur)
     {
 	printf("\n" "screen #%d:", cur);
 	print_screen(i.data);
     }
 }
 
-void print_screen(XCBSCREEN *s)
+void print_screen(xcb_screen_t *s)
 {
     printf("\n" "  dimensions:    %dx%d pixels (%dx%d millimeters)", s->width_in_pixels, s->height_in_pixels, s->width_in_millimeters, s->height_in_millimeters);
 }
diff --git a/xcb-demo/xcbrandr.c b/xcb-demo/xcbrandr.c
index 1fba5d4..27c0f54 100644
--- a/xcb-demo/xcbrandr.c
+++ b/xcb-demo/xcbrandr.c
@@ -85,18 +85,18 @@ usage(void)
  * Would be nice to put in another library or something.
  */
 short*
-ConfigRates(XCBRandRGetScreenInfoRep *config, int sizeID, int *nrates)
+ConfigRates(xcb_randr_get_screen_info_reply_t *config, int sizeID, int *nrates)
 {
     int i = 0;
     short *ents;
-    XCBRandRRefreshRatesIter ri = XCBRandRGetScreenInfoRatesIter(config);
+    xcb_randr_refresh_rates_iterator_t ri = xcb_randr_get_screen_info_rates_iterator(config);
     
     while (i++ < sizeID) {
-	XCBRandRRefreshRatesNext(&ri);
+	xcb_randr_refresh_rates_next(&ri);
     }
     
-    ents = (short *)XCBRandRRefreshRatesRates(ri.data);
-    *nrates = XCBRandRRefreshRatesRatesLength(ri.data);
+    ents = (short *)xcb_randr_refresh_rates_rates(ri.data);
+    *nrates = xcb_randr_refresh_rates_rates_length(ri.data);
     
     if (!nrates) {
 	*nrates = 0;
@@ -109,19 +109,19 @@ ConfigRates(XCBRandRGetScreenInfoRep *co
 int
 main (int argc, char **argv)
 {
-  XCBConnection  *c;
-  XCBRandRScreenSize *sizes;
-  XCBRandRGetScreenInfoRep *sc;
+  xcb_connection_t  *c;
+  xcb_randr_screen_size_t *sizes;
+  xcb_randr_get_screen_info_reply_t *sc;
   int		nsize;
   int		nrate;
   short		*rates;
-  XCBSCREEN	*root;
-  int		status = XCBRandRSetConfigFailed;
+  xcb_screen_t	*root;
+  int		status = XCB_RANDR_SET_CONFIG_FAILED;
   int		rot = -1;
   int		verbose = 0, query = 0;
   short		rotation, current_rotation, rotations;
-  XCBGenericEvent *event;
-  XCBRandRScreenChangeNotifyEvent *sce;
+  xcb_generic_event_t *event;
+  xcb_randr_screen_change_notify_event_t *sce;
   char          *display_name = NULL;
   int 		i, j;
   int		current_size;
@@ -136,12 +136,12 @@ main (int argc, char **argv)
   short		reflection = 0;
   int		width = 0, height = 0;
   int		have_pixel_size = 0;
-  XCBGenericError *err;
-  CARD16 mask = (CARD16) XCBEventMaskStructureNotify;
-  CARD32 values[1];
-  XCBRandRGetScreenInfoCookie scookie;
+  xcb_generic_error_t *err;
+  uint16_t mask = (uint16_t) XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+  uint32_t values[1];
+  xcb_randr_get_screen_info_cookie_t scookie;
   int major_version, minor_version;
-  XCBRandRQueryVersionRep *rr_version;
+  xcb_randr_query_version_reply_t *rr_version;
 
   program_name = argv[0];
   if (argc == 1) query = 1;
@@ -186,12 +186,12 @@ main (int argc, char **argv)
     }
 
     if (!strcmp ("-x", argv[i])) {
-      reflection |= XCBRandRRotationReflect_X;
+      reflection |= XCB_RANDR_ROTATION_REFLECT_X;
       setit = 1;
       continue;
     }
     if (!strcmp ("-y", argv[i])) {
-      reflection |= XCBRandRRotationReflect_Y;
+      reflection |= XCB_RANDR_ROTATION_REFLECT_Y;
       setit = 1;
       continue;
     }
@@ -231,13 +231,13 @@ main (int argc, char **argv)
       fprintf (stderr, "No display available\n");
       exit (1);
   }
-  c = XCBConnect(display_name, &screen);
+  c = xcb_connect(display_name, &screen);
   if (!c) {
       fprintf (stderr, "Can't open display %s\n", display_name);
       exit (1);
   }
-  root = XCBAuxGetScreen(c, screen);
-  rr_version = XCBRandRQueryVersionReply(c, XCBRandRQueryVersion(c, 1, 1), 0);
+  root = xcb_aux_get_screen(c, screen);
+  rr_version = xcb_randr_query_version_reply(c, xcb_randr_query_version(c, 1, 1), 0);
   if (!rr_version) {
       fprintf(stderr, "Can't get VersionReply.\n");
       exit (1);
@@ -245,8 +245,8 @@ main (int argc, char **argv)
   major_version = rr_version->major_version;
   minor_version = rr_version->minor_version;
 
-  scookie = XCBRandRGetScreenInfo(c, root->root);
-  sc = XCBRandRGetScreenInfoReply(c, scookie, 0);
+  scookie = xcb_randr_get_screen_info(c, root->root);
+  sc = xcb_randr_get_screen_info_reply(c, scookie, 0);
   if (!sc) {
 	fprintf(stderr, "Can't get ScreenInfo.\n");
 	exit (1);
@@ -256,7 +256,7 @@ main (int argc, char **argv)
   current_size = sc->sizeID;
   
   nsize = sc->nSizes;
-  sizes = XCBRandRGetScreenInfoSizes(sc);
+  sizes = xcb_randr_get_screen_info_sizes(sc);
 
   if (have_pixel_size) {
     for (size = 0; size < nsize; size++)
@@ -324,10 +324,10 @@ main (int argc, char **argv)
     }
 
     printf("Current reflection - ");
-    if (current_rotation & (XCBRandRRotationReflect_X|XCBRandRRotationReflect_Y))
+    if (current_rotation & (XCB_RANDR_ROTATION_REFLECT_X|XCB_RANDR_ROTATION_REFLECT_Y))
     {
-	if (current_rotation & XCBRandRRotationReflect_X) printf ("X Axis ");
-	if (current_rotation & XCBRandRRotationReflect_Y) printf ("Y Axis");
+	if (current_rotation & XCB_RANDR_ROTATION_REFLECT_X) printf ("X Axis ");
+	if (current_rotation & XCB_RANDR_ROTATION_REFLECT_Y) printf ("Y Axis");
     }
     else
 	printf ("none");
@@ -341,10 +341,10 @@ main (int argc, char **argv)
     printf ("\n");
 
     printf ("Reflections possible - ");
-    if (rotations & (XCBRandRRotationReflect_X|XCBRandRRotationReflect_Y))
+    if (rotations & (XCB_RANDR_ROTATION_REFLECT_X|XCB_RANDR_ROTATION_REFLECT_Y))
     {
-        if (rotations & XCBRandRRotationReflect_X) printf ("X Axis ");
-	if (rotations & XCBRandRRotationReflect_Y) printf ("Y Axis");
+        if (rotations & XCB_RANDR_ROTATION_REFLECT_X) printf ("X Axis ");
+	if (rotations & XCB_RANDR_ROTATION_REFLECT_Y) printf ("Y Axis");
     }
     else
 	printf ("none");
@@ -357,30 +357,30 @@ main (int argc, char **argv)
     printf ("Setting reflection on ");
     if (reflection)
     {
-	if (reflection & XCBRandRRotationReflect_X) printf ("X Axis ");
-	if (reflection & XCBRandRRotationReflect_Y) printf ("Y Axis");
+	if (reflection & XCB_RANDR_ROTATION_REFLECT_X) printf ("X Axis ");
+	if (reflection & XCB_RANDR_ROTATION_REFLECT_Y) printf ("Y Axis");
     }
     else
 	printf ("neither axis");
     printf ("\n");
 
-    if (reflection & XCBRandRRotationReflect_X) printf("Setting reflection on X axis\n");
+    if (reflection & XCB_RANDR_ROTATION_REFLECT_X) printf("Setting reflection on X axis\n");
 
-    if (reflection & XCBRandRRotationReflect_Y) printf("Setting reflection on Y axis\n");
+    if (reflection & XCB_RANDR_ROTATION_REFLECT_Y) printf("Setting reflection on Y axis\n");
   }
 
   /* we should test configureNotify on the root window */
   values[0] = 1;
-  XCBConfigureWindow(c, root->root, mask, values);
+  xcb_configure_window(c, root->root, mask, values);
 
-  if (setit) XCBRandRSelectInput (c, root->root, XCBRandRSMScreenChangeNotify);
+  if (setit) xcb_randr_select_input (c, root->root, XCB_RANDR_SM_SCREEN_CHANGE_NOTIFY);
 
   if (setit) {
-    XCBRandRSetScreenConfigCookie sscc;
-    XCBRandRSetScreenConfigRep *config;
-    sscc = XCBRandRSetScreenConfig(c, root->root, CurrentTime, sc->config_timestamp, size,
+    xcb_randr_set_screen_config_cookie_t sscc;
+    xcb_randr_set_screen_config_reply_t *config;
+    sscc = xcb_randr_set_screen_config(c, root->root, CurrentTime, sc->config_timestamp, size,
 	    (short) (rotation | reflection), rate);
-    config = XCBRandRSetScreenConfigReply(c, sscc, &err);
+    config = xcb_randr_set_screen_config_reply(c, sscc, &err);
     if (!config) {
 	fprintf(stderr, "Can't set the screen. Error Code: %i Status:%i\n",
 		err->error_code, status);
@@ -389,16 +389,17 @@ main (int argc, char **argv)
     status = config->status;
   }
     
-  const XCBQueryExtensionRep *qrre_rep = XCBRandRInit(c);
+  const xcb_query_extension_reply_t *qrre_rep;
+  qrre_rep = xcb_get_extension_data(c, &xcb_randr_id);
   event_base = qrre_rep->first_event;
   error_base = qrre_rep->first_error;
   
   if (verbose && setit) {
-    if (status == XCBRandRSetConfigSuccess)
+    if (status == XCB_RANDR_SET_CONFIG_SUCCESS)
       {
 	while (1) {
 	int spo;
-	event = XCBWaitForEvent(c);
+	event = xcb_wait_for_event(c);
 	
 	printf ("Event received, type = %d\n", event->response_type);
 #if 0
@@ -410,8 +411,8 @@ main (int argc, char **argv)
 #endif
 	
 	switch (event->response_type - event_base) {
-	case XCBRandRScreenChangeNotify:
-	  sce = (XCBRandRScreenChangeNotifyEvent *) event;
+	case XCB_RANDR_SCREEN_CHANGE_NOTIFY:
+	  sce = (xcb_randr_screen_change_notify_event_t *) event;
 
 	  printf("Got a screen change notify event!\n");
 	  printf(" window = %d\n root = %d\n size_index = %d\n rotation %d\n", 
@@ -434,7 +435,7 @@ main (int argc, char **argv)
 	  else printf ("new Subpixel rendering model is %s\n", order[spo]);
 	  break;
 	default:
-	  if (event->response_type == XCBConfigureNotify)
+	  if (event->response_type == XCB_CONFIGURE_NOTIFY)
 	    printf("Received ConfigureNotify Event!\n");
           else
 	    printf("unknown event received, type = %d!\n", event->response_type);
@@ -447,6 +448,6 @@ main (int argc, char **argv)
 #endif
   free(sc);
   free(rr_version);
-  XCBDisconnect(c);
+  xcb_disconnect(c);
   return(0);
 }
diff --git a/xcb-demo/xcbxf86dri.c b/xcb-demo/xcbxf86dri.c
index e471431..60672f1 100644
--- a/xcb-demo/xcbxf86dri.c
+++ b/xcb-demo/xcbxf86dri.c
@@ -9,11 +9,11 @@
 int main(int argc, char **argv)
 {
     int screen;
-    XCBXF86DriQueryVersionCookie qvc;
-    XCBXF86DriQueryVersionRep *qv;
-    XCBXF86DriQueryDirectRenderingCapableCookie qdrc;
-    XCBXF86DriQueryDirectRenderingCapableRep *qdr;
-    XCBConnection *c = XCBConnect(NULL, &screen);
+    xcb_xf86dri_query_version_cookie_t qvc;
+    xcb_xf86dri_query_version_reply_t *qv;
+    xcb_xf86dri_query_direct_rendering_capable_cookie_t qdrc;
+    xcb_xf86dri_query_direct_rendering_capable_reply_t *qdr;
+    xcb_connection_t *c = xcb_connect(NULL, &screen);
 
     if(!c)
     {
@@ -21,10 +21,10 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    qvc  = XCBXF86DriQueryVersion(c);
-    qdrc = XCBXF86DriQueryDirectRenderingCapable(c, screen);
+    qvc  = xcb_xf86dri_query_version(c);
+    qdrc = xcb_xf86dri_query_direct_rendering_capable(c, screen);
 
-    qv  = XCBXF86DriQueryVersionReply(c, qvc, 0);
+    qv  = xcb_xf86dri_query_version_reply(c, qvc, 0);
     if(!qv)
     {
         fprintf(stderr, "Error querying DRI extension version.\n");
@@ -34,7 +34,7 @@ int main(int argc, char **argv)
            qv->dri_major_version, qv->dri_minor_version, qv->dri_minor_patch);
     free(qv);
 
-    qdr = XCBXF86DriQueryDirectRenderingCapableReply(c, qdrc, 0);
+    qdr = xcb_xf86dri_query_direct_rendering_capable_reply(c, qdrc, 0);
     if(!qdr)
     {
         fprintf(stderr, "Error querying direct rendering capability.\n");
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
            screen, qdr->is_capable ? "yes" : "no");
     free(qdr);
 
-    XCBDisconnect(c);
+    xcb_disconnect(c);
 
     return 0;
 }
diff --git a/xcb-demo/xcbxvinfo.c b/xcb-demo/xcbxvinfo.c
index f2341e4..336708e 100644
--- a/xcb-demo/xcbxvinfo.c
+++ b/xcb-demo/xcbxvinfo.c
@@ -11,10 +11,10 @@ static void PrintUsage()
     exit(0);
 }
 
-XCBSCREEN *ScreenOfDisplay (XCBConnection *c, int screen)
+xcb_screen_t *ScreenOfDisplay (xcb_connection_t *c, int screen)
 {
-    XCBSCREENIter iter = XCBSetupRootsIter (XCBGetSetup (c));
-    for (; iter.rem; --screen, XCBSCREENNext (&iter))
+    xcb_screen_iterator_t iter = xcb_setup_roots_iterator (xcb_get_setup (c));
+    for (; iter.rem; --screen, xcb_screen_next (&iter))
         if (screen == 0)
             return iter.data;
     return NULL;
@@ -45,20 +45,20 @@ static char *ExtractString(char *s, int 
 
 int main(int argc, char *argv[])
 {
-    XCBConnection *c;
+    xcb_connection_t *c;
     int scrn;
     char *display_name = NULL;
     char *name = NULL;
-    XCBWINDOW root_window = {0};
-    XCBSCREEN *screen;
-    XCBXvQueryExtensionRep *query_ext;
-    XCBXvQueryAdaptorsRep *adaptors_rep;
-    XCBXvAdaptorInfoIter adaptors_iter;
-    XCBXvAdaptorInfo *ainfo;
-    XCBXvFormat *format;
-    XCBXvQueryPortAttributesRep *attr_rep;
-    XCBXvAttributeInfoIter attr_iter;
-    XCBXvAttributeInfo *attribute;
+    xcb_window_t root_window = {0};
+    xcb_screen_t *screen;
+    xcb_xv_query_extension_reply_t *query_ext;
+    xcb_xv_query_adaptors_reply_t *adaptors_rep;
+    xcb_xv_adaptor_info_iterator_t adaptors_iter;
+    xcb_xv_adaptor_info_t *ainfo;
+    xcb_xv_format_t *format;
+    xcb_xv_query_port_attributes_reply_t *attr_rep;
+    xcb_xv_attribute_info_iterator_t attr_iter;
+    xcb_xv_attribute_info_t *attribute;
 
     int nscreens, nattr, i, j, k;
 
@@ -72,13 +72,13 @@ int main(int argc, char *argv[])
     }
 
     if (!display_name) display_name = getenv("DISPLAY");
-    if (!(c = XCBConnect(display_name, &scrn)))
+    if (!(c = xcb_connect(display_name, &scrn)))
     {
         fprintf(stderr, "xcbxvinfo: Unable to open display %s\n", display_name);
         exit(1);
     }
 
-    if (!(query_ext = XCBXvQueryExtensionReply(c, XCBXvQueryExtension(c), NULL)))
+    if (!(query_ext = xcb_xv_query_extension_reply(c, xcb_xv_query_extension(c), NULL)))
     {
         fprintf(stderr, "xvinfo: No X-Video extension on %s\n", display_name);
         exit(0);
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
 
     free(query_ext);
 
-    nscreens = XCBSetupRootsLength(XCBGetSetup(c));
+    nscreens = xcb_setup_roots_length(xcb_get_setup(c));
 
     for (i = 0; i < nscreens; i++)
     {
@@ -99,38 +99,38 @@ int main(int argc, char *argv[])
         screen = ScreenOfDisplay(c, scrn);
         if (screen) root_window = screen->root;
 
-        adaptors_rep = XCBXvQueryAdaptorsReply(c, XCBXvQueryAdaptors(c, root_window), NULL);
+        adaptors_rep = xcb_xv_query_adaptors_reply(c, xcb_xv_query_adaptors(c, root_window), NULL);
         if (!adaptors_rep->num_adaptors) {
             fprintf(stdout, " no adaptors present.\n");
             free(adaptors_rep);
             continue;
         }
 
-        adaptors_iter = XCBXvQueryAdaptorsInfoIter(adaptors_rep);
+        adaptors_iter = xcb_xv_query_adaptors_info_iterator(adaptors_rep);
 
         for (j = 0; j < adaptors_rep->num_adaptors; j++)
         {
             ainfo = adaptors_iter.data;
-            name = ExtractString(XCBXvAdaptorInfoName(ainfo), XCBXvAdaptorInfoNameLength(ainfo));
+            name = ExtractString(xcb_xv_adaptor_info_name(ainfo), xcb_xv_adaptor_info_name_length(ainfo));
             fprintf(stdout, "  Adaptor #%i: \"%s\"\n", j, name);
             fprintf(stdout, "    number of ports: %i\n", ainfo->num_ports);
             fprintf(stdout, "    port base: %i\n", ainfo->base_id.xid);
             fprintf(stdout, "    operations supported: ");
             free(name);
 
-            switch(ainfo->type & (XCBXvTypeInputMask | XCBXvTypeOutputMask)) {
-                case XCBXvTypeInputMask:
-                    if (ainfo->type & XCBXvTypeVideoMask)
+            switch(ainfo->type & (XCB_XV_TYPE_INPUT_MASK | XCB_XV_TYPE_OUTPUT_MASK)) {
+                case XCB_XV_TYPE_INPUT_MASK:
+                    if (ainfo->type & XCB_XV_TYPE_VIDEO_MASK)
                         fprintf(stdout, "PutVideo ");
-                    if (ainfo->type & XCBXvTypeStillMask)
+                    if (ainfo->type & XCB_XV_TYPE_STILL_MASK)
                         fprintf(stdout, "PutStill ");
-                    if (ainfo->type & XCBXvTypeImageMask)
+                    if (ainfo->type & XCB_XV_TYPE_IMAGE_MASK)
                         fprintf(stdout, "PutImage ");
                     break;
-                case XCBXvTypeOutputMask:
-                    if (ainfo->type & XCBXvTypeVideoMask)
+                case XCB_XV_TYPE_OUTPUT_MASK:
+                    if (ainfo->type & XCB_XV_TYPE_VIDEO_MASK)
                         fprintf(stdout, "GetVideo ");
-                    if (ainfo->type & XCBXvTypeStillMask)
+                    if (ainfo->type & XCB_XV_TYPE_STILL_MASK)
                         fprintf(stdout, "GetStill ");
                     break;
                 default:
@@ -139,17 +139,17 @@ int main(int argc, char *argv[])
             }
             fprintf(stdout, "\n");
 
-            format = XCBXvAdaptorInfoFormats(ainfo);
+            format = xcb_xv_adaptor_info_formats(ainfo);
 
             fprintf(stdout, "    supported visuals:\n");
             for (k=0; k < ainfo->num_formats; k++, format++)
                 fprintf(stdout, "      depth %i, visualID 0x%2x\n",
                         format->depth, format->visual.id);
 
-            attr_rep = XCBXvQueryPortAttributesReply(c,
-                    XCBXvQueryPortAttributes(c, ainfo->base_id), NULL);
+            attr_rep = xcb_xv_query_port_attributes_reply(c,
+                    xcb_xv_query_port_attributes(c, ainfo->base_id), NULL);
             nattr = attr_rep->num_attributes;
-            attr_iter = XCBXvQueryPortAttributesAttributesIter(attr_rep);
+            attr_iter = xcb_xv_query_port_attributes_attributes_iterator(attr_rep);
 
             if (nattr) {            
                 fprintf(stdout, "    number of attributes: %i\n", nattr);
@@ -157,32 +157,32 @@ int main(int argc, char *argv[])
                 for (k = 0; k < nattr; k++) {
                     attribute = attr_iter.data;
                     fprintf(stdout, "      \"%s\" (range %i to %i)\n",
-                            XCBXvAttributeInfoName(attribute),
+                            xcb_xv_attribute_info_name(attribute),
                             attribute->min,
                             attribute->max);
 
-                    if (attribute->flags & XCBXvAttributeFlagSettable)
+                    if (attribute->flags & XCB_XV_ATTRIBUTE_FLAG_SETTABLE)
                         fprintf(stdout, "              client settable attribute\n");
 
-                    if (attribute->flags & XCBXvAttributeFlagGettable) {
-                        XCBATOM the_atom;
-                        XCBInternAtomRep *atom_rep;
+                    if (attribute->flags & XCB_XV_ATTRIBUTE_FLAG_GETTABLE) {
+                        xcb_atom_t the_atom;
+                        xcb_intern_atom_reply_t *atom_rep;
 
                         fprintf(stdout, "              client gettable attribute");
 
-                        atom_rep = XCBInternAtomReply(c,
-                                XCBInternAtom(c,
+                        atom_rep = xcb_intern_atom_reply(c,
+                                xcb_intern_atom(c,
                                     1, 
-                                    /*XCBXvAttributeInfoNameLength(attribute),*/
-                                    strlen(XCBXvAttributeInfoName(attribute)),
-                                    XCBXvAttributeInfoName(attribute)),
+                                    /*xcb_xv_attribute_info_name_length(attribute),*/
+                                    strlen(xcb_xv_attribute_info_name(attribute)),
+                                    xcb_xv_attribute_info_name(attribute)),
                                 NULL);
                         the_atom = atom_rep->atom;
 
                         if (the_atom.xid != 0) {
-                            XCBXvGetPortAttributeRep *pattr_rep =
-                                XCBXvGetPortAttributeReply(c,
-                                        XCBXvGetPortAttribute(c, ainfo->base_id, the_atom),
+                            xcb_xv_get_port_attribute_reply_t *pattr_rep =
+                                xcb_xv_get_port_attribute_reply(c,
+                                        xcb_xv_get_port_attribute(c, ainfo->base_id, the_atom),
                                         NULL);
                             if (pattr_rep) fprintf(stdout, " (current value is %i)", pattr_rep->value);
                             free(pattr_rep);
@@ -190,28 +190,28 @@ int main(int argc, char *argv[])
                         fprintf(stdout, "\n");
                         free(atom_rep);
                     }
-                    XCBXvAttributeInfoNext(&attr_iter);
+                    xcb_xv_attribute_info_next(&attr_iter);
                 }
             }
             else {
                 fprintf(stdout, "    no port attributes defined\n");
             }
 
-            XCBXvQueryEncodingsRep *qencodings_rep;
-            qencodings_rep = XCBXvQueryEncodingsReply(c, XCBXvQueryEncodings(c, ainfo->base_id), NULL);
+            xcb_xv_query_encodings_reply_t *qencodings_rep;
+            qencodings_rep = xcb_xv_query_encodings_reply(c, xcb_xv_query_encodings(c, ainfo->base_id), NULL);
             int nencode = qencodings_rep->num_encodings;
-            XCBXvEncodingInfoIter encoding_iter = XCBXvQueryEncodingsInfoIter(qencodings_rep);
-            XCBXvEncodingInfo *encoding;
+            xcb_xv_encoding_info_iterator_t encoding_iter = xcb_xv_query_encodings_info_iterator(qencodings_rep);
+            xcb_xv_encoding_info_t *encoding;
 
             int ImageEncodings = 0;
             if (nencode) {
                 int n;
                 for (n = 0; n < nencode; n++) {
                     encoding = encoding_iter.data;
-                    name = ExtractString(XCBXvEncodingInfoName(encoding), XCBXvEncodingInfoNameLength(encoding));
+                    name = ExtractString(xcb_xv_encoding_info_name(encoding), xcb_xv_encoding_info_name_length(encoding));
                     if (!nstrcmp(name, strlen(name), "XV_IMAGE"))
                         ImageEncodings++;
-                    XCBXvEncodingInfoNext(&encoding_iter);
+                    xcb_xv_encoding_info_next(&encoding_iter);
                     free(name);
                 }
 
@@ -219,10 +219,10 @@ int main(int argc, char *argv[])
                     fprintf(stdout, "    number of encodings: %i\n", nencode - ImageEncodings);
 
                     /* Reset the iter. */
-                    encoding_iter = XCBXvQueryEncodingsInfoIter(qencodings_rep);
+                    encoding_iter = xcb_xv_query_encodings_info_iterator(qencodings_rep);
                     for(n = 0; n < nencode; n++) {
                         encoding = encoding_iter.data;
-                        name = ExtractString(XCBXvEncodingInfoName(encoding), XCBXvEncodingInfoNameLength(encoding));
+                        name = ExtractString(xcb_xv_encoding_info_name(encoding), xcb_xv_encoding_info_name_length(encoding));
                         if(nstrcmp(name, strlen(name), "XV_IMAGE")) {
                             fprintf(stdout,
                                     "      encoding ID #%i: \"%*s\"\n",
@@ -237,16 +237,16 @@ int main(int argc, char *argv[])
                                     (float)encoding->rate.denominator);
                             free(name);
                         }
-                        XCBXvEncodingInfoNext(&encoding_iter);
+                        xcb_xv_encoding_info_next(&encoding_iter);
                     }
                 }
 
-                if(ImageEncodings && (ainfo->type & XCBXvTypeImageMask)) {
+                if(ImageEncodings && (ainfo->type & XCB_XV_TYPE_IMAGE_MASK)) {
                     char imageName[5] = {0, 0, 0, 0, 0};
-                    encoding_iter = XCBXvQueryEncodingsInfoIter(qencodings_rep);
+                    encoding_iter = xcb_xv_query_encodings_info_iterator(qencodings_rep);
                     for(n = 0; n < nencode; n++) {
                         encoding = encoding_iter.data;
-                        name = ExtractString(XCBXvEncodingInfoName(encoding), XCBXvEncodingInfoNameLength(encoding));
+                        name = ExtractString(xcb_xv_encoding_info_name(encoding), xcb_xv_encoding_info_name_length(encoding));
                         if(!nstrcmp(name, strlen(name), "XV_IMAGE")) {
                             fprintf(stdout, 
                                     "    maximum XvImage size: %i x %i\n",	
@@ -255,14 +255,14 @@ int main(int argc, char *argv[])
                         }
                         free(name);
                     }
-                    XCBXvListImageFormatsRep *formats_rep;
-                    formats_rep = XCBXvListImageFormatsReply(c,
-                            XCBXvListImageFormats(c, ainfo->base_id),
+                    xcb_xv_list_image_formats_reply_t *formats_rep;
+                    formats_rep = xcb_xv_list_image_formats_reply(c,
+                            xcb_xv_list_image_formats(c, ainfo->base_id),
                             NULL);
 
                     int numImages = formats_rep->num_formats;
-                    XCBXvImageFormatInfo *format;
-                    XCBXvImageFormatInfoIter formats_iter = XCBXvListImageFormatsFormatIter(formats_rep);
+                    xcb_xv_image_format_info_t *format;
+                    xcb_xv_image_format_info_iterator_t formats_iter = xcb_xv_list_image_formats_format_iterator(formats_rep);
                     fprintf(stdout, "    Number of image formats: %i\n",
                             numImages);
 
@@ -316,10 +316,10 @@ int main(int argc, char *argv[])
                         fprintf(stdout, "        number of planes: %i\n",
                                 format->num_planes);
                         fprintf(stdout, "        type: %s (%s)\n", 
-                                (format->type == XCBXvImageFormatInfoTypeRGB) ? "RGB" : "YUV",
-                                (format->format == XCBXvImageFormatInfoFormatPacked) ? "packed" : "planar");
+                                (format->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB) ? "RGB" : "YUV",
+                                (format->format == XCB_XV_IMAGE_FORMAT_INFO_FORMAT_PACKED) ? "packed" : "planar");
 
-                        if(format->type == XCBXvImageFormatInfoTypeRGB) {
+                        if(format->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB) {
                             fprintf(stdout, "        depth: %i\n", 
                                     format->depth);
 
@@ -331,13 +331,13 @@ int main(int argc, char *argv[])
                         } else {
 
                         }
-                        XCBXvImageFormatInfoNext(&formats_iter);
+                        xcb_xv_image_format_info_next(&formats_iter);
                     }
                     free(formats_rep);
                 }
             }
             free(qencodings_rep);
-            XCBXvAdaptorInfoNext(&adaptors_iter);
+            xcb_xv_adaptor_info_next(&adaptors_iter);
         }
         free(adaptors_rep);
     }
diff-tree 81bd5f94f9538c020eca114025181c85e2559f7b (from 96edbb16f3a93ac6a10a3c524b10df4f2b3bcd00)
Author: Ian Osgood <iano at quirkster.com>
Date:   Sun Sep 24 14:10:20 2006 -0700

    Add XCBAllPlanes from xcb-image util library.

diff --git a/xcb/tools/constants b/xcb/tools/constants
index e691bf2..1685600 100644
--- a/xcb/tools/constants
+++ b/xcb/tools/constants
@@ -570,3 +570,4 @@ XCBMapIndex2
 XCBMapIndex3
 XCBMapIndex4
 XCBMapIndex5
+XCBAllPlanes
\ No newline at end of file


More information about the xcb-commit mailing list