[Xcb-commit] xcb xcb-proto

Josh Triplett josh at kemper.freedesktop.org
Sat Sep 23 12:22:42 PDT 2006


 xcb-proto/src/extensions/glx.xml    |   48 ++--
 xcb-proto/src/extensions/shape.xml  |   28 +-
 xcb-proto/src/extensions/xfixes.xml |    4 
 xcb/src/c-client.xsl                |  426 ++++++++++++++++++++++--------------
 xcb/src/xcb.h                       |  146 ++++++------
 xcb/src/xcb_auth.c                  |    6 
 xcb/src/xcb_conn.c                  |   60 ++---
 xcb/src/xcb_ext.c                   |   22 -
 xcb/src/xcb_in.c                    |   72 +++---
 xcb/src/xcb_list.c                  |    2 
 xcb/src/xcb_out.c                   |   52 ++--
 xcb/src/xcb_util.c                  |   28 +-
 xcb/src/xcb_xid.c                   |   12 -
 xcb/src/xcb_xlib.c                  |    4 
 xcb/src/xcbext.h                    |   22 -
 xcb/src/xcbint.h                    |   42 +--
 xcb/src/xcbxlib.h                   |    4 
 17 files changed, 546 insertions(+), 432 deletions(-)

New commits:
diff-tree 5e9f3ffd4cec3a66bbe1e6bfe930915a34b9364e (from c84b535a2d7561babce1ce2e163081c9fd08cbbd)
Author: Josh Triplett <josh at freedesktop.org>
Date:   Sat Sep 23 12:22:22 2006 -0700

    The Great XCB Renaming
    
    Rename API to follow a new naming convention:
    * XCB_CONSTANTS_UPPERCASE_WITH_UNDERSCORES
    * xcb_functions_lowercase_with_underscores
    * xcb_types_lowercase_with_underscores_and_suffix_t
    * expand all abbreviations like "req", "rep", and "iter"
    
    Word boundaries for the names in the protocol descriptions fall:
    * Wherever the protocol descriptions already have an underscore
    * Between a lowercase letter and a subsequent uppercase letter
    * Before the last uppercase letter in a string of uppercase letters followed
      by a lowercase letter (such as in LSBFirst between LSB and First)
    * Before and after a string of digits (with exceptions for sized types like
      xcb_char2b_t and xcb_glx_float32_t to match the stdint.h convention)
    
    Also fix up some particular naming issues:
    * Rename shape_op and shape_kind to drop the "shape_" prefix, since otherwise
      these types end up as xcb_shape_shape_{op,kind}_t.
    * Remove leading underscores from enums in the GLX protocol description,
      previously needed to ensure a word separator, but now redundant.
    
    This renaming breaks code written for the previous API naming convention.  The
    scripts in XCB's tools directory will convert code written for the old API to
    use the new API; they work well enough that we used them to convert the
    non-program-generated code in XCB, and when run on the old program-generated
    code, they almost exactly reproduce the new program-generated code (modulo
    whitespace and bugs in the old code generator).
    
    Authors: Vincent Torri, Thomas Hunger, Josh Triplett

diff --git a/xcb-proto/src/extensions/glx.xml b/xcb-proto/src/extensions/glx.xml
index 2e22c77..ba5c253 100644
--- a/xcb-proto/src/extensions/glx.xml
+++ b/xcb-proto/src/extensions/glx.xml
@@ -198,27 +198,27 @@ The patch that fixed this server bug in 
 
 	<!-- Enum for CopyContext: mask -->
 	<enum name="GC">
-		<item name="_GL_CURRENT_BIT"><value>0x00000001</value></item>
-		<item name="_GL_POINT_BIT"><value>0x00000002</value></item>
-		<item name="_GL_LINE_BIT"><value>0x00000004</value></item>
-		<item name="_GL_POLYGON_BIT"><value>0x00000008</value></item>
-		<item name="_GL_POLYGON_STIPPLE_BIT"><value>0x00000010</value></item>
-		<item name="_GL_PIXEL_MODE_BIT"><value>0x00000020</value></item>
-		<item name="_GL_LIGHTING_BIT"><value>0x00000040</value></item>
-		<item name="_GL_FOG_BIT"><value>0x00000080</value></item>
-		<item name="_GL_DEPTH_BUFFER_BIT"><value>0x00000100</value></item>
-		<item name="_GL_ACCUM_BUFFER_BIT"><value>0x00000200</value></item>
-		<item name="_GL_STENCIL_BUFFER_BIT"><value>0x00000400</value></item>
-		<item name="_GL_VIEWPORT_BIT"><value>0x00000800</value></item>
-		<item name="_GL_TRANSFORM_BIT"><value>0x00001000</value></item>
-		<item name="_GL_ENABLE_BIT"><value>0x00002000</value></item>
-		<item name="_GL_COLOR_BUFFER_BIT"><value>0x00004000</value></item>
-		<item name="_GL_HINT_BIT"><value>0x00008000</value></item>
-		<item name="_GL_EVAL_BIT"><value>0x00010000</value></item>
-		<item name="_GL_LIST_BIT"><value>0x00020000</value></item>
-		<item name="_GL_TEXTURE_BIT"><value>0x00040000</value></item>
-		<item name="_GL_SCISSOR_BIT"><value>0x00080000</value></item>
-		<item name="_GL_ALL_ATTRIB_BITS"><value>0x000ffffff</value></item>
+		<item name="GL_CURRENT_BIT"><value>0x00000001</value></item>
+		<item name="GL_POINT_BIT"><value>0x00000002</value></item>
+		<item name="GL_LINE_BIT"><value>0x00000004</value></item>
+		<item name="GL_POLYGON_BIT"><value>0x00000008</value></item>
+		<item name="GL_POLYGON_STIPPLE_BIT"><value>0x00000010</value></item>
+		<item name="GL_PIXEL_MODE_BIT"><value>0x00000020</value></item>
+		<item name="GL_LIGHTING_BIT"><value>0x00000040</value></item>
+		<item name="GL_FOG_BIT"><value>0x00000080</value></item>
+		<item name="GL_DEPTH_BUFFER_BIT"><value>0x00000100</value></item>
+		<item name="GL_ACCUM_BUFFER_BIT"><value>0x00000200</value></item>
+		<item name="GL_STENCIL_BUFFER_BIT"><value>0x00000400</value></item>
+		<item name="GL_VIEWPORT_BIT"><value>0x00000800</value></item>
+		<item name="GL_TRANSFORM_BIT"><value>0x00001000</value></item>
+		<item name="GL_ENABLE_BIT"><value>0x00002000</value></item>
+		<item name="GL_COLOR_BUFFER_BIT"><value>0x00004000</value></item>
+		<item name="GL_HINT_BIT"><value>0x00008000</value></item>
+		<item name="GL_EVAL_BIT"><value>0x00010000</value></item>
+		<item name="GL_LIST_BIT"><value>0x00020000</value></item>
+		<item name="GL_TEXTURE_BIT"><value>0x00040000</value></item>
+		<item name="GL_SCISSOR_BIT"><value>0x00080000</value></item>
+		<item name="GL_ALL_ATTRIB_BITS"><value>0x000ffffff</value></item>
 	</enum>
 
 	<request name="SwapBuffers" opcode="11">
@@ -491,9 +491,9 @@ The patch that fixed this server bug in 
 	</request>
 
 	<enum name="RM">
-		<item name="_GL_RENDER"><value>0x1C00</value></item>
-		<item name="_GL_FEEDBACK"><value>0x1C01</value></item>
-		<item name="_GL_SELECT"><value>0x1C02</value></item>
+		<item name="GL_RENDER"><value>0x1C00</value></item>
+		<item name="GL_FEEDBACK"><value>0x1C01</value></item>
+		<item name="GL_SELECT"><value>0x1C02</value></item>
 	</enum>
 
 	<request name="Finish" opcode="108">
diff --git a/xcb-proto/src/extensions/shape.xml b/xcb-proto/src/extensions/shape.xml
index 36fb84b..8afbff7 100644
--- a/xcb-proto/src/extensions/shape.xml
+++ b/xcb-proto/src/extensions/shape.xml
@@ -27,10 +27,10 @@ authorization from the authors.
 -->
 <!-- This file describes version 1.1 of the Shape extension. -->
 <xcb header="shape" extension-xname="SHAPE" extension-name="Shape">
-  <typedef oldname="CARD8" newname="SHAPE_OP" />
-  <typedef oldname="CARD8" newname="SHAPE_KIND" />
+  <typedef oldname="CARD8" newname="OP" />
+  <typedef oldname="CARD8" newname="KIND" />
 
-  <!-- Shape attributes of type SHAPE_OP. -->
+  <!-- Shape attributes of type OP. -->
   <enum name="SO">
     <item name="Set" />
     <item name="Union" />
@@ -39,7 +39,7 @@ authorization from the authors.
     <item name="Invert" />
   </enum>
 
-  <!-- Shape attributes of type SHAPE_KIND. -->
+  <!-- Shape attributes of type KIND. -->
   <enum name="SK">
     <item name="Bounding" />
     <item name="Clip" />
@@ -47,7 +47,7 @@ authorization from the authors.
   </enum>
 
   <event name="Notify" number="0">
-    <field type="SHAPE_KIND" name="shape_kind" />
+    <field type="KIND" name="shape_kind" />
     <field type="WINDOW" name="affected_window" />
     <field type="INT16" name="extents_x" />
     <field type="INT16" name="extents_y" />
@@ -66,8 +66,8 @@ authorization from the authors.
   </request>
 
   <request name="Rectangles" opcode="1">
-    <field type="SHAPE_OP" name="operation" />
-    <field type="SHAPE_KIND" name="destination_kind" />
+    <field type="OP" name="operation" />
+    <field type="KIND" name="destination_kind" />
     <field type="BYTE" name="ordering" />
     <pad bytes="1" />
     <field type="WINDOW" name="destination_window" />
@@ -77,8 +77,8 @@ authorization from the authors.
   </request>
 
   <request name="Mask" opcode="2">
-    <field type="SHAPE_OP" name="operation" />
-    <field type="SHAPE_KIND" name="destination_kind" />
+    <field type="OP" name="operation" />
+    <field type="KIND" name="destination_kind" />
     <pad bytes="2" />
     <field type="WINDOW" name="destination_window" />
     <field type="INT16" name="x_offset" />
@@ -87,9 +87,9 @@ authorization from the authors.
   </request>
 
   <request name="Combine" opcode="3">
-    <field type="SHAPE_OP" name="operation" />
-    <field type="SHAPE_KIND" name="destination_kind" />
-    <field type="SHAPE_KIND" name="source_kind" />
+    <field type="OP" name="operation" />
+    <field type="KIND" name="destination_kind" />
+    <field type="KIND" name="source_kind" />
     <pad bytes="1" />
     <field type="WINDOW" name="destination_window" />
     <field type="INT16" name="x_offset" />
@@ -98,7 +98,7 @@ authorization from the authors.
   </request>
 
   <request name="Offset" opcode="4">
-    <field type="SHAPE_KIND" name="destination_kind" />
+    <field type="KIND" name="destination_kind" />
     <pad bytes="3" />
     <field type="WINDOW" name="destination_window" />
     <field type="INT16" name="x_offset" />
@@ -137,7 +137,7 @@ authorization from the authors.
 
   <request name="GetRectangles" opcode="8">
     <field type="WINDOW" name="window" />
-    <field type="SHAPE_KIND" name="source_kind" />
+    <field type="KIND" name="source_kind" />
     <reply>
       <field type="BYTE" name="ordering" />
       <field type="CARD32" name="rectangles_len" />
diff --git a/xcb-proto/src/extensions/xfixes.xml b/xcb-proto/src/extensions/xfixes.xml
index b82c63b..9bd14e3 100644
--- a/xcb-proto/src/extensions/xfixes.xml
+++ b/xcb-proto/src/extensions/xfixes.xml
@@ -153,7 +153,7 @@ authorization from the authors.
   <request name="CreateRegionFromWindow" opcode="7">
     <field type="REGION"     name="region" />
     <field type="WINDOW"     name="window" />
-    <field type="SHAPE_KIND" name="kind" />
+    <field type="shape:KIND" name="kind" />
     <pad bytes="3" />
   </request>
 
@@ -235,7 +235,7 @@ authorization from the authors.
 
   <request name="SetWindowShapeRegion" opcode="21">
     <field type="WINDOW"     name="dest" />
-    <field type="SHAPE_KIND" name="dest_kind" />
+    <field type="shape:KIND" name="dest_kind" />
     <pad bytes="3" />
     <field type="INT16"      name="x_offset" />
     <field type="INT16"      name="y_offset" />
diff --git a/xcb/src/c-client.xsl b/xcb/src/c-client.xsl
index 218e093..188e8b0 100644
--- a/xcb/src/c-client.xsl
+++ b/xcb/src/c-client.xsl
@@ -26,7 +26,11 @@ authorization from the authors.
 -->
 <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0"
-               xmlns:e="http://exslt.org/common">
+               xmlns:e="http://exslt.org/common"
+               xmlns:func="http://exslt.org/functions"
+               xmlns:str="http://exslt.org/strings"
+               xmlns:xcb="http://xcb.freedesktop.org"
+               extension-element-prefixes="func str xcb">
   
   <xsl:output method="text" />
 
@@ -49,6 +53,8 @@ authorization from the authors.
 
   <xsl:variable name="ucase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
   <xsl:variable name="lcase" select="'abcdefghijklmnopqrstuvwxyz'" />
+  <xsl:variable name="letters" select="concat($ucase, $lcase)" />
+  <xsl:variable name="digits" select="'0123456789'" />
 
   <xsl:variable name="header" select="/xcb/@header" />
   <xsl:variable name="ucase-header"
@@ -80,19 +86,134 @@ authorization from the authors.
     <xcb>
       <xsl:copy-of select="@*" />
       <xsl:if test="$ext">
-        <constant type="XCBExtension" name="XCB{$ext}Id">
+        <constant type="xcb_extension_t" name="{xcb:xcb-prefix()}_id">
           <xsl:attribute name="value">{ "<xsl:value-of select="@extension-xname" />" }</xsl:attribute>
         </constant>
-        <function type="const XCBQueryExtensionRep *" name="XCB{$ext}Init">
-          <field type="XCBConnection *" name="c" />
-          <l>return XCBGetExtensionData(c, &amp;XCB<!--
-          --><xsl:value-of select="$ext" />Id);</l>
+        <function type="const xcb_query_extension_reply_t *" name="{xcb:xcb-prefix('init')}">
+          <field type="xcb_connection_t *" name="c" />
+          <l>return xcb_get_extension_data(c, &amp;<!--
+          --><xsl:value-of select="xcb:xcb-prefix()" />_id);</l>
         </function>
       </xsl:if>
       <xsl:apply-templates mode="pass1" />
     </xcb>
   </xsl:template>
 
+  <func:function name="xcb:xcb-prefix">
+    <xsl:param name="name" />
+    <func:result>
+      <xsl:text>xcb</xsl:text>
+      <xsl:choose>
+        <xsl:when test="/xcb/@extension-name = 'RandR'">
+          <xsl:text>_randr</xsl:text>
+        </xsl:when>
+        <xsl:when test="/xcb/@extension-name = 'ScreenSaver'">
+          <xsl:text>_screensaver</xsl:text>
+        </xsl:when>
+        <xsl:when test="/xcb/@extension-name = 'XF86Dri'">
+          <xsl:text>_xf86dri</xsl:text>
+        </xsl:when>
+        <xsl:when test="/xcb/@extension-name = 'XFixes'">
+          <xsl:text>_xfixes</xsl:text>
+        </xsl:when>
+        <xsl:when test="/xcb/@extension-name = 'XvMC'">
+          <xsl:text>_xvmc</xsl:text>
+        </xsl:when>
+        <xsl:when test="/xcb/@extension-name">
+          <xsl:text>_</xsl:text>
+          <xsl:call-template name="camelcase-to-underscore">
+            <xsl:with-param name="camelcase" select="/xcb/@extension-name" />
+          </xsl:call-template>
+        </xsl:when>
+        <xsl:otherwise>
+        </xsl:otherwise>
+      </xsl:choose>
+      <xsl:if test="$name">
+        <xsl:text>_</xsl:text>
+        <xsl:call-template name="camelcase-to-underscore">
+          <xsl:with-param name="camelcase" select="$name" />
+        </xsl:call-template>
+      </xsl:if>
+    </func:result>
+  </func:function>
+
+  <func:function name="xcb:lowercase">
+    <xsl:param name="name" />
+    <func:result>
+      <xsl:call-template name="camelcase-to-underscore">
+        <xsl:with-param name="camelcase" select="$name" />
+      </xsl:call-template>
+    </func:result>
+  </func:function>
+
+  <func:function name="xcb:get-char-void">
+    <xsl:param name="name" />
+    <xsl:variable name="ctype" select="substring-before($name, '_t')" />
+    <func:result>
+      <xsl:choose>
+        <xsl:when test="$ctype = 'char' or $ctype = 'void' or $ctype = 'float' or $ctype = 'double'">
+          <xsl:value-of select="$ctype" />    
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$name" />
+        </xsl:otherwise>
+      </xsl:choose>
+    </func:result>
+  </func:function>
+
+  <func:function name="xcb:remove-void">
+    <xsl:param name="name" />
+    <xsl:variable name="ctype" select="substring-before($name, '_t')" />
+    <func:result>
+      <xsl:choose>
+        <xsl:when test="$ctype = 'char' or $ctype = 'void' or $ctype = 'float' or $ctype = 'double'">
+          <xsl:choose>
+            <xsl:when test="$ctype = 'void'">
+              <xsl:text>char</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:value-of select="$ctype" />
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="$name" />
+        </xsl:otherwise>
+      </xsl:choose>
+    </func:result>
+  </func:function>
+
+  <!-- split camel case into words and insert underscore -->
+  <xsl:template name="camelcase-to-underscore">
+    <xsl:param name="camelcase"/>
+    <xsl:choose>
+      <xsl:when test="$camelcase='CHAR2B' or $camelcase='INT64'
+                      or $camelcase='FLOAT32' or $camelcase='FLOAT64'
+                      or $camelcase='BOOL32' or $camelcase='STRING8'
+                      or $camelcase='Family_DECnet'">
+        <xsl:value-of select="translate($camelcase, $ucase, $lcase)"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:for-each select="str:split($camelcase, '')">
+          <xsl:variable name="a" select="."/>
+          <xsl:variable name="b" select="following::*[1]"/>
+          <xsl:variable name="c" select="following::*[2]"/>
+          <xsl:value-of select="translate(., $ucase, $lcase)"/>
+          <xsl:if test="($b and contains($lcase, $a) and contains($ucase, $b))
+                        or ($b and contains($digits, $a)
+                            and contains($letters, $b))
+                        or ($b and contains($letters, $a)
+                            and contains($digits, $b))
+                        or ($c and contains($ucase, $a)
+                            and contains($ucase, $b)
+                            and contains($lcase, $c))">
+            <xsl:text>_</xsl:text>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
   <!-- Modify names that conflict with C++ keywords by prefixing them with an
        underscore.  If the name parameter is not specified, it defaults to the
        value of the name attribute on the context node. -->
@@ -107,27 +228,26 @@ authorization from the authors.
 
   <!-- List of core types, for use in canonical-type-name. -->
   <xsl:variable name="core-types-rtf">
-    <type name="BOOL" />
-    <type name="BYTE" />
-    <type name="CARD8" />
-    <type name="CARD16" />
-    <type name="CARD32" />
-    <type name="INT8" />
-    <type name="INT16" />
-    <type name="INT32" />
-
-    <type name="char" />
-    <type name="void" />
-    <type name="float" />
-    <type name="double" />
-    <type name="XID" />
+    <type name="BOOL" newname="uint8" />
+    <type name="BYTE" newname="uint8" />
+    <type name="CARD8" newname="uint8" />
+    <type name="CARD16" newname="uint16" />
+    <type name="CARD32" newname="uint32" />
+    <type name="INT8" newname="int8" />
+    <type name="INT16" newname="int16" />
+    <type name="INT32" newname="int32" />
+
+    <type name="char" newname="char" />
+    <type name="void" newname="void" />
+    <type name="float" newname="float" />
+    <type name="double" newname="double" />
   </xsl:variable>
   <xsl:variable name="core-types" select="e:node-set($core-types-rtf)" />
 
   <!--
     Output the canonical name for a type.  This will be
-    XCB{extension-containing-Type-if-any}Type, wherever the type is found in
-    the search path, or just Type if not found.  If the type parameter is not
+    xcb_{extension-containing-type-if-any}_type, wherever the type is found in
+    the search path, or just type if not found.  If the type parameter is not
     specified, it defaults to the value of the type attribute on the context
     node.
   -->
@@ -149,7 +269,7 @@ authorization from the authors.
 
     <xsl:choose>
       <xsl:when test="$is-unqualified and $core-types/type[@name=$type]">
-        <xsl:value-of select="$type" />
+        <xsl:value-of select="$core-types/type[@name=$type]/@newname" />
       </xsl:when>
       <xsl:otherwise>
         <xsl:variable name="type-definitions"
@@ -165,9 +285,7 @@ authorization from the authors.
         <xsl:choose>
           <xsl:when test="count($type-definitions) = 1">
             <xsl:for-each select="$type-definitions">
-              <xsl:text>XCB</xsl:text>
-              <xsl:value-of select="concat(/xcb/@extension-name,
-                                           $unqualified-type)" />
+              <xsl:value-of select="xcb:xcb-prefix($unqualified-type)" />
             </xsl:for-each>
           </xsl:when>
           <xsl:when test="count($type-definitions) > 1">
@@ -205,16 +323,15 @@ authorization from the authors.
        context node. -->
   <xsl:template name="cookie-type">
     <xsl:param name="request" select="." />
-    <xsl:text>XCB</xsl:text>
     <xsl:choose>
       <xsl:when test="$request/reply">
-        <xsl:value-of select="concat($ext, $request/@name)" />
+        <xsl:value-of select="xcb:xcb-prefix($request/@name)" />
       </xsl:when>
       <xsl:otherwise>
-        <xsl:text>Void</xsl:text>
+        <xsl:text>xcb_void</xsl:text>
       </xsl:otherwise>
     </xsl:choose>
-    <xsl:text>Cookie</xsl:text>
+    <xsl:text>_cookie_t</xsl:text>
   </xsl:template>
 
   <xsl:template name="request-function">
@@ -222,20 +339,18 @@ authorization from the authors.
     <xsl:param name="req" />
     <function>
       <xsl:attribute name="name">
-        <xsl:text>XCB</xsl:text>
-        <xsl:value-of select="$ext" />
-        <xsl:value-of select="$req/@name" />
-        <xsl:if test="$checked='true' and not($req/reply)">Checked</xsl:if>
-        <xsl:if test="$checked='false' and $req/reply">Unchecked</xsl:if>
+        <xsl:value-of select="xcb:xcb-prefix($req/@name)" />
+        <xsl:if test="$checked='true' and not($req/reply)">_checked</xsl:if>
+        <xsl:if test="$checked='false' and $req/reply">_unchecked</xsl:if>
       </xsl:attribute>
       <xsl:attribute name="type">
         <xsl:call-template name="cookie-type">
           <xsl:with-param name="request" select="$req" />
         </xsl:call-template>
       </xsl:attribute>
-      <field type="XCBConnection *" name="c" />
+      <field type="xcb_connection_t *" name="c" />
       <xsl:apply-templates select="$req/*[not(self::reply)]" mode="param" />
-      <do-request ref="XCB{$ext}{$req/@name}Req" opcode="{$req/@opcode}"
+      <do-request ref="{xcb:xcb-prefix($req/@name)}_request_t" opcode="{$req/@opcode}"
                   checked="{$checked}">
         <xsl:if test="$req/reply">
           <xsl:attribute name="has-reply">true</xsl:attribute>
@@ -247,18 +362,18 @@ authorization from the authors.
   <xsl:template match="request" mode="pass1">
     <xsl:variable name="req" select="." />
     <xsl:if test="reply">
-      <struct name="XCB{$ext}{@name}Cookie">
+      <struct name="{xcb:xcb-prefix(@name)}_cookie_t">
         <field type="unsigned int" name="sequence" />
       </struct>
     </xsl:if>
-    <struct name="XCB{$ext}{@name}Req">
-      <field type="CARD8" name="major_opcode" no-assign="true" />
+    <struct name="{xcb:xcb-prefix(@name)}_request_t">
+      <field type="uint8_t" name="major_opcode" no-assign="true" />
       <xsl:if test="$ext">
-        <field type="CARD8" name="minor_opcode" no-assign="true" />
+        <field type="uint8_t" name="minor_opcode" no-assign="true" />
       </xsl:if>
       <xsl:apply-templates select="*[not(self::reply)]" mode="field" />
       <middle>
-        <field type="CARD16" name="length" no-assign="true" />
+        <field type="uint16_t" name="length" no-assign="true" />
       </middle>
     </struct>
     <xsl:call-template name="request-function">
@@ -270,83 +385,83 @@ authorization from the authors.
       <xsl:with-param name="req" select="$req" />
     </xsl:call-template>
     <xsl:if test="reply">
-      <struct name="XCB{$ext}{@name}Rep">
-        <field type="BYTE" name="response_type" />
+      <struct name="{xcb:xcb-prefix(@name)}_reply_t">
+        <field type="uint8_t" name="response_type" />
         <xsl:apply-templates select="reply/*" mode="field" />
         <middle>
-          <field type="CARD16" name="sequence" />
-          <field type="CARD32" name="length" />
+          <field type="uint16_t" name="sequence" />
+          <field type="uint32_t" name="length" />
         </middle>
       </struct>
-      <iterator-functions ref="XCB{$ext}{@name}" kind="Rep" />
-      <function type="XCB{$ext}{@name}Rep *" name="XCB{$ext}{@name}Reply">
-        <field type="XCBConnection *" name="c" />
+      <iterator-functions ref="{xcb:xcb-prefix(@name)}" kind="_reply" />
+      <function type="{xcb:xcb-prefix(@name)}_reply_t *" name="{xcb:xcb-prefix(@name)}_reply">
+        <field type="xcb_connection_t *" name="c" />
         <field name="cookie">
           <xsl:attribute name="type">
             <xsl:call-template name="cookie-type" />
           </xsl:attribute>
         </field>
-        <field type="XCBGenericError **" name="e" />
-        <l>return (XCB<xsl:value-of select="concat($ext, @name)" />Rep *)<!--
-        --> XCBWaitForReply(c, cookie.sequence, e);</l>
+        <field type="xcb_generic_error_t **" name="e" />
+        <l>return (<xsl:value-of select="xcb:xcb-prefix(@name)" />_reply_t *)<!--
+        --> xcb_wait_for_reply(c, cookie.sequence, e);</l>
       </function>
     </xsl:if>
   </xsl:template>
 
   <xsl:template match="xidtype" mode="pass1">
-    <struct name="XCB{$ext}{@name}">
-      <field type="CARD32" name="xid" />
+    <struct name="{xcb:xcb-prefix(@name)}_t">
+      <field type="uint32_t" name="xid" />
     </struct>
-    <iterator ref="XCB{$ext}{@name}" />
-    <iterator-functions ref="XCB{$ext}{@name}" />
-    <function type="XCB{$ext}{@name}" name="XCB{$ext}{@name}New">
-      <field type="XCBConnection *" name="c" />
-      <l>XCB<xsl:value-of select="concat($ext, @name)" /> ret;</l>
-      <l>ret.xid = XCBGenerateID(c);</l>
+    <iterator ref="{xcb:xcb-prefix(@name)}" />
+    <iterator-functions ref="{xcb:xcb-prefix(@name)}" />
+    <function type="{xcb:xcb-prefix(@name)}_t" name="{xcb:xcb-prefix(@name)}_new">
+      <field type="xcb_connection_t *" name="c" />
+      <l><xsl:value-of select="concat(xcb:xcb-prefix(@name), '_t')" /> ret;</l>
+      <l>ret.xid = xcb_generate_id(c);</l>
       <l>return ret;</l>
     </function>
   </xsl:template>
 
   <xsl:template match="struct|union" mode="pass1">
-    <struct name="XCB{$ext}{@name}">
+    <struct name="{xcb:xcb-prefix(@name)}_t">
       <xsl:if test="self::union">
         <xsl:attribute name="kind">union</xsl:attribute>
       </xsl:if>
       <xsl:apply-templates select="*" mode="field" />
     </struct>
-    <iterator ref="XCB{$ext}{@name}" />
-    <iterator-functions ref="XCB{$ext}{@name}" />
+    <iterator ref="{xcb:xcb-prefix(@name)}" />
+    <iterator-functions ref="{xcb:xcb-prefix(@name)}" />
   </xsl:template>
 
   <xsl:template match="event|eventcopy|error|errorcopy" mode="pass1">
     <xsl:variable name="suffix">
       <xsl:choose>
         <xsl:when test="self::event|self::eventcopy">
-          <xsl:text>Event</xsl:text>
+          <xsl:text>_event_t</xsl:text>
         </xsl:when>
         <xsl:when test="self::error|self::errorcopy">
-          <xsl:text>Error</xsl:text>
+          <xsl:text>_error_t</xsl:text>
         </xsl:when>
       </xsl:choose>
     </xsl:variable>
-    <constant type="number" name="XCB{$ext}{@name}" value="{@number}" />
+    <constant type="number" name="{xcb:xcb-prefix(@name)}" value="{@number}" />
     <xsl:choose>
       <xsl:when test="self::event|self::error">
-        <struct name="XCB{$ext}{@name}{$suffix}">
-          <field type="BYTE" name="response_type" />
+        <struct name="{xcb:xcb-prefix(@name)}{$suffix}">
+          <field type="uint8_t" name="response_type" />
           <xsl:if test="self::error">
-            <field type="BYTE" name="error_code" />
+            <field type="uint8_t" name="error_code" />
           </xsl:if>
           <xsl:apply-templates select="*" mode="field" />
           <xsl:if test="not(self::event and boolean(@no-sequence-number))">
             <middle>
-              <field type="CARD16" name="sequence" />
+              <field type="uint16_t" name="sequence" />
             </middle>
           </xsl:if>
         </struct>
       </xsl:when>
       <xsl:when test="self::eventcopy|self::errorcopy">
-        <typedef newname="XCB{$ext}{@name}{$suffix}">
+        <typedef newname="{xcb:xcb-prefix(@name)}{$suffix}">
           <xsl:attribute name="oldname">
             <xsl:call-template name="canonical-type-name">
               <xsl:with-param name="type" select="@ref" />
@@ -364,21 +479,23 @@ authorization from the authors.
         <xsl:call-template name="canonical-type-name">
           <xsl:with-param name="type" select="@oldname" />
         </xsl:call-template>
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="newname">
         <xsl:call-template name="canonical-type-name">
           <xsl:with-param name="type" select="@newname" />
         </xsl:call-template>
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
     </typedef>
-    <iterator ref="XCB{$ext}{@newname}" />
-    <iterator-functions ref="XCB{$ext}{@newname}" />
+    <iterator ref="{xcb:xcb-prefix(@newname)}" />
+    <iterator-functions ref="{xcb:xcb-prefix(@newname)}" />
   </xsl:template>
 
   <xsl:template match="enum" mode="pass1">
-    <enum name="XCB{$ext}{@name}">
+    <enum name="{xcb:xcb-prefix(@name)}_t">
       <xsl:for-each select="item">
-        <item name="XCB{$ext}{../@name}{@name}">
+        <item name="{translate(xcb:xcb-prefix(concat(../@name, concat('_', @name))), $lcase, $ucase)}">
           <xsl:copy-of select="*" />
         </item>
       </xsl:for-each>
@@ -397,6 +514,7 @@ authorization from the authors.
     <xsl:copy>
       <xsl:attribute name="type">
         <xsl:call-template name="canonical-type-name" />
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name" />
@@ -407,7 +525,8 @@ authorization from the authors.
 
   <xsl:template match="list" mode="field">
     <xsl:variable name="type"><!--
-      --><xsl:call-template name="canonical-type-name" /><!--
+      --><xsl:call-template name="canonical-type-name" />
+        <xsl:text>_t</xsl:text><!--
     --></xsl:variable>
     <list type="{$type}">
       <xsl:attribute name="name">
@@ -458,6 +577,7 @@ authorization from the authors.
         <xsl:call-template name="canonical-type-name">
           <xsl:with-param name="type" select="@value-mask-type" />
         </xsl:call-template>
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name">
@@ -465,13 +585,13 @@ authorization from the authors.
         </xsl:call-template>
       </xsl:attribute>
     </field>
-    <list type="CARD32">
+    <list type="uint32_t">
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name">
           <xsl:with-param name="name" select="@value-list-name" />
         </xsl:call-template>
       </xsl:attribute>
-      <function-call name="XCBPopcount">
+      <function-call name="xcb_popcount">
         <param>
           <fieldref>
             <xsl:call-template name="canonical-var-name">
@@ -487,6 +607,7 @@ authorization from the authors.
     <field>
       <xsl:attribute name="type">
         <xsl:call-template name="canonical-type-name" />
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name" />
@@ -497,12 +618,18 @@ authorization from the authors.
   <xsl:template match="list" mode="param">
     <!-- If no length expression is provided, use a CARD32 localfield. -->
     <xsl:if test="not(node())">
-      <field type="CARD32" name="{@name}_len" />
+      <field type="uint32_t" name="{@name}_len" />
     </xsl:if>
     <field>
+      <xsl:variable name="ctype">
+        <xsl:call-template name="canonical-type-name" />
+      </xsl:variable>
       <xsl:attribute name="type">
         <xsl:text>const </xsl:text>
         <xsl:call-template name="canonical-type-name" />
+        <xsl:if test="not($ctype='char') and not($ctype='void')">
+          <xsl:text>_t</xsl:text>
+        </xsl:if>
         <xsl:text> *</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="name">
@@ -517,6 +644,7 @@ authorization from the authors.
         <xsl:call-template name="canonical-type-name">
           <xsl:with-param name="type" select="@value-mask-type" />
         </xsl:call-template>
+        <xsl:text>_t</xsl:text>
       </xsl:attribute>
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name">
@@ -524,7 +652,7 @@ authorization from the authors.
         </xsl:call-template>
       </xsl:attribute>
     </field>
-    <field type="const CARD32 *">
+    <field type="const uint32_t *">
       <xsl:attribute name="name">
         <xsl:call-template name="canonical-var-name">
           <xsl:with-param name="name" select="@value-list-name" />
@@ -585,14 +713,14 @@ authorization from the authors.
 
     <xsl:variable name="num-parts" select="(1+count($struct/list))*2" />
 
-    <l>static const XCBProtocolRequest xcb_req = {</l>
+    <l>static const xcb_protocol_request_t xcb_req = {</l>
     <indent>
       <l>/* count */ <xsl:value-of select="$num-parts" />,</l>
       <l>/* ext */ <xsl:choose>
                      <xsl:when test="$ext">
-                       <xsl:text>&amp;XCB</xsl:text>
-                       <xsl:value-of select="$ext" />
-                       <xsl:text>Id</xsl:text>
+                       <xsl:text>&amp;</xsl:text>
+                       <xsl:value-of select="xcb:xcb-prefix()" />
+                       <xsl:text>_id</xsl:text>
                      </xsl:when>
                      <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose>,</l>
@@ -621,17 +749,24 @@ authorization from the authors.
       <l>xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_base = (char *) <!--
       --><xsl:value-of select="@name" />;</l>
       <l>xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_len = <!--
-      --><xsl:apply-templates mode="output-expression" /><!--
-      --><xsl:if test="not(@type = 'void')">
+      --><xsl:apply-templates mode="output-expression" />
+      <xsl:if test="not(@type = 'void_t')">
         <xsl:text> * sizeof(</xsl:text>
-        <xsl:value-of select="@type" />
+          <xsl:choose>
+          <xsl:when test="@type='char_t'">
+            <xsl:text>char</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="@type" />
+          </xsl:otherwise>
+        </xsl:choose>
         <xsl:text>)</xsl:text>
       </xsl:if>;</l>
       <l>xcb_parts[<xsl:value-of select="3 + position() * 2"/>].iov_base = 0;</l>
       <l>xcb_parts[<xsl:value-of select="3 + position() * 2"/>].iov_len = -xcb_parts[<xsl:value-of select="2 + position() * 2"/>].iov_len &amp; 3;</l>
     </xsl:for-each>
 
-    <l>xcb_ret.sequence = XCBSendRequest(c, <!--
+    <l>xcb_ret.sequence = xcb_send_request(c, <!--
     --><xsl:choose>
          <xsl:when test="@checked='true'">XCB_REQUEST_CHECKED</xsl:when>
          <xsl:otherwise>0</xsl:otherwise>
@@ -660,50 +795,30 @@ authorization from the authors.
   </xsl:template>
 
   <xsl:template match="iterator" mode="pass2">
-    <struct name="{@ref}Iter">
-      <field type="{@ref} *" name="data" />
+    <struct name="{@ref}_iterator_t">
+      <field type="{@ref}_t *" name="data" />
       <field type="int" name="rem" />
       <field type="int" name="index" />
     </struct>
   </xsl:template>
 
-  <!-- Change a_name_like_this to ANameLikeThis.  If the parameter name is not
-       given, it defaults to the name attribute of the context node. -->
-  <xsl:template name="capitalize">
-    <xsl:param name="name" select="string(@name)" />
-    <xsl:if test="$name">
-      <xsl:value-of select="translate(substring($name,1,1), $lcase, $ucase)" />
-      <xsl:choose>
-        <xsl:when test="contains($name, '_')">
-          <xsl:value-of select="substring(substring-before($name, '_'), 2)" />
-          <xsl:call-template name="capitalize">
-            <xsl:with-param name="name" select="substring-after($name, '_')" />
-          </xsl:call-template>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:value-of select="substring($name, 2)" />
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:if>
-  </xsl:template>
-
   <xsl:template match="iterator-functions" mode="pass2">
     <xsl:variable name="ref" select="@ref" />
     <xsl:variable name="kind" select="@kind" />
     <xsl:variable name="struct"
-                  select="$pass1/xcb/struct[@name=concat($ref,$kind)]" />
+                  select="$pass1/xcb/struct[@name=concat($ref, $kind, '_t')]" />
     <xsl:variable name="nextfields-rtf">
       <nextfield>R + 1</nextfield>
       <xsl:for-each select="$struct/list[not(@fixed)]">
         <xsl:choose>
-          <xsl:when test="substring(@type, 1, 3) = 'XCB'">
-            <nextfield><xsl:value-of select="@type" />End(<!--
-            --><xsl:value-of select="$ref" /><!--
-            --><xsl:call-template name="capitalize" />Iter(R))</nextfield>
+          <xsl:when test="substring(@type, 1, 3) = 'xcb'">
+            <nextfield><xsl:value-of select="substring(@type, 1, string-length(@type)-2)" />_end(<!--
+            --><xsl:value-of select="$ref" />_<!--
+            --><xsl:value-of select="string(@name)" />_iterator(R))</nextfield>
           </xsl:when>
           <xsl:otherwise>
-            <nextfield><xsl:value-of select="$ref" /><!--
-            --><xsl:call-template name="capitalize" />End(R)</nextfield>
+            <nextfield><xsl:value-of select="$ref" />_<!--
+            --><xsl:value-of select="string(@name)" />_end(R)</nextfield>
           </xsl:otherwise>
         </xsl:choose>
       </xsl:for-each>
@@ -715,52 +830,51 @@ authorization from the authors.
       <xsl:variable name="nextfield" select="$nextfields/nextfield[$number]" />
       <xsl:variable name="is-first"
                     select="not(preceding-sibling::list[not(@fixed)])" />
-      <xsl:variable name="field-name"><!--
-        --><xsl:call-template name="capitalize" /><!--
-      --></xsl:variable>
+      <xsl:variable name="field-name" select="@name" />
       <xsl:variable name="is-variable"
                     select="$pass1/xcb/struct[@name=current()/@type]/list
                             or document($search-path)/xcb
-                               /struct[concat('XCB',
-                                              ancestor::xcb/@extension-name,
-                                              @name) = current()/@type]
-                               /*[self::valueparam or self::list]" />
+                               /struct[concat(xcb:xcb-prefix(@name), '_t')
+                                       = current()/@type]
+                               /*[self::valueparam
+                                  or self::list[.//*[not(self::value
+                                                         or self::op)]]]" />
       <xsl:if test="not($is-variable)">
-        <function type="{@type} *" name="{$ref}{$field-name}">
-          <field type="const {$ref}{$kind} *" name="R" />
+        <function type="{xcb:get-char-void(@type)} *" name="{$ref}_{xcb:lowercase($field-name)}">
+          <field type="const {$ref}{$kind}_t *" name="R" />
           <xsl:choose>
             <xsl:when test="$is-first">
-              <l>return (<xsl:value-of select="@type" /> *) <!--
+              <l>return (<xsl:value-of select="xcb:get-char-void(@type)" /> *) <!--
               -->(<xsl:value-of select="$nextfield" />);</l>
             </xsl:when>
             <xsl:otherwise>
-              <l>XCBGenericIter prev = <!--
+              <l>xcb_generic_iterator_t prev = <!--
               --><xsl:value-of select="$nextfield" />;</l>
-              <l>return (<xsl:value-of select="@type" /> *) <!--
+              <l>return (<xsl:value-of select="xcb:get-char-void(@type)" /> *) <!--
               -->((char *) prev.data + XCB_TYPE_PAD(<!--
-              --><xsl:value-of select="@type" />, prev.index));</l>
+              --><xsl:value-of select="xcb:get-char-void(@type)" />, prev.index));</l>
             </xsl:otherwise>
           </xsl:choose>
         </function>
       </xsl:if>
-      <function type="int" name="{$ref}{$field-name}Length">
-        <field type="const {$ref}{$kind} *" name="R" />
+      <function type="int" name="{$ref}_{xcb:lowercase($field-name)}_length">
+        <field type="const {$ref}{$kind}_t *" name="R" />
         <l>return <xsl:apply-templates mode="output-expression">
                     <xsl:with-param name="field-prefix" select="'R->'" />
                   </xsl:apply-templates>;</l>
       </function>
       <xsl:choose>
-        <xsl:when test="substring(@type, 1, 3) = 'XCB'">
-          <function type="{@type}Iter" name="{$ref}{$field-name}Iter">
-            <field type="const {$ref}{$kind} *" name="R" />
-            <l><xsl:value-of select="@type" />Iter i;</l>
+        <xsl:when test="substring(@type, 1, 3) = 'xcb'">
+          <function type="{substring(@type, 1, string-length(@type)-2)}_iterator_t" name="{$ref}_{xcb:lowercase($field-name)}_iterator">
+            <field type="const {$ref}{$kind}_t *" name="R" />
+            <l><xsl:value-of select="substring(@type, 1, string-length(@type)-2)" />_iterator_t i;</l>
             <xsl:choose>
               <xsl:when test="$is-first">
                 <l>i.data = (<xsl:value-of select="@type" /> *) <!--
                 -->(<xsl:value-of select="$nextfield" />);</l>
               </xsl:when>
               <xsl:otherwise>
-                <l>XCBGenericIter prev = <!--
+                <l>xcb_generic_iterator_t prev = <!--
                 --><xsl:value-of select="$nextfield" />;</l>
                 <l>i.data = (<xsl:value-of select="@type" /> *) <!--
                 -->((char *) prev.data + XCB_TYPE_PAD(<!--
@@ -781,21 +895,21 @@ authorization from the authors.
               <xsl:otherwise><xsl:value-of select="@type" /></xsl:otherwise>
             </xsl:choose>
           </xsl:variable>
-          <function type="XCBGenericIter" name="{$ref}{$field-name}End">
-            <field type="const {$ref}{$kind} *" name="R" />
-            <l>XCBGenericIter i;</l>
+          <function type="xcb_generic_iterator_t" name="{$ref}_{xcb:lowercase($field-name)}_end">
+            <field type="const {$ref}{$kind}_t *" name="R" />
+            <l>xcb_generic_iterator_t i;</l>
             <xsl:choose>
               <xsl:when test="$is-first">
-                <l>i.data = ((<xsl:value-of select="$cast" /> *) <!--
+                <l>i.data = ((<xsl:value-of select="xcb:remove-void($cast)" /> *) <!--
                 -->(<xsl:value-of select="$nextfield" />)) + (<!--
                 --><xsl:apply-templates mode="output-expression">
                      <xsl:with-param name="field-prefix" select="'R->'" />
                    </xsl:apply-templates>);</l>
               </xsl:when>
               <xsl:otherwise>
-                <l>XCBGenericIter child = <!--
+                <l>xcb_generic_iterator_t child = <!--
                 --><xsl:value-of select="$nextfield" />;</l>
-                <l>i.data = ((<xsl:value-of select="$cast" /> *) <!--
+                <l>i.data = ((<xsl:value-of select="xcb:get-char-void($cast)" /> *) <!--
                 -->child.data) + (<!--
                 --><xsl:apply-templates mode="output-expression">
                      <xsl:with-param name="field-prefix" select="'R->'" />
@@ -810,32 +924,32 @@ authorization from the authors.
       </xsl:choose>
     </xsl:for-each>
     <xsl:if test="not($kind)">
-      <function type="void" name="{$ref}Next">
-        <field type="{$ref}Iter *" name="i" />
+      <function type="void" name="{$ref}_next">
+        <field type="{$ref}_iterator_t *" name="i" />
         <xsl:choose>
           <xsl:when test="$struct/list[not(@fixed)]">
-            <l><xsl:value-of select="$ref" /> *R = i->data;</l>
-            <l>XCBGenericIter child = <!--
+            <l><xsl:value-of select="$ref" />_t *R = i->data;</l>
+            <l>xcb_generic_iterator_t child = <!--
             --><xsl:value-of select="$nextfields/nextfield[last()]" />;</l>
             <l>--i->rem;</l>
-            <l>i->data = (<xsl:value-of select="$ref" /> *) child.data;</l>
+            <l>i->data = (<xsl:value-of select="$ref" />_t *) child.data;</l>
             <l>i->index = child.index;</l>
           </xsl:when>
           <xsl:otherwise>
             <l>--i->rem;</l>
             <l>++i->data;</l>
-            <l>i->index += sizeof(<xsl:value-of select="$ref" />);</l>
+            <l>i->index += sizeof(<xsl:value-of select="$ref" />_t);</l>
           </xsl:otherwise>
         </xsl:choose>
       </function>
-      <function type="XCBGenericIter" name="{$ref}End">
-        <field type="{$ref}Iter" name="i" />
-        <l>XCBGenericIter ret;</l>
+      <function type="xcb_generic_iterator_t" name="{$ref}_end">
+        <field type="{$ref}_iterator_t" name="i" />
+        <l>xcb_generic_iterator_t ret;</l>
         <xsl:choose>
           <xsl:when test="$struct/list[not(@fixed)]">
             <l>while(i.rem > 0)</l>
             <indent>
-              <l><xsl:value-of select="$ref" />Next(&amp;i);</l>
+              <l><xsl:value-of select="$ref" />_next(&amp;i);</l>
             </indent>
             <l>ret.data = i.data;</l>
             <l>ret.rem = i.rem;</l>
@@ -915,7 +1029,7 @@ authorization from the authors.
       <xsl:when test="@type = 'number'">
         <xsl:if test="$h">
           <xsl:text>#define </xsl:text>
-          <xsl:value-of select="@name" />
+          <xsl:value-of select="translate(@name, $lcase, $ucase)" />
           <xsl:text> </xsl:text>
           <xsl:value-of select="@value" />
           <xsl:text>
@@ -958,7 +1072,7 @@ authorization from the authors.
   <xsl:template match="typedef" mode="output">
     <xsl:if test="$h">
       <xsl:text>typedef </xsl:text>
-      <xsl:value-of select="@oldname" />
+      <xsl:value-of select="xcb:get-char-void(@oldname)" />
       <xsl:text> </xsl:text>
       <xsl:value-of select="@newname" />
       <xsl:text>;
@@ -1159,7 +1273,7 @@ authorization from the authors.
     <xsl:variable name="padnum"><xsl:number /></xsl:variable>
 
     <xsl:call-template name="type-and-name">
-      <xsl:with-param name="type" select="'CARD8'" />
+      <xsl:with-param name="type" select="'uint8_t'" />
       <xsl:with-param name="name">
         <xsl:text>pad</xsl:text>
         <xsl:value-of select="$padnum - 1" />
diff --git a/xcb/src/xcb.h b/xcb/src/xcb.h
index 3d193e1..ed4d4b9 100644
--- a/xcb/src/xcb.h
+++ b/xcb/src/xcb.h
@@ -37,14 +37,14 @@
 
 /* FIXME: these names conflict with those defined in Xmd.h. */
 #ifndef XMD_H
-typedef uint8_t  BYTE;
-typedef uint8_t  BOOL;
-typedef uint8_t  CARD8;
-typedef uint16_t CARD16;
-typedef uint32_t CARD32;
-typedef int8_t   INT8;
-typedef int16_t  INT16;
-typedef int32_t  INT32;
+typedef uint8_t  uint8_t;
+typedef uint8_t  uint8_t;
+typedef uint8_t  uint8_t;
+typedef uint16_t uint16_t;
+typedef uint32_t uint32_t;
+typedef int8_t   int8_t;
+typedef int16_t  int16_t;
+typedef int32_t  int32_t;
 #endif /* XMD_H */
 
 #include <sys/uio.h>
@@ -60,7 +60,7 @@ extern "C" {
  */
 
 /**
- * @defgroup XCB_Core_Api XCB Core API
+ * @defgroup xcb__core_api_t XCB Core API
  * @brief Core API of the XCB library.
  *
  * @{
@@ -86,7 +86,7 @@ extern "C" {
  *
  * A structure that contain all data that  XCB needs to communicate with an X server.
  */
-typedef struct XCBConnection XCBConnection;  /**< Opaque structure containing all data that  XCB needs to communicate with an X server. */
+typedef struct xcb_connection_t xcb_connection_t;  /**< Opaque structure containing all data that  XCB needs to communicate with an X server. */
 
 
 /* Other types */
@@ -100,7 +100,7 @@ typedef struct {
     void *data;   /**< Data of the current iterator */
     int rem;    /**< remaining elements */
     int index;  /**< index of the current iterator */
-} XCBGenericIter;
+} xcb_generic_iterator_t;
 
 /**
  * @brief Generic reply.
@@ -108,11 +108,11 @@ typedef struct {
  * A generic reply structure.
  */
 typedef struct {
-    BYTE   response_type;  /**< Type of the response */
-    CARD8  pad0;           /**< Padding */
-    CARD16 sequence;       /**< Sequence number */
-    CARD32 length;         /**< Length of the response */
-} XCBGenericRep;
+    uint8_t   response_type;  /**< Type of the response */
+    uint8_t  pad0;           /**< Padding */
+    uint16_t sequence;       /**< Sequence number */
+    uint32_t length;         /**< Length of the response */
+} xcb_generic_reply_t;
 
 /**
  * @brief Generic event.
@@ -120,12 +120,12 @@ typedef struct {
  * A generic event structure.
  */
 typedef struct {
-    BYTE   response_type;  /**< Type of the response */
-    CARD8  pad0;           /**< Padding */
-    CARD16 sequence;       /**< Sequence number */
-    CARD32 pad[7];         /**< Padding */
-    CARD32 full_sequence;
-} XCBGenericEvent;
+    uint8_t   response_type;  /**< Type of the response */
+    uint8_t  pad0;           /**< Padding */
+    uint16_t sequence;       /**< Sequence number */
+    uint32_t pad[7];         /**< Padding */
+    uint32_t full_sequence;
+} xcb_generic_event_t;
 
 /**
  * @brief Generic error.
@@ -133,12 +133,12 @@ typedef struct {
  * A generic error structure.
  */
 typedef struct {
-    BYTE   response_type;  /**< Type of the response */
-    BYTE   error_code;     /**< Error code */
-    CARD16 sequence;       /**< Sequence number */
-    CARD32 pad[7];         /**< Padding */
-    CARD32 full_sequence;
-} XCBGenericError;
+    uint8_t   response_type;  /**< Type of the response */
+    uint8_t   error_code;     /**< Error code */
+    uint16_t sequence;       /**< Sequence number */
+    uint32_t pad[7];         /**< Padding */
+    uint32_t full_sequence;
+} xcb_generic_error_t;
 
 /**
  * @brief Generic cookie.
@@ -147,24 +147,24 @@ typedef struct {
  */
 typedef struct {
     unsigned int sequence;  /**< Sequence number */
-} XCBVoidCookie;
+} xcb_void_cookie_t;
 
 
 /* Include the generated xproto header. */
 #include "xproto.h"
 
 
-/** XCBNone is the universal null resource or null atom parameter value for many core X requests */
-#define XCBNone 0L
+/** XCB_NONE is the universal null resource or null atom parameter value for many core X requests */
+#define XCB_NONE 0L
 
-/** XCBCopyFromParent can be used for many CreateWindow parameters */
-#define XCBCopyFromParent 0L
+/** XCB_COPY_FROM_PARENT can be used for many CreateWindow parameters */
+#define XCB_COPY_FROM_PARENT 0L
 
-/** XCBCurrentTime can be used in most requests that take an XCBTIMESTAMP */
-#define XCBCurrentTime 0L
+/** XCB_CURRENT_TIME can be used in most requests that take an xcb_timestamp_t */
+#define XCB_CURRENT_TIME 0L
 
-/** XCBNoSymbol fills in unused entries in XCBKEYSYM tables */
-#define XCBNoSymbol 0L
+/** XCB_NO_SYMBOL fills in unused entries in xcb_keysym_t tables */
+#define XCB_NO_SYMBOL 0L
 
 
 /* xcb_auth.c */
@@ -174,12 +174,12 @@ typedef struct {
  *
  * A container for authorization information to be sent to the X server.
  */
-typedef struct XCBAuthInfo {
+typedef struct xcb_auth_info_t {
     int   namelen;  /**< Length of the string name (as returned by strlen). */
     char *name;     /**< String containing the authentication protocol name, such as "MIT-MAGIC-COOKIE-1" or "XDM-AUTHORIZATION-1". */
     int   datalen;  /**< Length of the data member. */
     char *data;   /**< Data interpreted in a protocol-specific manner. */
-} XCBAuthInfo;
+} xcb_auth_info_t;
 
 
 /* xcb_out.c */
@@ -192,7 +192,7 @@ typedef struct XCBAuthInfo {
  * Forces any buffered output to be written to the server. Blocks
  * until the write is complete.
  */
-int XCBFlush(XCBConnection *c);
+int xcb_flush(xcb_connection_t *c);
 
 /**
  * @brief Returns the maximum request length field from the connection
@@ -210,7 +210,7 @@ int XCBFlush(XCBConnection *c);
  * theoretical maximum lengths roughly 256kB without BIG-REQUESTS and
  * 16GB with.
  */
-CARD32 XCBGetMaximumRequestLength(XCBConnection *c);
+uint32_t xcb_get_maximum_request_length(xcb_connection_t *c);
 
 
 /* xcb_in.c */
@@ -224,7 +224,7 @@ CARD32 XCBGetMaximumRequestLength(XCBCon
  * the event of an I/O error. Blocks until either an event or error
  * arrive, or an I/O error occurs.
  */
-XCBGenericEvent *XCBWaitForEvent(XCBConnection *c);
+xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c);
 
 /**
  * @brief Returns the next event or error from the server.
@@ -241,7 +241,7 @@ XCBGenericEvent *XCBWaitForEvent(XCBConn
  * operation. If @p error is @c NULL, terminates the application when an
  * I/O error occurs.
  */
-XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error);
+xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c, int *error);
 
 /**
  * @brief Return the error for a request, or NULL if none can ever arrive.
@@ -249,7 +249,7 @@ XCBGenericEvent *XCBPollForEvent(XCBConn
  * @param cookie: The request cookie.
  * @return The error for the request, or NULL if none can ever arrive.
  *
- * The XCBVoidCookie cookie supplied to this function must have resulted from
+ * The xcb_void_cookie_t cookie supplied to this function must have resulted from
  * a call to XCB[RequestName]Checked().  This function will block until one of
  * two conditions happens.  If an error is received, it will be returned.  If
  * a reply to a subsequent request has already arrived, no error can arrive
@@ -259,33 +259,33 @@ XCBGenericEvent *XCBPollForEvent(XCBConn
  * sequence number will advance beyond that provided in cookie; this is a
  * convenience to avoid races in determining whether the sync is needed.
  */
-XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie);
+xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie);
 
 
 /* xcb_ext.c */
 
 /**
- * @typedef typedef struct XCBExtension XCBExtension
+ * @typedef typedef struct xcb_extension_t xcb_extension_t
  */
-typedef struct XCBExtension XCBExtension;  /**< Opaque structure used as key for XCBGetExtensionData. */
+typedef struct xcb_extension_t xcb_extension_t;  /**< Opaque structure used as key for xcb_get_extension_data_t. */
 
 /**
  * @brief Caches reply information from QueryExtension requests.
  * @param c: The connection.
  * @param ext: The extension data.
- * @return A pointer to the XCBQueryExtensionRep for the extension.
+ * @return A pointer to the xcb_query_extension_reply_t for the extension.
  *
  * This function is the primary interface to the "extension cache",
  * which caches reply information from QueryExtension
  * requests. Invoking this function may cause a call to
- * XCBQueryExtension to retrieve extension information from the
+ * xcb_query_extension_t to retrieve extension information from the
  * server, and may block until extension data is received from the
  * server.
  *
  * The result must not be freed. This storage is managed by the cache
  * itself.
  */
-const XCBQueryExtensionRep *XCBGetExtensionData(XCBConnection *c, XCBExtension *ext);
+const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
 
 /**
  * @brief Prefetch of extension data into the extension cache
@@ -294,11 +294,11 @@ const XCBQueryExtensionRep *XCBGetExtens
  *
  * This function allows a "prefetch" of extension data into the
  * extension cache. Invoking the function may cause a call to
- * XCBQueryExtension, but will not block waiting for the
- * reply. XCBGetExtensionData will return the prefetched data after
+ * xcb_query_extension_t, but will not block waiting for the
+ * reply. xcb_get_extension_data_t will return the prefetched data after
  * possibly blocking while it is retrieved.
  */
-void XCBPrefetchExtensionData(XCBConnection *c, XCBExtension *ext);
+void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext);
 
 
 /* xcb_conn.c */
@@ -306,9 +306,9 @@ void XCBPrefetchExtensionData(XCBConnect
 /**
  * @brief Access the data returned by the server.
  * @param c: The connection.
- * @return A pointer to an XCBSetup structure.
+ * @return A pointer to an xcb_setup_t structure.
  *
- * Accessor for the data returned by the server when the XCBConnection
+ * Accessor for the data returned by the server when the xcb_connection_t
  * was initialized. This data includes
  * - the server's required format for images,
  * - a list of available visuals,
@@ -321,7 +321,7 @@ void XCBPrefetchExtensionData(XCBConnect
  *
  * The result must not be freed.
  */
-const XCBSetup *XCBGetSetup(XCBConnection *c);
+const xcb_setup_t *xcb_get_setup(xcb_connection_t *c);
 
 /**
  * @brief Access the file descriptor of the connection.
@@ -329,39 +329,39 @@ const XCBSetup *XCBGetSetup(XCBConnectio
  * @return The file descriptor.
  *
  * Accessor for the file descriptor that was passed to the
- * XCBConnectToFD call that returned @p c.
+ * xcb_connect_to_fd_t call that returned @p c.
  */
-int XCBGetFileDescriptor(XCBConnection *c);
+int xcb_get_file_descriptor(xcb_connection_t *c);
 
 /**
  * @brief Test whether the connection has shut down due to a fatal error.
  * @param c: The connection.
  * @return 1 if the connection is in an error state; 0 otherwise.
  *
- * Some errors that occur in the context of an XCBConnection
+ * Some errors that occur in the context of an xcb_connection_t
  * are unrecoverable. When such an error occurs, the
  * connection is shut down and further operations on the
- * XCBConnection have no effect.
+ * xcb_connection_t have no effect.
  *
  * @todo Other functions should document the conditions in
  * which they shut down the connection.
  */
-int XCBConnectionHasError(XCBConnection *c);
+int xcb_connection_has_error(xcb_connection_t *c);
 
 /**
  * @brief Connects to the X server.
  * @param fd: The file descriptor.
  * @param auth_info: Authentication data.
- * @return A newly allocated XCBConnection structure.
+ * @return A newly allocated xcb_connection_t structure.
  *
  * Connects to an X server, given the open socket @p fd and the
- * XCBAuthInfo @p auth_info. The file descriptor @p fd is
- * bidirectionally connected to an X server. XCBGetTCPFD and
- * XCBGetUnixFD return appropriate file descriptors. If the connection
+ * xcb_auth_info_t @p auth_info. The file descriptor @p fd is
+ * bidirectionally connected to an X server. xcb_get_tcpfd_t and
+ * xcb_get_unix_fd_t return appropriate file descriptors. If the connection
  * should be unauthenticated, @p auth_info must be @c
- * NULL. XCBGetAuthInfo returns appropriate authentication data.
+ * NULL. xcb_get_auth_info_t returns appropriate authentication data.
  */
-XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info);
+xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info);
 
 /**
  * @brief Closes the connection.
@@ -370,7 +370,7 @@ XCBConnection *XCBConnectToFD(int fd, XC
  * Closes the file descriptor and frees all memory associated with the
  * connection @c c.
  */
-void XCBDisconnect(XCBConnection *c);
+void xcb_disconnect(xcb_connection_t *c);
 
 
 /* xcb_util.c */
@@ -392,13 +392,13 @@ void XCBDisconnect(XCBConnection *c);
  * can be @c NULL. If @p displayname does not contain a screen number,
  * it is set to @c 0.
  */
-int XCBParseDisplay(const char *name, char **host, int *display, int *screen);
+int xcb_parse_display(const char *name, char **host, int *display, int *screen);
 
 /**
  * @brief Connects to the X server.
  * @param displayname: The name of the display.
  * @param screenp: A pointer to a preferred screen number.
- * @return A newly allocated XCBConnection structure.
+ * @return A newly allocated xcb_connection_t structure.
  *
  * Connects to the X server specified by @p displayname. If @p
  * displayname is @c NULL, uses the value of the DISPLAY environment
@@ -406,21 +406,21 @@ int XCBParseDisplay(const char *name, ch
  * int pointed to by @p screenp (if not @c NULL) will be set to that
  * screen; otherwise the screen will be set to 0.
  */
-XCBConnection *XCBConnect(const char *displayname, int *screenp);
+xcb_connection_t *xcb_connect(const char *displayname, int *screenp);
 
 /**
  * @brief Connects to the X server, using an authorization information.
  * @param displayname: The name of the display.
  * @param auth: The authorization information.
  * @param screenp: A pointer to a preferred screen number.
- * @return A newly allocated XCBConnection structure.
+ * @return A newly allocated xcb_connection_t structure.
  *
  * Connects to the X server specified by @p displayname, using the
  * authorization @p auth. If a particular screen on that server is
  * preferred, the int pointed to by @p screenp (if not @c NULL) will
  * be set to that screen; otherwise @p screenp will be set to 0.
  */
-XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *display, XCBAuthInfo *auth, int *screen);
+xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *display, xcb_auth_info_t *auth, int *screen);
 
 
 /**
diff --git a/xcb/src/xcb_auth.c b/xcb/src/xcb_auth.c
index 46c85fd..42a3d86 100644
--- a/xcb/src/xcb_auth.c
+++ b/xcb/src/xcb_auth.c
@@ -105,7 +105,7 @@ static Xauth *get_authptr(struct sockadd
 	     addr = (char *) &si->sin_addr;
 	     addrlen = 4;
 	     if (ntohl(si->sin_addr.s_addr) != 0x7f000001)
-		 family = XCBFamilyInternet;
+		 family = XCB_FAMILY_INTERNET;
 	     snprintf(dispbuf, sizeof(dispbuf), "%d", ntohs(si->sin_port) - X_TCP_PORT);
 	     display = dispbuf;
         }
@@ -158,7 +158,7 @@ static void do_append(char *buf, int *id
 }
 #endif
      
-static int compute_auth(XCBAuthInfo *info, Xauth *authptr, struct sockaddr *sockname)
+static int compute_auth(xcb_auth_info_t *info, Xauth *authptr, struct sockaddr *sockname)
 {
     if (authname_match(AUTH_MC1, authptr->name, authptr->name_length)) {
         info->datalen = memdup(&info->data, authptr->data, authptr->data_length);
@@ -216,7 +216,7 @@ static int compute_auth(XCBAuthInfo *inf
     return 0;   /* Unknown authorization type */
 }
 
-int _xcb_get_auth_info(int fd, XCBAuthInfo *info)
+int _xcb_get_auth_info(int fd, xcb_auth_info_t *info)
 {
     /* code adapted from Xlib/ConnDis.c, xtrans/Xtranssocket.c,
        xtrans/Xtransutils.c */
diff --git a/xcb/src/xcb_conn.c b/xcb/src/xcb_conn.c
index c00eccf..9aa7cdf 100644
--- a/xcb/src/xcb_conn.c
+++ b/xcb/src/xcb_conn.c
@@ -39,10 +39,10 @@
 #include "xcbint.h"
 
 typedef struct {
-    CARD8  status;
-    CARD8  pad0[5];
-    CARD16 length;
-} XCBSetupGeneric;
+    uint8_t  status;
+    uint8_t  pad0[5];
+    uint16_t length;
+} xcb_setup_generic_t;
 
 static const int error_connection = 1;
 
@@ -59,10 +59,10 @@ static int set_fd_flags(const int fd)
     return 1;
 }
 
-static int write_setup(XCBConnection *c, XCBAuthInfo *auth_info)
+static int write_setup(xcb_connection_t *c, xcb_auth_info_t *auth_info)
 {
     static const char pad[3];
-    XCBSetupRequest out;
+    xcb_setup_request_t out;
     struct iovec parts[6];
     int count = 0;
     int endian = 0x01020304;
@@ -79,9 +79,9 @@ static int write_setup(XCBConnection *c,
     out.protocol_minor_version = X_PROTOCOL_REVISION;
     out.authorization_protocol_name_len = 0;
     out.authorization_protocol_data_len = 0;
-    parts[count].iov_len = sizeof(XCBSetupRequest);
+    parts[count].iov_len = sizeof(xcb_setup_request_t);
     parts[count++].iov_base = &out;
-    parts[count].iov_len = XCB_PAD(sizeof(XCBSetupRequest));
+    parts[count].iov_len = XCB_PAD(sizeof(xcb_setup_request_t));
     parts[count++].iov_base = (char *) pad;
 
     if(auth_info)
@@ -106,24 +106,24 @@ static int write_setup(XCBConnection *c,
     return ret;
 }
 
-static int read_setup(XCBConnection *c)
+static int read_setup(xcb_connection_t *c)
 {
     /* Read the server response */
-    c->setup = malloc(sizeof(XCBSetupGeneric));
+    c->setup = malloc(sizeof(xcb_setup_generic_t));
     if(!c->setup)
         return 0;
 
-    if(_xcb_in_read_block(c, c->setup, sizeof(XCBSetupGeneric)) != sizeof(XCBSetupGeneric))
+    if(_xcb_in_read_block(c, c->setup, sizeof(xcb_setup_generic_t)) != sizeof(xcb_setup_generic_t))
         return 0;
 
     {
-        void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(XCBSetupGeneric));
+        void *tmp = realloc(c->setup, c->setup->length * 4 + sizeof(xcb_setup_generic_t));
         if(!tmp)
             return 0;
         c->setup = tmp;
     }
 
-    if(_xcb_in_read_block(c, (char *) c->setup + sizeof(XCBSetupGeneric), c->setup->length * 4) <= 0)
+    if(_xcb_in_read_block(c, (char *) c->setup + sizeof(xcb_setup_generic_t), c->setup->length * 4) <= 0)
         return 0;
 
     /* 0 = failed, 2 = authenticate, 1 = success */
@@ -131,15 +131,15 @@ static int read_setup(XCBConnection *c)
     {
     case 0: /* failed */
         {
-            XCBSetupFailed *setup = (XCBSetupFailed *) c->setup;
-            write(STDERR_FILENO, XCBSetupFailedReason(setup), XCBSetupFailedReasonLength(setup));
+            xcb_setup_failed_t *setup = (xcb_setup_failed_t *) c->setup;
+            write(STDERR_FILENO, xcb_setup_failed_reason(setup), xcb_setup_failed_reason_length(setup));
             return 0;
         }
 
     case 2: /* authenticate */
         {
-            XCBSetupAuthenticate *setup = (XCBSetupAuthenticate *) c->setup;
-            write(STDERR_FILENO, XCBSetupAuthenticateReason(setup), XCBSetupAuthenticateReasonLength(setup));
+            xcb_setup_authenticate_t *setup = (xcb_setup_authenticate_t *) c->setup;
+            write(STDERR_FILENO, xcb_setup_authenticate_reason(setup), xcb_setup_authenticate_reason_length(setup));
             return 0;
         }
     }
@@ -148,7 +148,7 @@ static int read_setup(XCBConnection *c)
 }
 
 /* precondition: there must be something for us to write. */
-static int write_vec(XCBConnection *c, struct iovec **vector, int *count)
+static int write_vec(xcb_connection_t *c, struct iovec **vector, int *count)
 {
     int n;
     assert(!c->out.queue_len);
@@ -180,7 +180,7 @@ static int write_vec(XCBConnection *c, s
 
 /* Public interface */
 
-const XCBSetup *XCBGetSetup(XCBConnection *c)
+const xcb_setup_t *xcb_get_setup(xcb_connection_t *c)
 {
     if(c->has_error)
         return 0;
@@ -188,7 +188,7 @@ const XCBSetup *XCBGetSetup(XCBConnectio
     return c->setup;
 }
 
-int XCBGetFileDescriptor(XCBConnection *c)
+int xcb_get_file_descriptor(xcb_connection_t *c)
 {
     if(c->has_error)
         return -1;
@@ -196,19 +196,19 @@ int XCBGetFileDescriptor(XCBConnection *
     return c->fd;
 }
 
-int XCBConnectionHasError(XCBConnection *c)
+int xcb_connection_has_error(xcb_connection_t *c)
 {
     /* doesn't need locking because it's read and written atomically. */
     return c->has_error;
 }
 
-XCBConnection *XCBConnectToFD(int fd, XCBAuthInfo *auth_info)
+xcb_connection_t *xcb_connect_to_fd(int fd, xcb_auth_info_t *auth_info)
 {
-    XCBConnection* c;
+    xcb_connection_t* c;
 
-    c = calloc(1, sizeof(XCBConnection));
+    c = calloc(1, sizeof(xcb_connection_t));
     if(!c)
-        return (XCBConnection *) &error_connection;
+        return (xcb_connection_t *) &error_connection;
 
     c->fd = fd;
 
@@ -223,14 +223,14 @@ XCBConnection *XCBConnectToFD(int fd, XC
         _xcb_xid_init(c)
         ))
     {
-        XCBDisconnect(c);
-        return (XCBConnection *) &error_connection;
+        xcb_disconnect(c);
+        return (xcb_connection_t *) &error_connection;
     }
 
     return c;
 }
 
-void XCBDisconnect(XCBConnection *c)
+void xcb_disconnect(xcb_connection_t *c)
 {
     if(c->has_error)
         return;
@@ -250,12 +250,12 @@ void XCBDisconnect(XCBConnection *c)
 
 /* Private interface */
 
-void _xcb_conn_shutdown(XCBConnection *c)
+void _xcb_conn_shutdown(xcb_connection_t *c)
 {
     c->has_error = 1;
 }
 
-int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count)
+int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count)
 {
     int ret;
     fd_set rfds, wfds;
diff --git a/xcb/src/xcb_ext.c b/xcb/src/xcb_ext.c
index 3732515..9655dd8 100644
--- a/xcb/src/xcb_ext.c
+++ b/xcb/src/xcb_ext.c
@@ -35,12 +35,12 @@
 typedef struct lazyreply {
     enum { LAZY_NONE = 0, LAZY_COOKIE, LAZY_FORCED } tag;
     union {
-        XCBQueryExtensionCookie cookie;
-        XCBQueryExtensionRep *reply;
+        xcb_query_extension_cookie_t cookie;
+        xcb_query_extension_reply_t *reply;
     } value;
 } lazyreply;
 
-static lazyreply *get_index(XCBConnection *c, int index)
+static lazyreply *get_index(xcb_connection_t *c, int index)
 {
     if(index > c->ext.extensions_size)
     {
@@ -55,7 +55,7 @@ static lazyreply *get_index(XCBConnectio
     return c->ext.extensions + index - 1;
 }
 
-static lazyreply *get_lazyreply(XCBConnection *c, XCBExtension *ext)
+static lazyreply *get_lazyreply(xcb_connection_t *c, xcb_extension_t *ext)
 {
     static pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
     static int next_global_id;
@@ -72,16 +72,16 @@ static lazyreply *get_lazyreply(XCBConne
     {
         /* cache miss: query the server */
         data->tag = LAZY_COOKIE;
-        data->value.cookie = XCBQueryExtension(c, strlen(ext->name), ext->name);
+        data->value.cookie = xcb_query_extension(c, strlen(ext->name), ext->name);
     }
     return data;
 }
 
 /* Public interface */
 
-/* Do not free the returned XCBQueryExtensionRep - on return, it's aliased
+/* Do not free the returned xcb_query_extension_reply_t - on return, it's aliased
  * from the cache. */
-const XCBQueryExtensionRep *XCBGetExtensionData(XCBConnection *c, XCBExtension *ext)
+const xcb_query_extension_reply_t *xcb_get_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
 {
     lazyreply *data;
     if(c->has_error)
@@ -92,14 +92,14 @@ const XCBQueryExtensionRep *XCBGetExtens
     if(data && data->tag == LAZY_COOKIE)
     {
         data->tag = LAZY_FORCED;
-        data->value.reply = XCBQueryExtensionReply(c, data->value.cookie, 0);
+        data->value.reply = xcb_query_extension_reply(c, data->value.cookie, 0);
     }
     pthread_mutex_unlock(&c->ext.lock);
 
     return data ? data->value.reply : 0;
 }
 
-void XCBPrefetchExtensionData(XCBConnection *c, XCBExtension *ext)
+void xcb_prefetch_extension_data(xcb_connection_t *c, xcb_extension_t *ext)
 {
     if(c->has_error)
         return;
@@ -110,14 +110,14 @@ void XCBPrefetchExtensionData(XCBConnect
 
 /* Private interface */
 
-int _xcb_ext_init(XCBConnection *c)
+int _xcb_ext_init(xcb_connection_t *c)
 {
     if(pthread_mutex_init(&c->ext.lock, 0))
         return 0;
     return 1;
 }
 
-void _xcb_ext_destroy(XCBConnection *c)
+void _xcb_ext_destroy(xcb_connection_t *c)
 {
     pthread_mutex_destroy(&c->ext.lock);
     while(c->ext.extensions_size-- > 0)
diff --git a/xcb/src/xcb_in.c b/xcb/src/xcb_in.c
index 2ac1e52..690f623 100644
--- a/xcb/src/xcb_in.c
+++ b/xcb/src/xcb_in.c
@@ -37,11 +37,11 @@
 #include "xcbext.h"
 #include "xcbint.h"
 
-#define XCBError 0
-#define XCBReply 1
+#define XCB_ERROR 0
+#define XCB_REPLY 1
 
 struct event_list {
-    XCBGenericEvent *event;
+    xcb_generic_event_t *event;
     struct event_list *next;
 };
 
@@ -63,7 +63,7 @@ typedef struct reader_list {
     struct reader_list *next;
 } reader_list;
 
-static void wake_up_next_reader(XCBConnection *c)
+static void wake_up_next_reader(xcb_connection_t *c)
 {
     int pthreadret;
     if(c->in.readers)
@@ -73,9 +73,9 @@ static void wake_up_next_reader(XCBConne
     assert(pthreadret == 0);
 }
 
-static int read_packet(XCBConnection *c)
+static int read_packet(xcb_connection_t *c)
 {
-    XCBGenericRep genrep;
+    xcb_generic_reply_t genrep;
     int length = 32;
     void *buf;
     pending_reply *pend = 0;
@@ -89,7 +89,7 @@ static int read_packet(XCBConnection *c)
     memcpy(&genrep, c->in.queue, sizeof(genrep));
 
     /* Compute 32-bit sequence number of this packet. */
-    if((genrep.response_type & 0x7f) != XCBKeymapNotify)
+    if((genrep.response_type & 0x7f) != XCB_KEYMAP_NOTIFY)
     {
         unsigned int lastread = c->in.request_read;
         c->in.request_read = (lastread & 0xffff0000) | genrep.sequence;
@@ -108,7 +108,7 @@ static int read_packet(XCBConnection *c)
             }
             c->in.request_completed = c->in.request_read - 1;
         }
-        if(genrep.response_type == XCBError)
+        if(genrep.response_type == XCB_ERROR)
             c->in.request_completed = c->in.request_read;
 
         while(c->in.pending_replies && 
@@ -122,7 +122,7 @@ static int read_packet(XCBConnection *c)
         }
     }
 
-    if(genrep.response_type == XCBError || genrep.response_type == XCBReply)
+    if(genrep.response_type == XCB_ERROR || genrep.response_type == XCB_REPLY)
     {
         pend = c->in.pending_replies;
         if(pend && pend->request != c->in.request_read)
@@ -130,17 +130,17 @@ static int read_packet(XCBConnection *c)
     }
 
     /* For reply packets, check that the entire packet is available. */
-    if(genrep.response_type == XCBReply)
+    if(genrep.response_type == XCB_REPLY)
     {
         if(pend && pend->workaround == WORKAROUND_GLX_GET_FB_CONFIGS_BUG)
         {
-            CARD32 *p = (CARD32 *) c->in.queue;
+            uint32_t *p = (uint32_t *) c->in.queue;
             genrep.length = p[2] * p[3] * 2;
         }
         length += genrep.length * 4;
     }
 
-    buf = malloc(length + (genrep.response_type == XCBReply ? 0 : sizeof(CARD32)));
+    buf = malloc(length + (genrep.response_type == XCB_REPLY ? 0 : sizeof(uint32_t)));
     if(!buf)
     {
         _xcb_conn_shutdown(c);
@@ -157,12 +157,12 @@ static int read_packet(XCBConnection *c)
         return 1;
     }
 
-    if(genrep.response_type != XCBReply)
-        ((XCBGenericEvent *) buf)->full_sequence = c->in.request_read;
+    if(genrep.response_type != XCB_REPLY)
+        ((xcb_generic_event_t *) buf)->full_sequence = c->in.request_read;
 
     /* reply, or checked error */
-    if( genrep.response_type == XCBReply ||
-       (genrep.response_type == XCBError && pend && (pend->flags & XCB_REQUEST_CHECKED)))
+    if( genrep.response_type == XCB_REPLY ||
+       (genrep.response_type == XCB_ERROR && pend && (pend->flags & XCB_REQUEST_CHECKED)))
     {
         reader_list *reader;
         struct reply_list *cur = malloc(sizeof(struct reply_list));
@@ -205,10 +205,10 @@ static int read_packet(XCBConnection *c)
     return 1; /* I have something for you... */
 }
 
-static XCBGenericEvent *get_event(XCBConnection *c)
+static xcb_generic_event_t *get_event(xcb_connection_t *c)
 {
     struct event_list *cur = c->in.events;
-    XCBGenericEvent *ret;
+    xcb_generic_event_t *ret;
     if(!c->in.events)
         return 0;
     ret = cur->event;
@@ -253,7 +253,7 @@ static int read_block(const int fd, void
     return len;
 }
 
-static int poll_for_reply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error)
+static int poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error)
 {
     struct reply_list *head;
 
@@ -292,7 +292,7 @@ static int poll_for_reply(XCBConnection 
 
     if(head)
     {
-        if(((XCBGenericRep *) head->reply)->response_type == XCBError)
+        if(((xcb_generic_reply_t *) head->reply)->response_type == XCB_ERROR)
         {
             if(error)
                 *error = head->reply;
@@ -310,7 +310,7 @@ static int poll_for_reply(XCBConnection 
 
 /* Public interface */
 
-void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e)
+void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e)
 {
     void *ret = 0;
     if(e)
@@ -362,7 +362,7 @@ void *XCBWaitForReply(XCBConnection *c, 
     return ret;
 }
 
-int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error)
+int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error)
 {
     int ret;
     if(c->has_error)
@@ -379,9 +379,9 @@ int XCBPollForReply(XCBConnection *c, un
     return ret;
 }
 
-XCBGenericEvent *XCBWaitForEvent(XCBConnection *c)
+xcb_generic_event_t *xcb_wait_for_event(xcb_connection_t *c)
 {
-    XCBGenericEvent *ret;
+    xcb_generic_event_t *ret;
     if(c->has_error)
         return 0;
     pthread_mutex_lock(&c->iolock);
@@ -395,11 +395,11 @@ XCBGenericEvent *XCBWaitForEvent(XCBConn
     return ret;
 }
 
-XCBGenericEvent *XCBPollForEvent(XCBConnection *c, int *error)
+xcb_generic_event_t *xcb_poll_for_event(xcb_connection_t *c, int *error)
 {
     if(!c->has_error)
     {
-        XCBGenericEvent *ret = 0;
+        xcb_generic_event_t *ret = 0;
         int success;
         pthread_mutex_lock(&c->iolock);
         /* FIXME: follow X meets Z architecture changes. */
@@ -418,28 +418,28 @@ XCBGenericEvent *XCBPollForEvent(XCBConn
         *error = -1;
     else
     {
-        fprintf(stderr, "XCBPollForEvent: I/O error occured, but no handler provided.\n");
+        fprintf(stderr, "xcb_poll_for_event_t: I/O error occured, but no handler provided.\n");
         abort();
     }
     return 0;
 }
 
-XCBGenericError *XCBRequestCheck(XCBConnection *c, XCBVoidCookie cookie)
+xcb_generic_error_t *xcb_request_check(xcb_connection_t *c, xcb_void_cookie_t cookie)
 {
     /* FIXME: this could hold the lock to avoid syncing unnecessarily, but
-     * that would require factoring the locking out of XCBGetInputFocus,
-     * XCBGetInputFocusReply, and XCBWaitForReply. */
-    XCBGenericError *ret;
+     * that would require factoring the locking out of xcb_get_input_focus_t,
+     * xcb_get_input_focus_reply_t, and xcb_wait_for_reply_t. */
+    xcb_generic_error_t *ret;
     void *reply;
     if(c->has_error)
         return 0;
     if(XCB_SEQUENCE_COMPARE(cookie.sequence,>,c->in.request_expected)
        && XCB_SEQUENCE_COMPARE(cookie.sequence,>,c->in.request_completed))
     {
-        free(XCBGetInputFocusReply(c, XCBGetInputFocus(c), &ret));
+        free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), &ret));
         assert(!ret);
     }
-    reply = XCBWaitForReply(c, cookie.sequence, &ret);
+    reply = xcb_wait_for_reply(c, cookie.sequence, &ret);
     assert(!reply);
     return ret;
 }
@@ -488,7 +488,7 @@ void _xcb_in_destroy(_xcb_in *in)
     }
 }
 
-int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workarounds workaround, int flags)
+int _xcb_in_expect_reply(xcb_connection_t *c, unsigned int request, enum workarounds workaround, int flags)
 {
     pending_reply *pend = malloc(sizeof(pending_reply));
     assert(workaround != WORKAROUND_NONE || flags != 0);
@@ -506,7 +506,7 @@ int _xcb_in_expect_reply(XCBConnection *
     return 1;
 }
 
-int _xcb_in_read(XCBConnection *c)
+int _xcb_in_read(xcb_connection_t *c)
 {
     int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) - c->in.queue_len);
     if(n > 0)
@@ -519,7 +519,7 @@ int _xcb_in_read(XCBConnection *c)
     return 0;
 }
 
-int _xcb_in_read_block(XCBConnection *c, void *buf, int len)
+int _xcb_in_read_block(xcb_connection_t *c, void *buf, int len)
 {
     int done = c->in.queue_len;
     if(len < done)
diff --git a/xcb/src/xcb_list.c b/xcb/src/xcb_list.c
index 9854ead..3a18d90 100644
--- a/xcb/src/xcb_list.c
+++ b/xcb/src/xcb_list.c
@@ -54,7 +54,7 @@ _xcb_map *_xcb_map_new()
     return list;
 }
 
-void _xcb_map_delete(_xcb_map *list, XCBListFreeFunc do_free)
+void _xcb_map_delete(_xcb_map *list, xcb_list_free_func_t do_free)
 {
     if(!list)
         return;
diff --git a/xcb/src/xcb_out.c b/xcb/src/xcb_out.c
index 1b68215..edb0aa9 100644
--- a/xcb/src/xcb_out.c
+++ b/xcb/src/xcb_out.c
@@ -35,7 +35,7 @@
 #include "xcbint.h"
 #include "extensions/bigreq.h"
 
-static int write_block(XCBConnection *c, struct iovec *vector, int count)
+static int write_block(xcb_connection_t *c, struct iovec *vector, int count)
 {
     while(count && c->out.queue_len + vector[0].iov_len <= sizeof(c->out.queue))
     {
@@ -57,19 +57,19 @@ static int write_block(XCBConnection *c,
 
 /* Public interface */
 
-CARD32 XCBGetMaximumRequestLength(XCBConnection *c)
+uint32_t xcb_get_maximum_request_length(xcb_connection_t *c)
 {
     if(c->has_error)
         return 0;
     pthread_mutex_lock(&c->out.reqlenlock);
     if(!c->out.maximum_request_length)
     {
-        const XCBQueryExtensionRep *ext;
+        const xcb_query_extension_reply_t *ext;
         c->out.maximum_request_length = c->setup->maximum_request_length;
-        ext = XCBGetExtensionData(c, &XCBBigRequestsId);
+        ext = xcb_get_extension_data(c, &xcb_big_requests_id);
         if(ext && ext->present)
         {
-            XCBBigRequestsEnableRep *r = XCBBigRequestsEnableReply(c, XCBBigRequestsEnable(c), 0);
+            xcb_big_requests_enable_reply_t *r = xcb_big_requests_enable_reply(c, xcb_big_requests_enable(c), 0);
             c->out.maximum_request_length = r->maximum_request_length;
             free(r);
         }
@@ -78,18 +78,18 @@ CARD32 XCBGetMaximumRequestLength(XCBCon
     return c->out.maximum_request_length;
 }
 
-unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, const XCBProtocolRequest *req)
+unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *req)
 {
     static const union {
         struct {
-            CARD8 major;
-            CARD8 pad;
-            CARD16 len;
+            uint8_t major;
+            uint8_t pad;
+            uint16_t len;
         } fields;
-        CARD32 packet;
+        uint32_t packet;
     } sync = { { /* GetInputFocus */ 43, 0, 1 } };
     unsigned int request;
-    CARD32 prefix[3] = { 0 };
+    uint32_t prefix[3] = { 0 };
     int veclen = req->count;
     enum workarounds workaround = WORKAROUND_NONE;
 
@@ -104,23 +104,23 @@ unsigned int XCBSendRequest(XCBConnectio
     {
         static const char pad[3];
         int i;
-        CARD16 shortlen = 0;
+        uint16_t shortlen = 0;
         size_t longlen = 0;
         assert(vector[0].iov_len >= 4);
         /* set the major opcode, and the minor opcode for extensions */
         if(req->ext)
         {
-            const XCBQueryExtensionRep *extension = XCBGetExtensionData(c, req->ext);
+            const xcb_query_extension_reply_t *extension = xcb_get_extension_data(c, req->ext);
             if(!(extension && extension->present))
             {
                 _xcb_conn_shutdown(c);
                 return 0;
             }
-            ((CARD8 *) vector[0].iov_base)[0] = extension->major_opcode;
-            ((CARD8 *) vector[0].iov_base)[1] = req->opcode;
+            ((uint8_t *) vector[0].iov_base)[0] = extension->major_opcode;
+            ((uint8_t *) vector[0].iov_base)[1] = req->opcode;
         }
         else
-            ((CARD8 *) vector[0].iov_base)[0] = req->opcode;
+            ((uint8_t *) vector[0].iov_base)[0] = req->opcode;
 
         /* put together the length field, possibly using BIGREQUESTS */
         for(i = 0; i < req->count; ++i)
@@ -141,14 +141,14 @@ unsigned int XCBSendRequest(XCBConnectio
             shortlen = longlen;
             longlen = 0;
         }
-        else if(longlen > XCBGetMaximumRequestLength(c))
+        else if(longlen > xcb_get_maximum_request_length(c))
         {
             _xcb_conn_shutdown(c);
             return 0; /* server can't take this; maybe need BIGREQUESTS? */
         }
 
         /* set the length field. */
-        ((CARD16 *) vector[0].iov_base)[1] = shortlen;
+        ((uint16_t *) vector[0].iov_base)[1] = shortlen;
         if(!shortlen)
             prefix[2] = ++longlen;
     }
@@ -158,7 +158,7 @@ unsigned int XCBSendRequest(XCBConnectio
     /* XXX: GetFBConfigs won't use BIG-REQUESTS in any sane
      * configuration, but that should be handled here anyway. */
     if(req->ext && !req->isvoid && !strcmp(req->ext->name, "GLX") &&
-            ((req->opcode == 17 && ((CARD32 *) vector[0].iov_base)[1] == 0x10004) ||
+            ((req->opcode == 17 && ((uint32_t *) vector[0].iov_base)[1] == 0x10004) ||
              req->opcode == 21))
         workaround = WORKAROUND_GLX_GET_FB_CONFIGS_BUG;
 
@@ -194,11 +194,11 @@ unsigned int XCBSendRequest(XCBConnectio
         --vector, ++veclen;
         if(prefix[2])
         {
-            prefix[1] = ((CARD32 *) vector[1].iov_base)[0];
-            vector[1].iov_base = (CARD32 *) vector[1].iov_base + 1;
-            vector[1].iov_len -= sizeof(CARD32);
+            prefix[1] = ((uint32_t *) vector[1].iov_base)[0];
+            vector[1].iov_base = (uint32_t *) vector[1].iov_base + 1;
+            vector[1].iov_len -= sizeof(uint32_t);
         }
-        vector[0].iov_len = sizeof(CARD32) * (prefix[0] ? 1 : 0 | prefix[2] ? 2 : 0);
+        vector[0].iov_len = sizeof(uint32_t) * (prefix[0] ? 1 : 0 | prefix[2] ? 2 : 0);
         vector[0].iov_base = prefix + !prefix[0];
     }
 
@@ -211,7 +211,7 @@ unsigned int XCBSendRequest(XCBConnectio
     return request;
 }
 
-int XCBFlush(XCBConnection *c)
+int xcb_flush(xcb_connection_t *c)
 {
     int ret;
     if(c->has_error)
@@ -248,7 +248,7 @@ void _xcb_out_destroy(_xcb_out *out)
     pthread_mutex_destroy(&out->reqlenlock);
 }
 
-int _xcb_out_send(XCBConnection *c, struct iovec **vector, int *count)
+int _xcb_out_send(xcb_connection_t *c, struct iovec **vector, int *count)
 {
     int ret = 1;
     while(ret && *count)
@@ -258,7 +258,7 @@ int _xcb_out_send(XCBConnection *c, stru
     return ret;
 }
 
-int _xcb_out_flush_to(XCBConnection *c, unsigned int request)
+int _xcb_out_flush_to(xcb_connection_t *c, unsigned int request)
 {
     assert(XCB_SEQUENCE_COMPARE(request, <=, c->out.request));
     if(XCB_SEQUENCE_COMPARE(c->out.request_written, >=, request))
diff --git a/xcb/src/xcb_util.c b/xcb/src/xcb_util.c
index d93353b..3eab06a 100644
--- a/xcb/src/xcb_util.c
+++ b/xcb/src/xcb_util.c
@@ -47,7 +47,7 @@
 
 static const int error_connection = 1;
 
-int XCBPopcount(CARD32 mask)
+int xcb_popcount(uint32_t mask)
 {
     unsigned long y;
     y = (mask >> 1) & 033333333333;
@@ -55,7 +55,7 @@ int XCBPopcount(CARD32 mask)
     return ((y + (y >> 3)) & 030707070707) % 077;
 }
 
-int XCBParseDisplay(const char *name, char **host, int *displayp, int *screenp)
+int xcb_parse_display(const char *name, char **host, int *displayp, int *screenp)
 {
     int len, display, screen;
     char *colon, *dot, *end;
@@ -206,38 +206,38 @@ static int _xcb_open_unix(const char *fi
     return fd;
 }
 
-XCBConnection *XCBConnect(const char *displayname, int *screenp)
+xcb_connection_t *xcb_connect(const char *displayname, int *screenp)
 {
     int fd, display = 0;
     char *host;
-    XCBConnection *c;
-    XCBAuthInfo auth;
+    xcb_connection_t *c;
+    xcb_auth_info_t auth;
 
-    if(!XCBParseDisplay(displayname, &host, &display, screenp))
-        return (XCBConnection *) &error_connection;
+    if(!xcb_parse_display(displayname, &host, &display, screenp))
+        return (xcb_connection_t *) &error_connection;
     fd = _xcb_open(host, display);
     free(host);
     if(fd == -1)
-        return (XCBConnection *) &error_connection;
+        return (xcb_connection_t *) &error_connection;
 
     _xcb_get_auth_info(fd, &auth);
-    c = XCBConnectToFD(fd, &auth);
+    c = xcb_connect_to_fd(fd, &auth);
     free(auth.name);
     free(auth.data);
     return c;
 }
 
-XCBConnection *XCBConnectToDisplayWithAuthInfo(const char *displayname, XCBAuthInfo *auth, int *screenp)
+xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp)
 {
     int fd, display = 0;
     char *host;
 
-    if(!XCBParseDisplay(displayname, &host, &display, screenp))
-        return (XCBConnection *) &error_connection;
+    if(!xcb_parse_display(displayname, &host, &display, screenp))
+        return (xcb_connection_t *) &error_connection;
     fd = _xcb_open(host, display);
     free(host);
     if(fd == -1)
-        return (XCBConnection *) &error_connection;
+        return (xcb_connection_t *) &error_connection;
 
-    return XCBConnectToFD(fd, auth);
+    return xcb_connect_to_fd(fd, auth);
 }
diff --git a/xcb/src/xcb_xid.c b/xcb/src/xcb_xid.c
index a2e7dec..6ca6bd9 100644
--- a/xcb/src/xcb_xid.c
+++ b/xcb/src/xcb_xid.c
@@ -33,16 +33,16 @@
 
 /* Public interface */
 
-CARD32 XCBGenerateID(XCBConnection *c)
+uint32_t xcb_generate_id(xcb_connection_t *c)
 {
-    CARD32 ret;
+    uint32_t ret;
     if(c->has_error)
         return -1;
     pthread_mutex_lock(&c->xid.lock);
     if(c->xid.last == c->xid.max)
     {
-        XCBXCMiscGetXIDRangeRep *range;
-        range = XCBXCMiscGetXIDRangeReply(c, XCBXCMiscGetXIDRange(c), 0);
+        xcb_xc_misc_get_xid_range_reply_t *range;
+        range = xcb_xc_misc_get_xid_range_reply(c, xcb_xc_misc_get_xid_range(c), 0);
         if(!range)
         {
             pthread_mutex_unlock(&c->xid.lock);
@@ -60,7 +60,7 @@ CARD32 XCBGenerateID(XCBConnection *c)
 
 /* Private interface */
 
-int _xcb_xid_init(XCBConnection *c)
+int _xcb_xid_init(xcb_connection_t *c)
 {
     if(pthread_mutex_init(&c->xid.lock, 0))
         return 0;
@@ -71,7 +71,7 @@ int _xcb_xid_init(XCBConnection *c)
     return 1;
 }
 
-void _xcb_xid_destroy(XCBConnection *c)
+void _xcb_xid_destroy(xcb_connection_t *c)
 {
     pthread_mutex_destroy(&c->xid.lock);
 }
diff --git a/xcb/src/xcb_xlib.c b/xcb/src/xcb_xlib.c
index 054bc2e..5e56426 100644
--- a/xcb/src/xcb_xlib.c
+++ b/xcb/src/xcb_xlib.c
@@ -26,14 +26,14 @@
 #include "xcbxlib.h"
 #include "xcbint.h"
 
-unsigned int XCBGetRequestSent(XCBConnection *c)
+unsigned int xcb_get_request_sent(xcb_connection_t *c)
 {
     if(c->has_error)
         return 0;
     return c->out.request;
 }
 
-pthread_mutex_t *XCBGetIOLock(XCBConnection *c)
+pthread_mutex_t *xcb_get_io_lock(xcb_connection_t *c)
 {
     if(c->has_error)
         return 0;
diff --git a/xcb/src/xcbext.h b/xcb/src/xcbext.h
index 508ebf0..4824660 100644
--- a/xcb/src/xcbext.h
+++ b/xcb/src/xcbext.h
@@ -36,7 +36,7 @@ extern "C" {
 
 /* xcb_ext.c */
 
-struct XCBExtension {
+struct xcb_extension_t {
     const char *name;
     int global_id;
 };
@@ -46,34 +46,34 @@ struct XCBExtension {
 
 typedef struct {
     size_t count;
-    XCBExtension *ext;
-    CARD8 opcode;
-    BOOL isvoid;
-} XCBProtocolRequest;
+    xcb_extension_t *ext;
+    uint8_t opcode;
+    uint8_t isvoid;
+} xcb_protocol_request_t;
 
-enum XCBSendRequestFlags {
+enum xcb_send_request_flags_t {
     XCB_REQUEST_CHECKED = 1 << 0,
     XCB_REQUEST_RAW = 1 << 1,
     XCB_REQUEST_DISCARD_REPLY = 1 << 2
 };
 
-unsigned int XCBSendRequest(XCBConnection *c, int flags, struct iovec *vector, const XCBProtocolRequest *request);
+unsigned int xcb_send_request(xcb_connection_t *c, int flags, struct iovec *vector, const xcb_protocol_request_t *request);
 
 
 /* xcb_in.c */
 
-void *XCBWaitForReply(XCBConnection *c, unsigned int request, XCBGenericError **e);
-int XCBPollForReply(XCBConnection *c, unsigned int request, void **reply, XCBGenericError **error);
+void *xcb_wait_for_reply(xcb_connection_t *c, unsigned int request, xcb_generic_error_t **e);
+int xcb_poll_for_reply(xcb_connection_t *c, unsigned int request, void **reply, xcb_generic_error_t **error);
 
 
 /* xcb_xid.c */
 
-CARD32 XCBGenerateID(XCBConnection *c);
+uint32_t xcb_generate_id(xcb_connection_t *c);
 
 
 /* xcb_util.c */
 
-int XCBPopcount(CARD32 mask);
+int xcb_popcount(uint32_t mask);
 
 #ifdef __cplusplus
 }
diff --git a/xcb/src/xcbint.h b/xcb/src/xcbint.h
index 01d8a20..1a71696 100644
--- a/xcb/src/xcbint.h
+++ b/xcb/src/xcbint.h
@@ -47,12 +47,12 @@ enum workarounds {
 
 /* xcb_list.c */
 
-typedef void (*XCBListFreeFunc)(void *);
+typedef void (*xcb_list_free_func_t)(void *);
 
 typedef struct _xcb_map _xcb_map;
 
 _xcb_map *_xcb_map_new(void);
-void _xcb_map_delete(_xcb_map *q, XCBListFreeFunc do_free);
+void _xcb_map_delete(_xcb_map *q, xcb_list_free_func_t do_free);
 int _xcb_map_put(_xcb_map *q, unsigned int key, void *data);
 void *_xcb_map_remove(_xcb_map *q, unsigned int key);
 
@@ -70,14 +70,14 @@ typedef struct _xcb_out {
     unsigned int request_written;
 
     pthread_mutex_t reqlenlock;
-    CARD32 maximum_request_length;
+    uint32_t maximum_request_length;
 } _xcb_out;
 
 int _xcb_out_init(_xcb_out *out);
 void _xcb_out_destroy(_xcb_out *out);
 
-int _xcb_out_send(XCBConnection *c, struct iovec **vector, int *count);
-int _xcb_out_flush_to(XCBConnection *c, unsigned int request);
+int _xcb_out_send(xcb_connection_t *c, struct iovec **vector, int *count);
+int _xcb_out_flush_to(xcb_connection_t *c, unsigned int request);
 
 
 /* xcb_in.c */
@@ -107,24 +107,24 @@ typedef struct _xcb_in {
 int _xcb_in_init(_xcb_in *in);
 void _xcb_in_destroy(_xcb_in *in);
 
-int _xcb_in_expect_reply(XCBConnection *c, unsigned int request, enum workarounds workaround, int flags);
+int _xcb_in_expect_reply(xcb_connection_t *c, unsigned int request, enum workarounds workaround, int flags);
 
-int _xcb_in_read(XCBConnection *c);
-int _xcb_in_read_block(XCBConnection *c, void *buf, int nread);
+int _xcb_in_read(xcb_connection_t *c);
+int _xcb_in_read_block(xcb_connection_t *c, void *buf, int nread);
 
 
 /* xcb_xid.c */
 
 typedef struct _xcb_xid {
     pthread_mutex_t lock;
-    CARD32 last;
-    CARD32 base;
-    CARD32 max;
-    CARD32 inc;
+    uint32_t last;
+    uint32_t base;
+    uint32_t max;
+    uint32_t inc;
 } _xcb_xid;
 
-int _xcb_xid_init(XCBConnection *c);
-void _xcb_xid_destroy(XCBConnection *c);
+int _xcb_xid_init(xcb_connection_t *c);
+void _xcb_xid_destroy(xcb_connection_t *c);
 
 
 /* xcb_ext.c */
@@ -135,17 +135,17 @@ typedef struct _xcb_ext {
     int extensions_size;
 } _xcb_ext;
 
-int _xcb_ext_init(XCBConnection *c);
-void _xcb_ext_destroy(XCBConnection *c);
+int _xcb_ext_init(xcb_connection_t *c);
+void _xcb_ext_destroy(xcb_connection_t *c);
 
 
 /* xcb_conn.c */
 
-struct XCBConnection {
+struct xcb_connection_t {
     int has_error;
 
     /* constant data */
-    XCBSetup *setup;
+    xcb_setup_t *setup;
     int fd;
 
     /* I/O data */
@@ -158,13 +158,13 @@ struct XCBConnection {
     _xcb_xid xid;
 };
 
-void _xcb_conn_shutdown(XCBConnection *c);
-int _xcb_conn_wait(XCBConnection *c, pthread_cond_t *cond, struct iovec **vector, int *count);
+void _xcb_conn_shutdown(xcb_connection_t *c);
+int _xcb_conn_wait(xcb_connection_t *c, pthread_cond_t *cond, struct iovec **vector, int *count);
 
 
 /* xcb_auth.c */
 
-int _xcb_get_auth_info(int fd, XCBAuthInfo *info);
+int _xcb_get_auth_info(int fd, xcb_auth_info_t *info);
 
 #ifdef GCC_HAS_VISIBILITY
 #pragma GCC visibility pop
diff --git a/xcb/src/xcbxlib.h b/xcb/src/xcbxlib.h
index 59dd2a5..7e050c2 100644
--- a/xcb/src/xcbxlib.h
+++ b/xcb/src/xcbxlib.h
@@ -32,8 +32,8 @@
 #include "xcb.h"
 
 /* This function must be called with the IOLock held. */
-unsigned int XCBGetRequestSent(XCBConnection *c);
+unsigned int xcb_get_request_sent(xcb_connection_t *c);
 
-pthread_mutex_t *XCBGetIOLock(XCBConnection *c);
+pthread_mutex_t *xcb_get_io_lock(xcb_connection_t *c);
 
 #endif


More information about the xcb-commit mailing list