xserver: Branch 'orib-soc-2006'

Ori Bernstein orib at kemper.freedesktop.org
Sun Oct 29 19:22:54 EET 2006


 configure.ac            |    2 
 hw/xscreen/xs-color.c   |   33 ++++---
 hw/xscreen/xs-color.h   |    8 -
 hw/xscreen/xs-event.c   |   16 +--
 hw/xscreen/xs-font.c    |   34 ++++----
 hw/xscreen/xs-font.h    |    2 
 hw/xscreen/xs-gc.c      |  110 +++++++++++++-------------
 hw/xscreen/xs-gc.h      |    2 
 hw/xscreen/xs-gcops.c   |  141 ++++++++++++++++-----------------
 hw/xscreen/xs-globals.c |    8 -
 hw/xscreen/xs-globals.h |   10 +-
 hw/xscreen/xs-init.c    |   26 +++---
 hw/xscreen/xs-input.c   |   88 ++++++++++----------
 hw/xscreen/xs-pixmap.c  |   36 ++++----
 hw/xscreen/xs-pixmap.h  |    4 
 hw/xscreen/xs-screen.c  |    8 -
 hw/xscreen/xs-visual.c  |   26 +++---
 hw/xscreen/xs-visual.h  |    8 -
 hw/xscreen/xs-window.c  |  203 +++++++++++++++++++++++-------------------------
 hw/xscreen/xs-window.h  |    4 
 20 files changed, 384 insertions(+), 385 deletions(-)

New commits:
diff-tree 30b0244db0cf30170700e859920cfda973f2fde9 (from 3a6759d433d4988d13546b0320b1a652f897061c)
Author: Ori Bernstein <rand.chars at gmail.com>
Date:   Sun Oct 29 12:22:35 2006 -0500

    Updated to compile against new XCB, fixed configure.ac help message.

diff --git a/configure.ac b/configure.ac
index 301cec4..6a621e6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -429,7 +429,7 @@ AC_ARG_ENABLE(xorg,    	      AS_HELP_ST
 AC_ARG_ENABLE(dmx,    	      AS_HELP_STRING([--enable-dmx], [Build DMX server (default: auto)]), [DMX=$enableval], [DMX=auto])
 AC_ARG_ENABLE(xvfb,    	      AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes])
 AC_ARG_ENABLE(xnest,   	      AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
-AC_ARG_ENABLE(xscreen, 	      AS_HELP_STRING([--enable-xnest], [Build Xscreen server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
+AC_ARG_ENABLE(xscreen, 	      AS_HELP_STRING([--enable-xscreen], [Build Xscreen server (default: auto)]), [XNEST=$enableval], [XNEST=auto])
 AC_ARG_ENABLE(xwin,    	      AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
 AC_ARG_ENABLE(xprint,         AS_HELP_STRING([--enable-xprint], [Build Xprint extension and server (default: auto)]), [XPRINT=$enableval], [XPRINT=auto])
 AC_ARG_ENABLE(xgl,            AS_HELP_STRING([--enable-xgl], [Build Xgl server (default: no)]), [XGL=$enableval], [XGL=no])
diff --git a/hw/xscreen/xs-color.c b/hw/xscreen/xs-color.c
index 3d8a6b3..0317ca1 100644
--- a/hw/xscreen/xs-color.c
+++ b/hw/xscreen/xs-color.c
@@ -1,7 +1,7 @@
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_aux.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_aux.h>
 #include "scrnintstr.h"
 #include "window.h"
 #include "windowstr.h"
@@ -21,17 +21,17 @@ static ColormapPtr xsInstalledMap;
  **/
 Bool xsCreateColormap(ColormapPtr pCmap)
 {
-    XCBVISUALID vid;
+    xcb_visualid_t vid;
     VisualPtr pVis;
 
     pVis = pCmap->pVisual;
     pCmap->devPriv = xalloc(sizeof(XscreenPrivColormap));
-    XS_CMAP_PRIV(pCmap)->colormap = XCBCOLORMAPNew(xsConnection);
+    XS_CMAP_PRIV(pCmap)->colormap = xcb_generate_id(xsConnection);
     vid = xsGetVisual(pVis)->visual_id;   
-    XCBCreateColormap(xsConnection,
-                      (pVis->class & DynamicClass) ?  XCBColormapAllocAll : XCBColormapAllocNone,
+    xcb_create_colormap(xsConnection,
+                      (pVis->class & DynamicClass) ?  XCB_COLORMAP_ALLOC_ALL : XCB_COLORMAP_ALLOC_NONE,
                       XS_CMAP_PRIV(pCmap)->colormap,
-                      xsBackingRoot.window,
+                      xsBackingRoot,
                       vid);
 }
 
@@ -40,7 +40,7 @@ Bool xsCreateColormap(ColormapPtr pCmap)
  **/
 void xsDestroyColormap(ColormapPtr pCmap)
 {
-    XCBFreeColormap(xsConnection, XS_CMAP_PRIV(pCmap)->colormap);
+    xcb_free_colormap(xsConnection, XS_CMAP_PRIV(pCmap)->colormap);
     xfree(pCmap->devPriv);
 }
 
@@ -53,7 +53,7 @@ void xsSetInstalledColormapWindows(Scree
 void xsDirectUninstallColormaps(ScreenPtr pScreen)
 {
     int i, n;
-    XCBCOLORMAP pCmapIDs[MAXCMAPS];
+    xcb_colormap_t pCmapIDs[MAXCMAPS];
 
     /*do I want this? What does it do?
     if (!xsDoDirectColormaps) 
@@ -64,11 +64,12 @@ void xsDirectUninstallColormaps(ScreenPt
     for (i = 0; i < n; i++) {
         ColormapPtr pCmap;
 
-        pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i].xid, RT_COLORMAP);
+        pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP);
         if (pCmap)
-            XCBUninstallColormap(xsConnection, XS_CMAP_PRIV(pCmap)->colormap);
+            xcb_uninstall_colormap(xsConnection, XS_CMAP_PRIV(pCmap)->colormap);
     }
 }
+
 void xsInstallColormap(ColormapPtr pCmap)
 {
     int index;
@@ -104,18 +105,18 @@ void xsUninstallColormap(ColormapPtr pCm
     }
 }
 
-void xsStoreColors(ColormapPtr pCmap, int nColors, XCBCOLORITEM *pColors)
+void xsStoreColors(ColormapPtr pCmap, int nColors, xcb_coloritem_t *pColors)
 {
 }
 
-void xsResolveColor(CARD16 *r, CARD16 *g, CARD16 *b, VisualPtr pVisual)
+void xsResolveColor(uint16_t *r, uint16_t *g, uint16_t *b, VisualPtr pVisual)
 {
 }
 
-int xsListInstalledColormaps(ScreenPtr pScreen, XCBCOLORMAP *pCmapIDs)
+int xsListInstalledColormaps(ScreenPtr pScreen, xcb_colormap_t *pCmapIDs)
 {
     if (xsInstalledMap) {
-        pCmapIDs->xid = xsInstalledMap->mid;
+        pCmapIDs = xsInstalledMap->mid;
         return 1;
     }
     else
diff --git a/hw/xscreen/xs-color.h b/hw/xscreen/xs-color.h
index b4cb2a9..786bc32 100644
--- a/hw/xscreen/xs-color.h
+++ b/hw/xscreen/xs-color.h
@@ -5,7 +5,7 @@
 #define MAXCMAPS 1
 
 typedef struct {
-  XCBCOLORMAP colormap;
+  xcb_colormap_t colormap;
 } XscreenPrivColormap;
 
 #define XS_CMAP_PRIV(pCmap) \
@@ -15,9 +15,9 @@ Bool xsCreateColormap(ColormapPtr pCmap)
 void xsDestroyColormap(ColormapPtr pCmap);
 void xsInstallColormap(ColormapPtr pCmap);
 void xsUninstallColormap(ColormapPtr pCmap);
-int  xsListInstalledColormaps(ScreenPtr pScreen, XCBCOLORMAP *pCmapIDs);
-void xsStoreColors(ColormapPtr pCmap, int nColors, XCBCOLORITEM *pColors);
-void xsResolveColor(CARD16 *r, CARD16 *g, CARD16 *b, VisualPtr pVisual);
+int  xsListInstalledColormaps(ScreenPtr pScreen, xcb_colormap_t *pCmapIDs);
+void xsStoreColors(ColormapPtr pCmap, int nColors, xcb_coloritem_t *pColors);
+void xsResolveColor(uint16_t *r, uint16_t *g, uint16_t *b, VisualPtr pVisual);
 
 void xsSetInstalledColormapWindows(ScreenPtr pScreen);
 //void xsSetScreenSaverColormapWindow(ScreenPtr pScreen);
diff --git a/hw/xscreen/xs-event.c b/hw/xscreen/xs-event.c
index 16665da..6391aa6 100644
--- a/hw/xscreen/xs-event.c
+++ b/hw/xscreen/xs-event.c
@@ -2,10 +2,10 @@
 #include <xs-config.h>
 #endif
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_image.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_image.h>
 #include "regionstr.h"
 #include "gcstruct.h"
 #include "scrnintstr.h"
@@ -18,16 +18,16 @@
 #include "xs-globals.h"
 #include "xs-window.h"
 
-void xsDoConfigure(XCBConfigureNotifyEvent *e)
+void xsDoConfigure(xcb_configure_notify_event_t *e)
 {
 }
 
-void xsHandleEvent(XCBGenericEvent *evt)
+void xsHandleEvent(xcb_generic_event_t *evt)
 {
     switch (evt->response_type & ~0x80)
     {
-        case XCBConfigureNotify:
-            xsDoConfigure((XCBConfigureNotifyEvent *)evt);
+        case XCB_CONFIGURE_NOTIFY:
+            xsDoConfigure((xcb_configure_notify_event_t *)evt);
             break;
         default:
             ErrorF("Warning: Unhandled Event");
diff --git a/hw/xscreen/xs-font.c b/hw/xscreen/xs-font.c
index 1e83013..d17d29b 100644
--- a/hw/xscreen/xs-font.c
+++ b/hw/xscreen/xs-font.c
@@ -2,10 +2,10 @@
 #include <xs-config.h>
 #endif
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_image.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_image.h>
 #include "regionstr.h"
 #include <X11/fonts/fontstruct.h>
 #include "gcstruct.h"
@@ -23,8 +23,8 @@
 Bool xsRealizeFont(ScreenPtr pScreen, FontPtr pFont)
 {
     pointer priv;
-    XCBFONT font;
-    XCBATOM name_atom, value_atom;
+    xcb_font_t font;
+    xcb_atom_t name_atom, value_atom;
 
     int nprops;
     FontPropPtr props;
@@ -33,33 +33,33 @@ Bool xsRealizeFont(ScreenPtr pScreen, Fo
 
     FontSetPrivate(pFont, xsFontPrivateIndex, NULL);
 
-    name_atom.xid = MakeAtom("FONT", 4, TRUE);
-    value_atom.xid = 0L;
+    name_atom = MakeAtom("FONT", 4, TRUE);
+    value_atom = 0L;
 
     nprops = pFont->info.nprops;
     props = pFont->info.props;
 
     for (i = 0; i < nprops; i++) {
-        if (props[i].name == name_atom.xid) {
-            value_atom.xid = props[i].value;
+        if (props[i].name == name_atom) {
+            value_atom = props[i].value;
             break;
         }
     }
-    if (!value_atom.xid)
+    if (!value_atom)
         return FALSE;
 
-    name = NameForAtom(value_atom.xid);
+    name = NameForAtom(value_atom);
     if (!name)
         return FALSE;
 
     priv = xalloc(sizeof(XscreenPrivFont));
     FontSetPrivate(pFont, xsFontPrivateIndex, priv);
 
-    font = XCBFONTNew(xsConnection);
+    font = xcb_generate_id(xsConnection);
     XS_FONT_PRIV(pFont)->font = font;
-    XCBOpenFont(xsConnection, font, strlen(name), name);
+    xcb_open_font(xsConnection, font, strlen(name), name);
 
-    if (!XS_FONT_PRIV(pFont)->font.xid)
+    if (!XS_FONT_PRIV(pFont)->font)
         return FALSE;
 
     return TRUE;
@@ -68,8 +68,8 @@ Bool xsRealizeFont(ScreenPtr pScreen, Fo
 Bool xsUnrealizeFont(ScreenPtr pScreen, FontPtr pFont)
 {
     if (XS_FONT_PRIV(pFont)) {
-        if (XS_FONT_PRIV(pFont)->font.xid) 
-            XCBCloseFont(xsConnection, XS_FONT_PRIV(pFont)->font);
+        if (XS_FONT_PRIV(pFont)->font) 
+            xcb_close_font(xsConnection, XS_FONT_PRIV(pFont)->font);
         xfree(XS_FONT_PRIV(pFont));
         FontSetPrivate(pFont, xsFontPrivateIndex, NULL);
     }
diff --git a/hw/xscreen/xs-font.h b/hw/xscreen/xs-font.h
index 90c7024..a9eeaf1 100644
--- a/hw/xscreen/xs-font.h
+++ b/hw/xscreen/xs-font.h
@@ -2,7 +2,7 @@
 #define _XS_FONT_INCL_
 
 typedef struct {
-    XCBFONT font;
+    xcb_font_t font;
 } XscreenPrivFont;
 
 
diff --git a/hw/xscreen/xs-gc.c b/hw/xscreen/xs-gc.c
index 6d000ac..4273c47 100644
--- a/hw/xscreen/xs-gc.c
+++ b/hw/xscreen/xs-gc.c
@@ -18,9 +18,9 @@
 #endif
 
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_aux.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_aux.h>
 #include "gcstruct.h"
 #include "windowstr.h"
 #include "pixmapstr.h"
@@ -80,8 +80,8 @@ Bool xsCreateGC(GCPtr pGC)
 
     pGC->miTranslate = 1;
 
-    XS_GC_PRIV(pGC)->gc = XCBGCONTEXTNew(xsConnection);
-    XCBCreateGC(xsConnection, 
+    XS_GC_PRIV(pGC)->gc = xcb_generate_id(xsConnection);
+    xcb_create_gc(xsConnection, 
                 XS_GC_PRIV(pGC)->gc,
                 xsDefaultDrawables[pGC->depth],
                 0L,
@@ -99,107 +99,107 @@ void xsValidateGC(GCPtr pGC, unsigned lo
 
 void xsChangeGC(GCPtr pGC, unsigned long mask)
 {
-    XCBParamsGC values;
+    xcb_params_gc_t values;
 
-    if (mask & XCBGCFunction)
+    if (mask & XCB_GC_FUNCTION)
         values.function = pGC->alu;
 
-    if (mask & XCBGCPlaneMask)
+    if (mask & XCB_GC_PLANE_MASK)
         values.plane_mask = pGC->planemask;
 
-    if (mask & XCBGCForeground)
+    if (mask & XCB_GC_FOREGROUND)
         values.foreground = pGC->fgPixel;
 
-    if (mask & XCBGCBackground)
+    if (mask & XCB_GC_BACKGROUND)
         values.background = pGC->bgPixel;
 
-    if (mask & XCBGCLineWidth)
+    if (mask & XCB_GC_LINE_WIDTH)
         values.line_width = pGC->lineWidth;
 
-    if (mask & XCBGCLineStyle)
+    if (mask & XCB_GC_LINE_STYLE)
         values.line_style = pGC->lineStyle;
 
-    if (mask & XCBGCCapStyle)
+    if (mask & XCB_GC_CAP_STYLE)
         values.cap_style = pGC->capStyle;
 
-    if (mask & XCBGCJoinStyle)
+    if (mask & XCB_GC_JOIN_STYLE)
         values.join_style = pGC->joinStyle;
 
-    if (mask & XCBGCFillStyle)
+    if (mask & XCB_GC_FILL_STYLE)
         values.fill_style = pGC->fillStyle;
 
-    if (mask & XCBGCFillRule)
+    if (mask & XCB_GC_FILL_RULE)
         values.fill_rule = pGC->fillRule;
 
-    if (mask & XCBGCTile) {
+    if (mask & XCB_GC_TILE) {
         if (pGC->tileIsPixel)
             mask &= ~GCTile;
         else
-            values.tile = XS_PIXMAP_PRIV(pGC->tile.pixmap)->pixmap.xid;
+            values.tile = XS_PIXMAP_PRIV(pGC->tile.pixmap)->pixmap;
     }
 
-    if (mask & XCBGCStipple)
-        values.stipple = XS_PIXMAP_PRIV(pGC->stipple)->pixmap.xid;
+    if (mask & XCB_GC_STIPPLE)
+        values.stipple = XS_PIXMAP_PRIV(pGC->stipple)->pixmap;
 
-    if (mask & XCBGCTileStippleOriginX)
+    if (mask & XCB_GC_TILE_STIPPLE_ORIGIN_X)
         values.tile_stipple_originX = pGC->patOrg.x;
 
-    if (mask & XCBGCTileStippleOriginY)
+    if (mask & XCB_GC_TILE_STIPPLE_ORIGIN_Y)
         values.tile_stipple_originY = pGC->patOrg.y;
 
-    if (mask & XCBGCFont)
-        values.font = XS_FONT_PRIV(pGC->font)->font.xid;
+    if (mask & XCB_GC_FONT)
+        values.font = XS_FONT_PRIV(pGC->font)->font;
 
-    if (mask & XCBGCSubwindowMode)
+    if (mask & XCB_GC_SUBWINDOW_MODE)
         values.subwindow_mode = pGC->subWindowMode;
 
-    if (mask & XCBGCGraphicsExposures)
+    if (mask & XCB_GC_GRAPHICS_EXPOSURES)
         values.graphics_exposures = pGC->graphicsExposures;
 
-    if (mask & XCBGCClipOriginY)
+    if (mask & XCB_GC_CLIP_ORIGIN_Y)
         values.clip_originX = pGC->clipOrg.x;
 
-    if (mask & XCBGCClipOriginX)
+    if (mask & XCB_GC_CLIP_ORIGIN_X)
         values.clip_originY = pGC->clipOrg.y;
 
-    if (mask & XCBGCClipMask) /* this is handled in change clip */
+    if (mask & XCB_GC_CLIP_MASK) /* this is handled in change clip */
         mask &= ~GCClipMask;
 
-    if (mask & XCBGCDashOffset)
+    if (mask & XCB_GC_DASH_OFFSET)
         values.dash_offset = pGC->dashOffset;
 
-    if (mask & XCBGCDashList) {
+    if (mask & XCB_GC_DASH_LIST) {
         mask &= ~GCDashList;
-        XCBSetDashes(xsConnection, 
+        xcb_set_dashes(xsConnection, 
                      XS_GC_PRIV(pGC)->gc, 
                      pGC->dashOffset, 
                      pGC->numInDashList,
-                     (BYTE *)pGC->dash);
+                     (uint8_t *)pGC->dash);
     }
 
-    if (mask & XCBGCArcMode)
+    if (mask & XCB_GC_ARC_MODE)
         values.arc_mode = pGC->arcMode;
 
     if (mask)
-        XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, mask, &values);
+        xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, mask, &values);
 }
 
 void xsCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst)
 {
-    XCBCopyGC(xsConnection, XS_GC_PRIV(pGCSrc)->gc, XS_GC_PRIV(pGCDst)->gc, mask);
+    xcb_copy_gc(xsConnection, XS_GC_PRIV(pGCSrc)->gc, XS_GC_PRIV(pGCDst)->gc, mask);
 }
 
 void xsDestroyGC(GCPtr pGC)
 {
-    XCBFreeGC(xsConnection, XS_GC_PRIV(pGC)->gc);
+    xcb_free_gc(xsConnection, XS_GC_PRIV(pGC)->gc);
 }
 
 void xsChangeClip(GCPtr pGC, int type, pointer pValue, int nRects)
 {
     int i, size;
     BoxPtr pBox;
-    XCBRECTANGLE *pRects;
-    XCBParamsGC param;
+    xcb_rectangle_t *pRects;
+    xcb_params_gc_t param;
 
     xsDestroyClipHelper(pGC);
 
@@ -207,7 +207,7 @@ void xsChangeClip(GCPtr pGC, int type, p
     {
         case CT_NONE:
             param.mask = None;
-            XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, XCBGCClipMask, &param);
+            xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, XCB_GC_CLIP_MASK, &param);
             break;
 
         case CT_REGION:
@@ -221,8 +221,8 @@ void xsChangeClip(GCPtr pGC, int type, p
                 pRects[i].width = pBox[i].x2 - pBox[i].x1;
                 pRects[i].height = pBox[i].y2 - pBox[i].y1;
             }
-            XCBSetClipRectangles(xsConnection, 
-                    XCBClipOrderingUnsorted,
+            xcb_set_clip_rectangles(xsConnection, 
+                    XCB_CLIP_ORDERING_UNSORTED,
                     XS_GC_PRIV(pGC)->gc, 
                     0, 0,
                     nRects,
@@ -231,8 +231,8 @@ void xsChangeClip(GCPtr pGC, int type, p
             break;
 
         case CT_PIXMAP:
-            param.mask = XS_PIXMAP_PRIV((PixmapPtr)pValue)->pixmap.xid;
-            XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, XCBGCClipMask, &param);
+            param.mask = XS_PIXMAP_PRIV((PixmapPtr)pValue)->pixmap;
+            xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, XCB_GC_CLIP_MASK, &param);
             /*
              * Need to change into region, so subsequent uses are with
              * current pixmap contents.
@@ -244,17 +244,17 @@ void xsChangeClip(GCPtr pGC, int type, p
             break;
 
         case CT_UNSORTED:
-            XCBSetClipRectangles(xsConnection,
-                    XCBClipOrderingUnsorted,
+            xcb_set_clip_rectangles(xsConnection,
+                    XCB_CLIP_ORDERING_UNSORTED,
                     XS_GC_PRIV(pGC)->gc, 
                     pGC->clipOrg.x,
                     pGC->clipOrg.y,
                     nRects,
-                    (XCBRECTANGLE *)pValue);
+                    (xcb_rectangle_t *)pValue);
             break;
         case CT_YSORTED:
-            XCBSetClipRectangles(xsConnection,
-                    XCBClipOrderingYSorted,
+            xcb_set_clip_rectangles(xsConnection,
+                    XCB_CLIP_ORDERING_Y_SORTED,
                     XS_GC_PRIV(pGC)->gc, 
                     pGC->clipOrg.x,
                     pGC->clipOrg.y,
@@ -262,8 +262,8 @@ void xsChangeClip(GCPtr pGC, int type, p
                     pValue);
             break;
         case CT_YXSORTED:
-            XCBSetClipRectangles(xsConnection,
-                    XCBClipOrderingYXSorted,
+            xcb_set_clip_rectangles(xsConnection,
+                    XCB_CLIP_ORDERING_YX_SORTED,
                     XS_GC_PRIV(pGC)->gc, 
                     pGC->clipOrg.x,
                     pGC->clipOrg.y,
@@ -271,8 +271,8 @@ void xsChangeClip(GCPtr pGC, int type, p
                     pValue);
             break;
         case CT_YXBANDED:
-            XCBSetClipRectangles(xsConnection,
-                    XCBClipOrderingYXBanded,
+            xcb_set_clip_rectangles(xsConnection,
+                    XCB_CLIP_ORDERING_YX_BANDED,
                     XS_GC_PRIV(pGC)->gc, 
                     pGC->clipOrg.x,
                     pGC->clipOrg.y,
@@ -311,11 +311,11 @@ void xsChangeClip(GCPtr pGC, int type, p
 
 void xsDestroyClip(GCPtr pGC)
 {
-    XCBParamsGC param;
+    xcb_params_gc_t param;
     param.mask = None;
     xsDestroyClipHelper(pGC);
 
-    XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, XCBGCClipMask, &param);
+    xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, XCB_GC_CLIP_MASK, &param);
 
 
     pGC->clientClipType = CT_NONE;
diff --git a/hw/xscreen/xs-gc.h b/hw/xscreen/xs-gc.h
index 95030ac..97fefe4 100644
--- a/hw/xscreen/xs-gc.h
+++ b/hw/xscreen/xs-gc.h
@@ -2,7 +2,7 @@
 #define _XS_GC_INCL_ 
 
 typedef struct {
-  XCBGCONTEXT gc;
+  xcb_gcontext_t gc;
 } XscreenPrivGC;
 
 extern int xsGCPrivateIndex;
diff --git a/hw/xscreen/xs-gcops.c b/hw/xscreen/xs-gcops.c
index 36be4bf..75f1b93 100644
--- a/hw/xscreen/xs-gcops.c
+++ b/hw/xscreen/xs-gcops.c
@@ -2,10 +2,10 @@
 #include <xs-config.h>
 #endif
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_image.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_image.h>
 #include "regionstr.h"
 #include <X11/fonts/fontstruct.h>
 #include "gcstruct.h"
@@ -43,12 +43,12 @@ void xsGetSpans(DrawablePtr pDrawable, i
 void xsQueryBestSize(int class, unsigned short *pWidth, unsigned short *pHeight,
         ScreenPtr pScreen)
 {
-    XCBQueryBestSizeCookie c;
-    XCBQueryBestSizeRep    *r;
+    xcb_query_best_size_cookie_t c;
+    xcb_query_best_size_reply_t    *r;
 
 
-    c = XCBQueryBestSize(xsConnection, class, (XCBDRAWABLE)xsBackingRoot, *pWidth,*pHeight);
-    r = XCBQueryBestSizeReply(xsConnection, c, NULL);
+    c = xcb_query_best_size(xsConnection, class, (xcb_drawable_t)xsBackingRoot, *pWidth,*pHeight);
+    r = xcb_query_best_size_reply(xsConnection, c, NULL);
 
     *pWidth = r->width;
     *pHeight = r->height;
@@ -58,9 +58,8 @@ void xsPutImage(DrawablePtr pDrawable, G
         int w, int h, int leftPad, int format, char *pImage)
 {
     int size;
-    int i;
     size = xsPixmapCalcSize(depth, w, h);
-    XCBPutImage(xsConnection,
+    xcb_put_image(xsConnection,
                 format,
                 XS_DRAWABLE_ID(pDrawable),
                 XS_GC_PRIV(pGC)->gc,
@@ -69,17 +68,17 @@ void xsPutImage(DrawablePtr pDrawable, G
                 leftPad,
                 depth,
                 size,
-                (CARD8*) (pImage+leftPad));
+                (uint8_t*) (pImage+leftPad));
 }
 
 void xsGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
         unsigned int format, unsigned long planeMask,
         char *pImage)
 {
-    XCBImage *img;
+    xcb_image_t *img;
     int length;
 
-    img = XCBImageGet(xsConnection,
+    img = xcb_image_get(xsConnection,
                       XS_DRAWABLE_ID(pDrawable),
                       x, y,
                       w, h,
@@ -89,13 +88,13 @@ void xsGetImage(DrawablePtr pDrawable, i
     if (img) {
         length = img->bytes_per_line * img->height;
         memmove(pImage, img->data, length);
-        XCBImageDestroy(img);
+        xcb_image_destroy(img);
     }
 }
 
-static Bool xsBitBlitPredicate(XCBGenericEvent *event)
+static Bool xsBitBlitPredicate(xcb_generic_event_t *event)
 {
-    return (event->response_type == XCBGraphicsExposure || event->response_type == XCBNoExposure);
+    return (event->response_type == XCB_GRAPHICS_EXPOSURE || event->response_type == XCB_NO_EXPOSURE);
 }
 
 static RegionPtr xsBitBlitHelper(GCPtr pGC)
@@ -104,8 +103,8 @@ static RegionPtr xsBitBlitHelper(GCPtr p
     if (!pGC->graphicsExposures) 
         return NullRegion;
     else {
-        XCBGenericEvent *event;
-        XCBGraphicsExposureEvent *exp;
+        xcb_generic_event_t *event;
+        xcb_graphics_exposure_event_t *exp;
         RegionPtr pReg, pTmpReg;
         BoxRec Box;
         Bool pending, overlap;
@@ -117,16 +116,16 @@ static RegionPtr xsBitBlitHelper(GCPtr p
 
         pending = TRUE;
         while (pending) {
-            event = XCBPollForEvent(xsConnection, &err);
+            event = xcb_poll_for_event(xsConnection);
             if (!event)
                 break;
             switch (event->response_type) {
-                case XCBNoExposure:
+                case XCB_NO_EXPOSURE:
                     pending = FALSE;
                     break;
 
-                case XCBGraphicsExposure:
-                    exp = (XCBGraphicsExposureEvent *) event;
+                case XCB_GRAPHICS_EXPOSURE:
+                    exp = (xcb_graphics_exposure_event_t *) event;
                     Box.x1 = exp->x;
                     Box.y1 = exp->y;
                     Box.x2 = exp->x + exp->width;
@@ -152,7 +151,7 @@ RegionPtr xsCopyArea(DrawablePtr pSrcDra
         GCPtr pGC, int srcx, int srcy, int width, int height,
         int dstx, int dsty)
 {
-    XCBCopyArea(xsConnection, 
+    xcb_copy_area(xsConnection, 
                 XS_DRAWABLE_ID(pSrcDrawable),
                 XS_DRAWABLE_ID(pDstDrawable),
                 XS_GC_PRIV(pGC)->gc,
@@ -167,7 +166,7 @@ RegionPtr xsCopyPlane(DrawablePtr pSrcDr
         GCPtr pGC, int srcx, int srcy, int width, int height,
         int dstx, int dsty, unsigned long plane)
 {
-    XCBCopyPlane(xsConnection,
+    xcb_copy_plane(xsConnection,
                  XS_DRAWABLE_ID(pSrcDrawable),
                  XS_DRAWABLE_ID(pDstDrawable),
                  XS_GC_PRIV(pGC)->gc,
@@ -182,112 +181,112 @@ RegionPtr xsCopyPlane(DrawablePtr pSrcDr
 void xsPolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
         DDXPointPtr pPoints)
 {
-    XCBPolyPoint(xsConnection,
+    xcb_poly_point(xsConnection,
                  mode,
                  XS_DRAWABLE_ID(pDrawable),
                  XS_GC_PRIV(pGC)->gc,
                  nPoints,
-                 (XCBPOINT *)pPoints);
+                 (xcb_point_t *)pPoints);
 }
 
 void xsPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int nPoints,
         DDXPointPtr pPoints)
 {
-    XCBPolyLine(xsConnection,
+    xcb_poly_line(xsConnection,
                  mode,
                  XS_DRAWABLE_ID(pDrawable),
                  XS_GC_PRIV(pGC)->gc,
                  nPoints,
-                 (XCBPOINT *)pPoints);
+                 (xcb_point_t *)pPoints);
 }
 
 void xsPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nSegments,
         xSegment *pSegments)
 {
-    XCBPolySegment(xsConnection,
+    xcb_poly_segment(xsConnection,
                    XS_DRAWABLE_ID(pDrawable),
                    XS_GC_PRIV(pGC)->gc,
                    nSegments,
-                   (XCBSEGMENT *)pSegments);
+                   (xcb_segment_t *)pSegments);
 }
 
 void xsPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
         xRectangle *pRectangles)
 {
-    XCBPolyRectangle(xsConnection,
+    xcb_poly_rectangle(xsConnection,
                      XS_DRAWABLE_ID(pDrawable),
                      XS_GC_PRIV(pGC)->gc,
                      nRectangles,
-                     (XCBRECTANGLE *)pRectangles);
+                     (xcb_rectangle_t *)pRectangles);
 }
 
 void xsPolyArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
 {
-    XCBPolyArc(xsConnection,
+    xcb_poly_arc(xsConnection,
                XS_DRAWABLE_ID(pDrawable),
                XS_GC_PRIV(pGC)->gc,
                nArcs,
-               (XCBARC *)pArcs);
+               (xcb_arc_t *)pArcs);
 }
 
 void xsFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode,
         int nPoints, DDXPointPtr pPoints)
 {
-    XCBFillPoly(xsConnection,
+    xcb_fill_poly(xsConnection,
                 XS_DRAWABLE_ID(pDrawable),
                 XS_GC_PRIV(pGC)->gc, 
                 shape,
                 mode,
                 nPoints,
-                (XCBPOINT *)pPoints);
+                (xcb_point_t *)pPoints);
 }
 
 void xsPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nRectangles,
         xRectangle *pRectangles)
 {
-XCBPolyFillRectangle(xsConnection,
+xcb_poly_fill_rectangle(xsConnection,
                      XS_DRAWABLE_ID(pDrawable),
                      XS_GC_PRIV(pGC)->gc,
                      nRectangles,
-                     (XCBRECTANGLE*)pRectangles);
+                     (xcb_rectangle_t*)pRectangles);
 }
 
 void xsPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int nArcs, xArc *pArcs)
 {
-    XCBPolyFillArc(xsConnection,
+    xcb_poly_fill_arc(xsConnection,
                    XS_DRAWABLE_ID(pDrawable),
                    XS_GC_PRIV(pGC)->gc,
                    nArcs,
-                   (XCBARC *)pArcs);
+                   (xcb_arc_t *)pArcs);
 }
 
 int xsPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *string)
 {
 #if 0
     int width, i;
-    XCBCHAR2B *str;
-    XCBFONTABLE f;
-    XCBQueryTextExtentsCookie c;
-    XCBQueryTextExtentsRep *r;
-    XCBGenericError *e;
+    xcb_char2b_t *str;
+    xcb_fontable_t f;
+    xcb_query_text_extents_cookie_t c;
+    xcb_query_text_extents_reply_t *r;
+    xcb_generic_error_t *e;
 
-    XCBPolyText8(xsConnection,
+    xcb_poly_text_8(xsConnection,
                  XS_DRAWABLE_ID(pDrawable),
                  XS_GC_PRIV(pGC)->gc,
                  x, y,
                  count,
-                 (BYTE *)string);
+                 (uint8_t *)string);
     
     f.font = xsFont(pGC->font);
     f.gcontext = XS_GC_PRIV(pGC)->gc;
-    str = xalloc(count * sizeof(XCBCHAR2B));
+    str = xalloc(count * sizeof(xcb_char2b_t));
     for (i=0; i<count; i++) {
         str[i].byte1 = string[i];
         str[i].byte2 = '\0';
     }
-    c = XCBQueryTextExtents(xsConnection, f, count, str);
+    c = xcb_query_text_extents(xsConnection, f, count, str);
     xfree(str);
-    r = XCBQueryTextExtentsReply(xsConnection, c, NULL);
+    r = xcb_query_text_extents_reply(xsConnection, c, NULL);
     if (r)
         if (!e)
             width = r->overall_width;
@@ -303,21 +302,21 @@ int xsPolyText16(DrawablePtr pDrawable, 
 {
 #if 0
     int width = 0;
-    XCBFONTABLE f;
-    XCBQueryTextExtentsCookie c;
-    XCBQueryTextExtentsRep *r;
-    XCBGenericError *e;
+    xcb_fontable_t f;
+    xcb_query_text_extents_cookie_t c;
+    xcb_query_text_extents_reply_t *r;
+    xcb_generic_error_t *e;
 
-    XCBPolyText16(xsConnection,
+    xcb_poly_text_16(xsConnection,
                   XS_DRAWABLE_ID(pDrawable),
                   XS_GC_PRIV(pGC)->gc,
                   x, y,
                   count*2,
-                  (BYTE *)string);
+                  (uint8_t *)string);
     f.font = xsFont(pGC->font);
     f.gcontext = XS_GC_PRIV(pGC)->gc;
-    c = XCBQueryTextExtents(xsConnection, f, count, (XCBCHAR2B*)string);
-    r = XCBQueryTextExtentsReply(xsConnection, c, &e);
+    c = xcb_query_text_extents(xsConnection, f, count, (xcb_char2b_t*)string);
+    r = xcb_query_text_extents_reply(xsConnection, c, &e);
     if (r)
         if (!e)
             width = r->overall_width;
@@ -330,7 +329,7 @@ int xsPolyText16(DrawablePtr pDrawable, 
 void xsImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count,
         char *string)
 {
-    XCBImageText8(xsConnection,
+    xcb_image_text_8(xsConnection,
                   count,
                   XS_DRAWABLE_ID(pDrawable),
                   XS_GC_PRIV(pGC)->gc,
@@ -340,12 +339,12 @@ void xsImageText8(DrawablePtr pDrawable,
 
 void xsImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *string)
 {
-    XCBImageText16(xsConnection,
+    xcb_image_text_16(xsConnection,
                    count,
                    XS_DRAWABLE_ID(pDrawable),
                    XS_GC_PRIV(pGC)->gc,
                    x, y,
-                   (XCBCHAR2B *)string);
+                   (xcb_char2b_t *)string);
 }
 
 void xsImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y,
@@ -365,30 +364,30 @@ void xsPolyGlyphBlt(DrawablePtr pDrawabl
 void xsPushPixels(GCPtr pGC, PixmapPtr pBitmap, DrawablePtr pDst,
         int width, int height, int x, int y)
 {
-    XCBParamsGC param;
-    XCBRECTANGLE rect;
+    xcb_params_gc_t param;
+    xcb_rectangle_t rect;
     /* only works for solid bitmaps */
     if (pGC->fillStyle == FillSolid)
     {
-        param.stipple = XS_PIXMAP_PRIV(pBitmap)->pixmap.xid;
+        param.stipple = XS_PIXMAP_PRIV(pBitmap)->pixmap;
         param.tile_stipple_originX = x;
         param.tile_stipple_originY = y;
-        param.fill_style = XCBFillStyleStippled;
-        XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, 
-                       XCBGCStipple | XCBGCTileStippleOriginX | XCBGCTileStippleOriginY | XCBGCFillStyle,
+        param.fill_style = XCB_FILL_STYLE_STIPPLED;
+        xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, 
+                       XCB_GC_STIPPLE | XCB_GC_TILE_STIPPLE_ORIGIN_X | XCB_GC_TILE_STIPPLE_ORIGIN_Y | XCB_GC_FILL_STYLE,
                        &param);
         rect.x = x;
         rect.y = y;
         rect.width = width;
         rect.height = height;
-        XCBPolyFillRectangle (xsConnection,
+        xcb_poly_fill_rectangle (xsConnection,
                           XS_DRAWABLE_ID(pDst),
                           XS_GC_PRIV(pGC)->gc,
                           1,
                           &rect);
-        param.fill_style = XCBFillStyleSolid;
-         XCBAuxChangeGC(xsConnection, XS_GC_PRIV(pGC)->gc, 
-                       XCBGCFillStyle,
+        param.fill_style = XCB_FILL_STYLE_SOLID;
+         xcb_aux_change_gc(xsConnection, XS_GC_PRIV(pGC)->gc, 
+                       XCB_GC_FILL_STYLE,
                        &param);
     }
     else
diff --git a/hw/xscreen/xs-globals.c b/hw/xscreen/xs-globals.c
index 2ae894c..6954cfa 100644
--- a/hw/xscreen/xs-globals.c
+++ b/hw/xscreen/xs-globals.c
@@ -1,5 +1,5 @@
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
+#include <xcb/xcb.h>
 #include "screenint.h"
 #include "scrnintstr.h"
 
@@ -7,9 +7,9 @@
 #include "xs-gc.h"
 #include "xs-window.h"
 
-XCBConnection *xsConnection;
-XCBDRAWABLE    xsDefaultDrawables[MAXDEPTH];
-XCBDRAWABLE    xsBackingRoot;
+xcb_connection_t *xsConnection;
+xcb_drawable_t    xsDefaultDrawables[MAXDEPTH];
+xcb_drawable_t    xsBackingRoot;
 int            xsFontPrivateIndex;
 int            xsGCPrivateIndex;
 int            xsWindowPrivateIndex;
diff --git a/hw/xscreen/xs-globals.h b/hw/xscreen/xs-globals.h
index 79bdb9f..f30e248 100644
--- a/hw/xscreen/xs-globals.h
+++ b/hw/xscreen/xs-globals.h
@@ -10,12 +10,12 @@ typedef enum {
 
 #define XS_DRAWABLE_ID(/*DrawablePtr*/ d) \
     (((d)->type == DRAWABLE_WINDOW)? \
-     ((XCBDRAWABLE) (XS_WINDOW_PRIV((WindowPtr)(d))->window)) : \
-     ((XCBDRAWABLE) (XS_PIXMAP_PRIV((PixmapPtr)(d))->pixmap)))
+     ((xcb_drawable_t) (XS_WINDOW_PRIV((WindowPtr)(d))->window)) : \
+     ((xcb_drawable_t) (XS_PIXMAP_PRIV((PixmapPtr)(d))->pixmap)))
 
-extern XCBConnection *xsConnection;
-extern XCBDRAWABLE    xsDefaultDrawables[MAXDEPTH];
-extern XCBDRAWABLE    xsBackingRoot;
+extern xcb_connection_t *xsConnection;
+extern xcb_drawable_t    xsDefaultDrawables[MAXDEPTH];
+extern xcb_drawable_t    xsBackingRoot;
 extern int            xsFontPrivateIndex;
 extern int            xsGCPrivateIndex;
 extern int            xsWindowPrivateIndex;
diff --git a/hw/xscreen/xs-init.c b/hw/xscreen/xs-init.c
index 90ba5ea..7d23de7 100644
--- a/hw/xscreen/xs-init.c
+++ b/hw/xscreen/xs-init.c
@@ -7,10 +7,10 @@
 /* need to include Xmd before XCB stuff, or
  * things get redeclared.*/
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/shape.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/shape.h>
 
 #include "gcstruct.h"
 #include "window.h"
@@ -26,12 +26,12 @@
 #include "mi.h"
 
 
-void xsInitPixmapFormats(const XCBSetup *setup, PixmapFormatRec fmts[])
+static void xsInitPixmapFormats(const xcb_setup_t *setup, PixmapFormatRec fmts[])
 {
-    XCBFORMAT *bs_fmts; /*formats on backing server*/
+    xcb_format_t *bs_fmts; /*formats on backing server*/
     int i;
 
-    bs_fmts = XCBSetupPixmapFormats(setup);
+    bs_fmts = xcb_setup_pixmap_formats(setup);
     for (i = 0; i < setup->pixmap_formats_len; i++) {
         fmts[i].depth = bs_fmts[i].depth;
         fmts[i].bitsPerPixel = bs_fmts[i].bits_per_pixel;
@@ -45,13 +45,13 @@ void xsInitPixmapFormats(const XCBSetup 
 void InitOutput(ScreenInfo *si, int argc, char *argv[])
 {
     int             screennum;
-    const XCBSetup *setup;
-    XCBSCREEN      *screen;
+    const xcb_setup_t *setup;
+    xcb_screen_t      *screen;
     char           *display;
 
     /*FIXME: add a "-display" option*/
     /*Globals Globals Everywhere.*/
-    xsConnection = XCBConnect(NULL, &screennum);
+    xsConnection = xcb_connect(NULL, &screennum);
 
     if (!xsConnection) { /* failure to connect */
         /* prettify the display name */
@@ -61,11 +61,11 @@ void InitOutput(ScreenInfo *si, int argc
         FatalError("Unable to open display \"%s\".\n", display);
     }
 
-    setup = XCBGetSetup(xsConnection);
+    setup = xcb_get_setup(xsConnection);
 
     /*set up the root window*/
-    screen = XCBSetupRootsIter(setup).data;
-    xsBackingRoot.window = screen->root;
+    screen = xcb_setup_roots_iterator(setup).data;
+    xsBackingRoot = screen->root;
     /*initialize the ScreenInfo pixmap/image fields*/
     si->imageByteOrder = setup->image_byte_order;
     si->bitmapScanlineUnit = setup->bitmap_format_scanline_unit;
diff --git a/hw/xscreen/xs-input.c b/hw/xscreen/xs-input.c
index ad63315..a2be4c3 100644
--- a/hw/xscreen/xs-input.c
+++ b/hw/xscreen/xs-input.c
@@ -19,10 +19,10 @@
 /* need to include Xmd before XCB stuff, or
  * things get redeclared.*/
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/shape.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/shape.h>
 
 #include "gcstruct.h"
 #include "window.h"
@@ -66,9 +66,9 @@ void OsVendorInit()
 {
 }
 
-void xsChangePointerControl(DeviceIntPtr pDev UNUSED, PtrCtrl *ctl)
+static void xsChangePointerControl(DeviceIntPtr pDev UNUSED, PtrCtrl *ctl)
 {
-    XCBChangePointerControl(xsConnection, 
+    xcb_change_pointer_control(xsConnection, 
                             ctl->num, ctl->den,
                             ctl->threshold,
                             TRUE, TRUE);
@@ -76,19 +76,19 @@ void xsChangePointerControl(DeviceIntPtr
 /**
  * Manages initializing and setting up the pointer.
  **/
-int xsPtrProc(DeviceIntPtr pDev, int state)
+static int xsPtrProc(DeviceIntPtr pDev, int state)
 {
-    CARD8 map[MAX_BUTTONS];
-    XCBGetPointerMappingCookie c;
-    XCBGetPointerMappingRep *r;
+    uint8_t map[MAX_BUTTONS];
+    xcb_get_pointer_mapping_cookie_t c;
+    xcb_get_pointer_mapping_reply_t *r;
     int nmap;
     int i;
 
     switch (state)
     {
         case DEVICE_INIT: 
-            c = XCBGetPointerMapping(xsConnection);
-            r = XCBGetPointerMappingReply(xsConnection, c, NULL);
+            c = xcb_get_pointer_mapping(xsConnection);
+            r = xcb_get_pointer_mapping_reply(xsConnection, c, NULL);
             nmap = r->map_len;
             for (i = 0; i <= nmap; i++)
                 map[i] = i; /* buttons are already mapped */
@@ -110,13 +110,13 @@ int xsPtrProc(DeviceIntPtr pDev, int sta
  **/
 
 /* no-op function */
-void xsBell(int vol UNUSED, DeviceIntPtr pDev UNUSED, pointer ctl UNUSED, int wtf_is_this UNUSED)
+static void xsBell(int vol UNUSED, DeviceIntPtr pDev UNUSED, pointer ctl UNUSED, int wtf_is_this UNUSED)
 {
     return;
 }
 
 /*no-op function*/
-void xsKbdCtl(DeviceIntPtr pDev UNUSED, KeybdCtrl *ctl UNUSED)
+static void xsKbdCtl(DeviceIntPtr pDev UNUSED, KeybdCtrl *ctl UNUSED)
 {
 }
 
@@ -124,29 +124,29 @@ void xsKbdCtl(DeviceIntPtr pDev UNUSED, 
 /**
  * Manages initializing and setting up the keyboard.
  **/
-int xsKbdProc(DeviceIntPtr pDev, int state)
+static int xsKbdProc(DeviceIntPtr pDev, int state)
 {   
-    const XCBSetup              *setup;
-    XCBGetKeyboardMappingCookie  mapcook;
-    XCBGetKeyboardMappingRep    *maprep;
-    XCBGetModifierMappingCookie  modcook;
-    XCBGetModifierMappingRep    *modrep;
-    XCBGetKeyboardControlCookie  ctlcook;
-    XCBGetKeyboardControlRep    *ctlrep;
+    const xcb_setup_t              *setup;
+    xcb_get_keyboard_mapping_cookie_t  mapcook;
+    xcb_get_keyboard_mapping_reply_t    *maprep;
+    xcb_get_modifier_mapping_cookie_t  modcook;
+    xcb_get_modifier_mapping_reply_t    *modrep;
+    xcb_get_keyboard_control_cookie_t  ctlcook;
+    xcb_get_keyboard_control_reply_t    *ctlrep;
 
 
-    XCBKEYCODE  min;
-    XCBKEYCODE  max;
-    XCBKEYSYM  *keysyms;
-    XCBKEYCODE *modcodes;
+    xcb_keycode_t  min;
+    xcb_keycode_t  max;
+    xcb_keysym_t  *keysyms;
+    xcb_keycode_t *modcodes;
 
     KeySymsRec  keys;
-    CARD8       modmap[MAP_LENGTH] = {0};
-    CARD8       keycode;
+    uint8_t       modmap[MAP_LENGTH] = {0};
+    uint8_t       keycode;
     int         i;
     int         j;
 
-    setup = XCBGetSetup(xsConnection);
+    setup = xcb_get_setup(xsConnection);
     switch (state) 
     {
         case DEVICE_INIT:
@@ -154,36 +154,36 @@ int xsKbdProc(DeviceIntPtr pDev, int sta
             max = setup->max_keycode;
 
             /*do all the requests*/
-            mapcook = XCBGetKeyboardMapping(xsConnection, min, max.id - min.id);
-            modcook = XCBGetModifierMapping(xsConnection);
-            ctlcook = XCBGetKeyboardControl(xsConnection);
+            mapcook = xcb_get_keyboard_mapping(xsConnection, min, max - min);
+            modcook = xcb_get_modifier_mapping(xsConnection);
+            ctlcook = xcb_get_keyboard_control(xsConnection);
 
             /*wait for the keyboard mapping*/
-            maprep = XCBGetKeyboardMappingReply(xsConnection, mapcook, NULL);
-            keysyms = XCBGetKeyboardMappingKeysyms(maprep);
+            maprep = xcb_get_keyboard_mapping_reply(xsConnection, mapcook, NULL);
+            keysyms = xcb_get_keyboard_mapping_keysyms(maprep);
 
             /* initialize the keycode list*/
-            keys.minKeyCode = min.id;
-            keys.maxKeyCode = max.id;
+            keys.minKeyCode = min;
+            keys.maxKeyCode = max;
             keys.mapWidth = maprep->keysyms_per_keycode;
             keys.map = (KeySym *)keysyms;
             
             /*wait for the modifier mapping*/
-            modrep = XCBGetModifierMappingReply(xsConnection, modcook, NULL);
-            modcodes = XCBGetModifierMappingKeycodes(modrep);
+            modrep = xcb_get_modifier_mapping_reply(xsConnection, modcook, NULL);
+            modcodes = xcb_get_modifier_mapping_keycodes(modrep);
 
 
             /*initialize the modifiers*/
             for (j = 0; j < 8; j++) {
                 for (i = 0; i < modrep->keycodes_per_modifier; i++) {
-                    keycode = modcodes[j * modrep->keycodes_per_modifier + i].id;
+                    keycode = modcodes[j * modrep->keycodes_per_modifier + i];
                     if (keycode != 0)
                         modmap[keycode] |= 1<<j;
                 }
             }
 
             /*wait for the ctl values*/
-            ctlrep = XCBGetKeyboardControlReply(xsConnection, ctlcook, NULL);
+            ctlrep = xcb_get_keyboard_control_reply(xsConnection, ctlcook, NULL);
             /*initialize the auto repeats*/
             memmove(defaultKeyboardControl.autoRepeats,
                     ctlrep->auto_repeats,
@@ -206,13 +206,13 @@ int xsKbdProc(DeviceIntPtr pDev, int sta
  * XCB.
  **/
 
-void xsBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
+static void xsBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask)
 {
     /*handle events here*/
-    XCBFlush(xsConnection);
+    xcb_flush(xsConnection);
 }
 
-void xsWakeupHandler(pointer blockData, int result, pointer pReadMask)
+static void xsWakeupHandler(pointer blockData, int result, pointer pReadMask)
 {
     /*handle events here*/
 }
@@ -227,7 +227,7 @@ void InitInput(int argc, char *argv[])
 
     mieqInit(xsKbd, xsPtr);
 
-    AddEnabledDevice(XCBGetFileDescriptor(xsConnection));
+    AddEnabledDevice(xcb_get_file_descriptor(xsConnection));
     RegisterBlockAndWakeupHandlers(xsBlockHandler, xsWakeupHandler, NULL);
 }
 
diff --git a/hw/xscreen/xs-pixmap.c b/hw/xscreen/xs-pixmap.c
index b1d419f..e1b83de 100644
--- a/hw/xscreen/xs-pixmap.c
+++ b/hw/xscreen/xs-pixmap.c
@@ -19,9 +19,9 @@ is" without express or implied warranty.
 #endif
 
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_image.h> 
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_image.h> 
 #include "regionstr.h"
 #include "pixmapstr.h"
 #include "scrnintstr.h"
@@ -38,7 +38,7 @@ int XS_PIXMAP_PRIVIndex;	    
 #endif
 
 static int xsNumFormats;
-static XCBFORMAT *xsFormats;
+static xcb_format_t *xsFormats;
 
 /**
  * Initializes the list of available formats, used
@@ -46,11 +46,11 @@ static XCBFORMAT *xsFormats;
  **/
 void xsInitFormats()
 {
-    const XCBSetup *setup;
+    const xcb_setup_t *setup;
         
-    setup = XCBGetSetup(xsConnection);
-    xsNumFormats = XCBSetupPixmapFormatsLength(setup);
-    xsFormats = XCBSetupPixmapFormats(setup);
+    setup = xcb_get_setup(xsConnection);
+    xsNumFormats = xcb_setup_pixmap_formats_length(setup);
+    xsFormats = xcb_setup_pixmap_formats(setup);
 }
 
 /**
@@ -105,14 +105,14 @@ PixmapPtr xsCreatePixmap(ScreenPtr pScre
     pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
 #endif
     if (width && height){
-        XS_PIXMAP_PRIV(pPixmap)->pixmap = XCBPIXMAPNew(xsConnection); 
-        XCBCreatePixmap(xsConnection,
+        XS_PIXMAP_PRIV(pPixmap)->pixmap = xcb_generate_id(xsConnection); 
+        xcb_create_pixmap(xsConnection,
                 depth,
                 XS_PIXMAP_PRIV(pPixmap)->pixmap,
                 xsBackingRoot,
                 width, height);
     } else
-        XS_PIXMAP_PRIV(pPixmap)->pixmap.xid = 0;
+        XS_PIXMAP_PRIV(pPixmap)->pixmap = 0;
 
     return pPixmap;
 }
@@ -124,7 +124,7 @@ Bool xsDestroyPixmap(PixmapPtr pPixmap)
 {
     if(--pPixmap->refcnt)
         return TRUE;
-    XCBFreePixmap(xsConnection, XS_PIXMAP_PRIV(pPixmap)->pixmap);
+    xcb_free_pixmap(xsConnection, XS_PIXMAP_PRIV(pPixmap)->pixmap);
     xfree(pPixmap);
     return TRUE;
 }
@@ -134,15 +134,15 @@ Bool xsDestroyPixmap(PixmapPtr pPixmap)
  **/
 RegionPtr xsPixmapToRegion(PixmapPtr pPixmap)
 {
-    XCBImage *ximage;
+    xcb_image_t *ximage;
     register RegionPtr pReg, pTmpReg;
     register int x, y;
     unsigned long previousPixel, currentPixel;
     BoxRec Box;
     Bool overlap;
 
-    ximage = XCBImageGet(xsConnection,
-                        (XCBDRAWABLE)XS_PIXMAP_PRIV(pPixmap)->pixmap,
+    ximage = xcb_image_get(xsConnection,
+                        (xcb_drawable_t)XS_PIXMAP_PRIV(pPixmap)->pixmap,
                         0, 0,
                         pPixmap->drawable.width, pPixmap->drawable.height,
                         1,
@@ -151,7 +151,7 @@ RegionPtr xsPixmapToRegion(PixmapPtr pPi
     pReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
     pTmpReg = REGION_CREATE(pPixmap->drawable.pScreen, NULL, 1);
     if(!pReg || !pTmpReg) {
-        XCBImageDestroy(ximage);
+        xcb_image_destroy(ximage);
         return NullRegion;
     }
 
@@ -160,7 +160,7 @@ RegionPtr xsPixmapToRegion(PixmapPtr pPi
         Box.y2 = y + 1;
         previousPixel = 0L;
         for (x = 0; x < pPixmap->drawable.width; x++) {
-            currentPixel = XCBImageGetPixel(ximage, x, y);
+            currentPixel = xcb_image_get_pixel(ximage, x, y);
             if (previousPixel != currentPixel) {
                 if (previousPixel == 0L) { 
                     /* left edge */
@@ -184,7 +184,7 @@ RegionPtr xsPixmapToRegion(PixmapPtr pPi
     }
 
     REGION_DESTROY(pPixmap->drawable.pScreen, pTmpReg);
-    XCBImageDestroy(ximage);
+    xcb_image_destroy(ximage);
 
     REGION_VALIDATE(pPixmap->drawable.pScreen, pReg, &overlap);
 
diff --git a/hw/xscreen/xs-pixmap.h b/hw/xscreen/xs-pixmap.h
index 2ed5843..d52fca0 100644
--- a/hw/xscreen/xs-pixmap.h
+++ b/hw/xscreen/xs-pixmap.h
@@ -6,7 +6,7 @@ extern int xsPixmapPrivateIndex;
 #endif
 
 typedef struct {
-  XCBPIXMAP pixmap;
+  xcb_pixmap_t pixmap;
   XSOwnership owned;
 } XscreenPrivPixmap;
 
@@ -18,7 +18,7 @@ typedef struct {
   ((XscreenPrivPixmap *)((pPixmap)->devPrivate.ptr))
 #endif
 
-void      xsInitFormats();
+void      xsInitFormats(void);
 int       xsPixmapCalcSize(int depth, int w, int h);
 PixmapPtr xsCreatePixmap(ScreenPtr pScreen, int width, int height, int depth);
 Bool      xsDestroyPixmap(PixmapPtr pPixmap);
diff --git a/hw/xscreen/xs-screen.c b/hw/xscreen/xs-screen.c
index 0f69069..340c2ce 100644
--- a/hw/xscreen/xs-screen.c
+++ b/hw/xscreen/xs-screen.c
@@ -7,10 +7,10 @@
 /* need to include Xmd before XCB stuff, or
  * things get redeclared.*/
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/shape.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/shape.h>
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
diff --git a/hw/xscreen/xs-visual.c b/hw/xscreen/xs-visual.c
index 9152caa..3280538 100644
--- a/hw/xscreen/xs-visual.c
+++ b/hw/xscreen/xs-visual.c
@@ -19,23 +19,23 @@
 #endif
 
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xproto.h>
+#include <xcb/xcb.h>
+#include <xcb/xproto.h>
 #include "scrnintstr.h"
 #include "dix.h"
 #include "mi.h"
 #include "mibstore.h"
 
 static int           num_visuals = 0;
-static XCBVISUALTYPE *visuals;
-static CARD8         *depths;
+static xcb_visualtype_t *visuals;
+static uint8_t         *depths;
 
-void xsInitVisuals()
+static void xsInitVisuals(void)
 {
     /*initialize the visuals*/
 }
 
-XCBVISUALTYPE *xsGetVisual(VisualPtr pVisual)
+xcb_visualtype_t *xsGetVisual(VisualPtr pVisual)
 {
     int i;
 
@@ -52,30 +52,30 @@ XCBVISUALTYPE *xsGetVisual(VisualPtr pVi
     return NULL;
 }
 
-XCBVISUALTYPE *visualFromID(ScreenPtr pScreen, XCBVISUALID visual)
+static xcb_visualtype_t *visualFromID(ScreenPtr pScreen, xcb_visualid_t visual)
 {
     int i;
 
     for (i = 0; i < pScreen->numVisuals; i++)
-        if (pScreen->visuals[i].vid == visual.id)
+        if (pScreen->visuals[i].vid == visual)
             return xsGetVisual(&pScreen->visuals[i]);
 
     return NULL;
 }
 
-XCBVISUALTYPE *xsGetDefaultVisual(ScreenPtr pScreen)
+static xcb_visualtype_t *xsGetDefaultVisual(ScreenPtr pScreen)
 {
-    XCBVISUALID v;
+    xcb_visualid_t v;
 
-    v.id = pScreen->rootVisual;
+    v = pScreen->rootVisual;
     return visualFromID(pScreen, v);
 }
 
 /*
-XCBCOLORMAP xsDefaultVisualColormap(XCBVISUALTYPE *visual)
+xcb_colormap_t xsDefaultVisualColormap(xcb_visualtype_t *visual)
 {
     int i;
-    XCBCOLORMAP noneCmap = { 0 };
+    xcb_colormap_t noneCmap = { 0 };
 
     for (i = 0; i < num_visuals; i++)
         if (&visuals[i] == visual)
diff --git a/hw/xscreen/xs-visual.h b/hw/xscreen/xs-visual.h
index 7976ec3..4c6d0b3 100644
--- a/hw/xscreen/xs-visual.h
+++ b/hw/xscreen/xs-visual.h
@@ -1,5 +1,5 @@
 
-XCBVISUALTYPE *xsGetVisual(VisualPtr pVisual);
-XCBVISUALTYPE *xsGetVisualFromID(ScreenPtr pScreen, XCBVISUALID visual);
-XCBVISUALTYPE *xsGetDefaultVisual(ScreenPtr pScreen);
-XCBCOLORMAP xsDefaultVisualColormap(XCBVISUALTYPE *visual);
+xcb_visualtype_t *xsGetVisual(VisualPtr pVisual);
+xcb_visualtype_t *xsGetVisualFromID(ScreenPtr pScreen, xcb_visualid_t visual);
+xcb_visualtype_t *xsGetDefaultVisual(ScreenPtr pScreen);
+xcb_colormap_t xsDefaultVisualColormap(xcb_visualtype_t *visual);
diff --git a/hw/xscreen/xs-window.c b/hw/xscreen/xs-window.c
index ddb0408..57ea47b 100644
--- a/hw/xscreen/xs-window.c
+++ b/hw/xscreen/xs-window.c
@@ -2,10 +2,10 @@
 #include <xs-config.h>
 #endif
 #include <X11/Xmd.h>
-#include <X11/XCB/xcb.h>
-#include <X11/XCB/xcb_aux.h>
-#include <X11/XCB/xproto.h>
-#include <X11/XCB/xcb_image.h>
+#include <xcb/xcb.h>
+#include <xcb/xcb_aux.h>
+#include <xcb/xproto.h>
+#include <xcb/xcb_image.h>
 #include "regionstr.h"
 #include <X11/fonts/fontstruct.h>
 #include "gcstruct.h"
@@ -25,20 +25,20 @@
 #include "xs-gc.h"
 
 /*Forward decls*/
-static WindowPtr xsTrackWindow(XCBWINDOW win, WindowPtr pParent);
+static WindowPtr xsTrackWindow(xcb_window_t win, WindowPtr pParent);
 
 /**
  * returns the WindowPtr of a window with a given XID on the backing server.
  * if the window is not tracked by Xnest, NULL is returned.
  **/
 typedef struct {
-    XCBWINDOW win;
+    xcb_window_t win;
     WindowPtr pWin;
 } XsWindowMatch;
 
 static int xsMatchFunc(WindowPtr pWin, XsWindowMatch *wm)
 {
-    if (wm->win.xid == XS_WINDOW_PRIV(pWin)->window.xid) {
+    if (wm->win == XS_WINDOW_PRIV(pWin)->window) {
         wm->pWin = pWin;
         return WT_STOPWALKING;
     }
@@ -46,10 +46,9 @@ static int xsMatchFunc(WindowPtr pWin, X
         return WT_WALKCHILDREN;
 }
 
-WindowPtr xsGetWindow(XCBWINDOW window)
+static WindowPtr xsGetWindow(xcb_window_t window)
 {
     XsWindowMatch wm;
-    int i;
 
     wm.pWin = NULL;
     wm.win = window;
@@ -61,7 +60,7 @@ WindowPtr xsGetWindow(XCBWINDOW window)
 /**
  * Removes a window from the window tree, rearranging the siblings.
  **/
-void xsRemoveWindow(WindowPtr pWin)
+static void xsRemoveWindow(WindowPtr pWin)
 {
     WindowPtr pPrev;
     WindowPtr pNext;
@@ -88,7 +87,7 @@ void xsRemoveWindow(WindowPtr pWin)
  * Inserts a window into the window tree.
  * pParent must NOT be NULL, ie: this must NOT be called on the root window.
  **/
-void xsInsertWindow(WindowPtr pWin, WindowPtr pParent)
+static void xsInsertWindow(WindowPtr pWin, WindowPtr pParent)
 {
     WindowPtr pPrev;
 
@@ -130,7 +129,7 @@ void xsInsertWindow(WindowPtr pWin, Wind
  **/
 static void xsInitWindow(WindowPtr pWin, WindowPtr pParent, int x, int y, int w, int h, int bw)
 {
-    XCBWINDOW win;
+    xcb_window_t win;
     int parent_x, parent_y;
 
     win = XS_WINDOW_PRIV(pWin)->window;
@@ -239,30 +238,30 @@ static void xsInitWindow(WindowPtr pWin,
  * the backing server *must* be grabbed when calling this function, since this
  * function doesn't do the server grab on it's own
  **/
-static void xsTrackChildren(WindowPtr pParent, CARD32 ev_mask)
+static void xsTrackChildren(WindowPtr pParent, uint32_t ev_mask)
 {
-    XCBWINDOW             win;
+    xcb_window_t             win;
     WindowPtr             pWin;
-    XCBQueryTreeCookie    qcook;
-    XCBQueryTreeRep      *qrep;
-    XCBGetGeometryCookie  gcook;
-    XCBGetGeometryRep    *grep;
-    XCBWINDOW            *child;
+    xcb_query_tree_cookie_t    qcook;
+    xcb_query_tree_reply_t      *qrep;
+    xcb_get_geometry_cookie_t  gcook;
+    xcb_get_geometry_reply_t    *grep;
+    xcb_window_t            *child;
     int                   i;
 
     win = XS_WINDOW_PRIV(pParent)->window;
-    qcook = XCBQueryTree(xsConnection, win);
-    qrep = XCBQueryTreeReply(xsConnection, qcook, NULL);
-    child = XCBQueryTreeChildren(qrep);
+    qcook = xcb_query_tree(xsConnection, win);
+    qrep = xcb_query_tree_reply(xsConnection, qcook, NULL);
+    child = xcb_query_tree_children(qrep);
     for (i=0; i < qrep->children_len; i++) {
         pWin = xsGetWindow(child[i]);
         if (!pWin){
-            gcook = XCBGetGeometry(xsConnection, (XCBDRAWABLE)child[i]);
-            grep = XCBGetGeometryReply(xsConnection, gcook, NULL);
+            gcook = xcb_get_geometry(xsConnection, (xcb_drawable_t)child[i]);
+            grep = xcb_get_geometry_reply(xsConnection, gcook, NULL);
             pWin = AllocateWindow(pParent->drawable.pScreen);
             XS_WINDOW_PRIV(pWin)->window = child[i];
             xsInitWindow(pWin, pParent, grep->x, grep->y, grep->width, grep->height, grep->border_width);
-            XCBChangeWindowAttributes(xsConnection, child[i], XCBCWEventMask, &ev_mask);
+            xcb_change_window_attributes(xsConnection, child[i], XCB_CW_EVENT_MASK, &ev_mask);
         } else {
             xsRemoveWindow(pWin);
         }
@@ -274,16 +273,16 @@ static void xsTrackChildren(WindowPtr pP
  * Allocates a new WindowPtr, and tracks it, inserting it into the
  * window tree. Assumes that pParent is the parent of the window.
  **/
-static WindowPtr xsTrackWindow(XCBWINDOW win, WindowPtr pParent)
+static WindowPtr xsTrackWindow(xcb_window_t win, WindowPtr pParent)
 {
     WindowPtr pWin;
-    CARD32 ev_mask;
-    XCBGetGeometryCookie  gcook;
-    XCBGetGeometryRep    *grep;
+    uint32_t ev_mask;
+    xcb_get_geometry_cookie_t  gcook;
+    xcb_get_geometry_reply_t    *grep;
 
     pWin = AllocateWindow(pParent->drawable.pScreen);
-    gcook = XCBGetGeometry(xsConnection, (XCBDRAWABLE)win);
-    grep = XCBGetGeometryReply(xsConnection, gcook, NULL);
+    gcook = xcb_get_geometry(xsConnection, (xcb_drawable_t)win);
+    grep = xcb_get_geometry_reply(xsConnection, gcook, NULL);
 
     /*initialize the window*/
     xsInitWindow(pWin, pParent, 
@@ -292,13 +291,13 @@ static WindowPtr xsTrackWindow(XCBWINDOW
                  grep->border_width);
 
     /*set the event mask*/
-    ev_mask = XCBEventMaskSubstructureNotify|XCBEventMaskStructureNotify;
-    XCBChangeWindowAttributes(xsConnection, win, XCBCWEventMask, &ev_mask);
+    ev_mask = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY|XCB_EVENT_MASK_STRUCTURE_NOTIFY;
+    xcb_change_window_attributes(xsConnection, win, XCB_CW_EVENT_MASK, &ev_mask);
 
     /*make sure we've got all the children of the window*/
-    XCBGrabServer(xsConnection);
+    xcb_grab_server(xsConnection);
     xsTrackChildren(pWin, ev_mask);
-    XCBUngrabServer(xsConnection);
+    xcb_ungrab_server(xsConnection);
     return pWin;
 }
 
@@ -309,15 +308,15 @@ static WindowPtr xsTrackWindow(XCBWINDOW
  **/
 Bool xsCreateWindow(WindowPtr pWin)
 {
-    CARD32      mask;
-    CARD32      ev_mask;
-    XCBSCREEN  *screen;
-    XCBVISUALID vid;
-    XCBParamsCW params;
+    uint32_t      mask;
+    uint32_t      ev_mask;
+    xcb_screen_t  *screen;
+    xcb_visualid_t vid;
+    xcb_params_cw_t params;
 
     /* Inits too much for CreateWindow calls, but.. well.. otherwise we'd
      * duplicate code. */
-    screen =  XCBSetupRootsIter (XCBGetSetup (xsConnection)).data;
+    screen =  xcb_setup_roots_iterator (xcb_get_setup (xsConnection)).data;
     /**
      * We need to special-case creating the root window, since
      * it's representation on the backing server has already been
@@ -327,7 +326,7 @@ Bool xsCreateWindow(WindowPtr pWin)
         XS_WINDOW_PRIV(pWin)->window = screen->root;
 
 #if 0
-        /*FIXME! do we need to do this?
+        /*FIXME! do we need to do this?*/
         /*initialize the root window*/
         xsInitWindow(pWin, NULL,  /*root has no parent*/
                      0, 0,        /*origin at 0, 0*/
@@ -337,36 +336,35 @@ Bool xsCreateWindow(WindowPtr pWin)
 #endif
 
         /*we want to listen to both motion and creation events on the root*/
-        mask = XCBEventMaskSubstructureNotify | XCBEventMaskPointerMotion;
-        XCBChangeWindowAttributes(xsConnection, screen->root, XCBCWEventMask, &ev_mask);
+        mask = XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_POINTER_MOTION;
+        xcb_change_window_attributes(xsConnection, screen->root, XCB_CW_EVENT_MASK, &ev_mask);
 
         /*track the children of the root window*/
-        XCBGrabServer(xsConnection);
+        xcb_grab_server(xsConnection);
             xsTrackChildren(pWin, ev_mask);
-        XCBUngrabServer(xsConnection);
+        xcb_ungrab_server(xsConnection);
         return TRUE;
     }
 
-    if (pWin->drawable.class == XCBWindowClassInputOnly) {
-        0L;
-        vid.id = XCBCopyFromParent;
+    if (pWin->drawable.class == XCB_WINDOW_CLASS_INPUT_ONLY) {
+        vid = XCB_COPY_FROM_PARENT;
     } else {
         if (pWin->optional && pWin->optional->visual != wVisual(pWin->parent)) {
             ErrorF("Need to get visuals");
             exit(1);
         } else {
-             vid.id = XCBCopyFromParent;
+             vid = XCB_COPY_FROM_PARENT;
         }
     }
     /*we want all the important events on the window*/
     params.event_mask = ((1<<25)-1) &
-                        ~(XCBEventMaskSubstructureRedirect |
-                          XCBEventMaskPointerMotionHint    |
-                          XCBEventMaskResizeRedirect);
+                        ~(XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT |
+                          XCB_EVENT_MASK_POINTER_MOTION_HINT    |
+                          XCB_EVENT_MASK_RESIZE_REDIRECT);
 
     /*If we're not creating the root window, continue as normal*/
-    XS_WINDOW_PRIV(pWin)->window = XCBWINDOWNew(xsConnection);
-    XCBAuxCreateWindow(xsConnection,
+    XS_WINDOW_PRIV(pWin)->window = xcb_generate_id(xsConnection);
+    xcb_aux_create_window(xsConnection,
                        pWin->drawable.depth, 
                        XS_WINDOW_PRIV(pWin)->window,
                        XS_WINDOW_PRIV(pWin->parent)->window,
@@ -379,6 +377,7 @@ Bool xsCreateWindow(WindowPtr pWin)
                        vid,
                        mask,
                        &params);
+    return TRUE;
 }
 
 /**
@@ -393,8 +392,8 @@ Bool xsDestroyWindow(WindowPtr pWin)
      * Might be wrong about this though.*/
     if (XS_WINDOW_PRIV(pWin)->owned != XS_OWNED)
         return FALSE;
-    XCBDestroyWindow(xsConnection, XS_WINDOW_PRIV(pWin)->window);
-    XS_WINDOW_PRIV(pWin)->window = (XCBWINDOW){0};
+    xcb_destroy_window(xsConnection, XS_WINDOW_PRIV(pWin)->window);
+    XS_WINDOW_PRIV(pWin)->window = (xcb_window_t){0};
     return TRUE;
 }
 
@@ -404,13 +403,13 @@ Bool xsDestroyWindow(WindowPtr pWin)
  **/
 Bool xsPositionWindow(WindowPtr pWin, int x, int y)
 {
-    CARD32 list[2];
+    uint32_t list[2];
 
     list[0] = x;
     list[1] = y;
-    XCBConfigureWindow(xsConnection,
+    xcb_configure_window(xsConnection,
                        XS_WINDOW_PRIV(pWin)->window,
-                       XCBConfigWindowX | XCBConfigWindowY,
+                       XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y,
                        list);
     return TRUE;
 }
@@ -421,91 +420,91 @@ Bool xsPositionWindow(WindowPtr pWin, in
 
 Bool xsChangeWindowAttributes(WindowPtr pWin, unsigned long mask)
 {
-    XCBParamsCW param;
+    xcb_params_cw_t param;
     PixmapPtr pPixmap;
 
-    if (mask & XCBCWBackPixmap) {
+    if (mask & XCB_CW_BACK_PIXMAP) {
         switch (pWin->backgroundState) {
-            case XCBBackPixmapNone:
+            case XCB_BACK_PIXMAP_NONE:
                 param.back_pixmap = 0;
                 break;
 
-            case XCBBackPixmapParentRelative:
-                param.back_pixmap = XCBBackPixmapParentRelative;
+            case XCB_BACK_PIXMAP_PARENT_RELATIVE:
+                param.back_pixmap = XCB_BACK_PIXMAP_PARENT_RELATIVE;
                 break;
 
             /*X server internal things.*/
             case BackgroundPixmap:
                 pPixmap = pWin->background.pixmap;
-                param.back_pixmap = XS_PIXMAP_PRIV(pPixmap)->pixmap.xid;
+                param.back_pixmap = XS_PIXMAP_PRIV(pPixmap)->pixmap;
                 break;
 
             case BackgroundPixel:
-                mask &= ~XCBCWBackPixmap;
+                mask &= ~XCB_CW_BACK_PIXMAP;
                 break;
         }
     }
 
-    if (mask & XCBCWBackPixel) {
+    if (mask & XCB_CW_BACK_PIXEL) {
         if (pWin->backgroundState == BackgroundPixel)
             param.back_pixel = pWin->background.pixel;
         else
             mask &= ~CWBackPixel;
     }
     
-    if (mask & XCBCWBorderPixmap) {
+    if (mask & XCB_CW_BORDER_PIXMAP) {
         if (pWin->borderIsPixel)
             mask &= ~CWBorderPixmap;
         else
             pPixmap = pWin->border.pixmap;
-            param.border_pixmap = XS_PIXMAP_PRIV(pPixmap)->pixmap.xid;
+            param.border_pixmap = XS_PIXMAP_PRIV(pPixmap)->pixmap;
     }
     
-    if (mask & XCBCWBorderPixel) {
+    if (mask & XCB_CW_BORDER_PIXEL) {
         if (pWin->borderIsPixel)
             param.border_pixel = pWin->border.pixel;
         else
-            mask &= ~XCBCWBorderPixel;
+            mask &= ~XCB_CW_BORDER_PIXEL;
     }
 
-    if (mask & XCBCWBitGravity) 
+    if (mask & XCB_CW_BIT_GRAVITY) 
         param.bit_gravity = pWin->bitGravity;
 
-    if (mask & XCBCWWinGravity) /* dix does this for us */
+    if (mask & XCB_CW_WIN_GRAVITY) /* dix does this for us */
         mask &= ~CWWinGravity;
 
-    if (mask & XCBCWBackingStore) /* this is really not useful */
+    if (mask & XCB_CW_BACKING_STORE) /* this is really not useful */
         mask &= ~CWBackingStore;
 
-    if (mask & XCBCWBackingPlanes) /* this is really not useful */
+    if (mask & XCB_CW_BACKING_PLANES) /* this is really not useful */
         mask &= ~CWBackingPlanes;
 
-    if (mask & XCBCWBackingPixel) /* this is really not useful */ 
+    if (mask & XCB_CW_BACKING_PIXEL) /* this is really not useful */ 
         mask &= ~CWBackingPixel;
 
-    if (mask & XCBCWOverrideRedirect)
+    if (mask & XCB_CW_OVERRIDE_REDIRECT)
         param.override_redirect = pWin->overrideRedirect;
 
-    if (mask & XCBCWSaveUnder) /* this is really not useful */
+    if (mask & XCB_CW_SAVE_UNDER) /* this is really not useful */
         mask &= ~CWSaveUnder;
 
-    if (mask & XCBCWEventMask) /* events are handled elsewhere */
+    if (mask & XCB_CW_EVENT_MASK) /* events are handled elsewhere */
         mask &= ~CWEventMask;
 
-    if (mask & XCBCWDontPropagate) /* events are handled elsewhere */
+    if (mask & XCB_CW_DONT_PROPAGATE) /* events are handled elsewhere */
         mask &= ~CWDontPropagate; 
     
-    if (mask & XCBCWColormap) {
+    if (mask & XCB_CW_COLORMAP) {
         ColormapPtr pCmap;
         pCmap = LookupIDByType(wColormap(pWin), RT_COLORMAP);
-        param.colormap = XS_CMAP_PRIV(pCmap)->colormap.xid;
+        param.colormap = XS_CMAP_PRIV(pCmap)->colormap;
         xsSetInstalledColormapWindows(pWin->drawable.pScreen);
     }
-    if (mask & XCBCWCursor) /* this is handeled in cursor code */
-        mask &= ~XCBCWCursor;
+    if (mask & XCB_CW_CURSOR) /* this is handeled in cursor code */
+        mask &= ~XCB_CW_CURSOR;
 
     if (mask)
-        XCBAuxChangeWindowAttributes(xsConnection, XS_WINDOW_PRIV(pWin)->window, mask, &param);
+        xcb_aux_change_window_attributes(xsConnection, XS_WINDOW_PRIV(pWin)->window, mask, &param);
 }
 
 /**
@@ -514,11 +513,11 @@ Bool xsChangeWindowAttributes(WindowPtr 
  * configuring a window with a zero mask) and that the cost of actually
  * doing a configure for extra values is unneeded.
  **/
-void xsConfigureWindow(WindowPtr pWin, CARD32 mask)
+void xsConfigureWindow(WindowPtr pWin, uint32_t mask)
 {
     WindowPtr                pSib;
-    CARD32                   vmask;
-    XCBParamsConfigureWindow values;
+    uint32_t                   vmask;
+    xcb_params_configure_window_t values;
 
     /* We fill the entire structure here, and let the mask weed out the
      * extra data */
@@ -529,22 +528,22 @@ void xsConfigureWindow(WindowPtr pWin, C
     values.height = pWin->drawable.height;
     values.border_width = wBorderWidth(pWin);
 
-    XCBAuxConfigureWindow(xsConnection, XS_WINDOW_PRIV(pWin)->window, mask, &values);
+    xcb_aux_configure_window(xsConnection, XS_WINDOW_PRIV(pWin)->window, mask, &values);
 
-    if (mask & XCBConfigWindowStackMode) {
+    if (mask & XCB_CONFIG_WINDOW_STACK_MODE) {
         /*get top sibling*/
         for (pSib = pWin; pSib->prevSib != NULL; pSib = pSib->prevSib);
 
-        vmask = XCBConfigWindowStackMode;
-        values.stack_mode = XCBStackModeAbove;
-        XCBAuxConfigureWindow(xsConnection, XS_WINDOW_PRIV(pSib)->window, vmask, &values); 
+        vmask = XCB_CONFIG_WINDOW_STACK_MODE;
+        values.stack_mode = XCB_STACK_MODE_ABOVE;
+        xcb_aux_configure_window(xsConnection, XS_WINDOW_PRIV(pSib)->window, vmask, &values); 
 
         /* the rest of siblings */
         for (pSib = pSib->nextSib; pSib != NullWindow; pSib = pSib->nextSib) {
-            vmask = XCBConfigWindowSibling | XCBConfigWindowStackMode;
-            values.sibling = XS_WINDOW_PRIV(pSib)->window.xid;
+            vmask = XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE;
+            values.sibling = XS_WINDOW_PRIV(pSib)->window;
             values.stack_mode = Below;
-            XCBAuxConfigureWindow(xsConnection, XS_WINDOW_PRIV(pSib)->window, vmask, &values);
+            xcb_aux_configure_window(xsConnection, XS_WINDOW_PRIV(pSib)->window, vmask, &values);
         }
     }
 }
@@ -557,8 +556,8 @@ Bool xsRealizeWindow(WindowPtr pWin)
 {
     if (XS_IS_ROOT(pWin))
         return TRUE;
-    xsConfigureWindow(pWin, XCBConfigWindowStackMode);
-    XCBMapWindow(xsConnection, XS_WINDOW_PRIV(pWin)->window);
+    xsConfigureWindow(pWin, XCB_CONFIG_WINDOW_STACK_MODE);
+    xcb_map_window(xsConnection, XS_WINDOW_PRIV(pWin)->window);
     return TRUE;    
 }
 
@@ -567,7 +566,7 @@ Bool xsRealizeWindow(WindowPtr pWin)
  **/
 Bool xsUnrealizeWindow(WindowPtr pWin)
 {
-    XCBUnmapWindow(xsConnection, XS_WINDOW_PRIV(pWin)->window);
+    xcb_unmap_window(xsConnection, XS_WINDOW_PRIV(pWin)->window);
     return TRUE;
 }
 
@@ -578,7 +577,7 @@ void xsPaintWindowBackground(WindowPtr p
 
     pBox = REGION_RECTS(pRegion);
     for (i = 0; i < REGION_NUM_RECTS(pRegion); i++)
-        XCBClearArea(xsConnection,
+        xcb_clear_area(xsConnection,
                      FALSE,
                      XS_WINDOW_PRIV(pWin)->window,
                      pBox[i].x1 - pWin->drawable.x,
@@ -600,5 +599,5 @@ void xsCopyWindow(WindowPtr pWin, xPoint
 
 void xsClipNotify(WindowPtr pWin, int dx, int dy)
 {
-    xsConfigureWindow(pWin, XCBConfigWindowStackMode);
+    xsConfigureWindow(pWin, XCB_CONFIG_WINDOW_STACK_MODE);
 }
diff --git a/hw/xscreen/xs-window.h b/hw/xscreen/xs-window.h
index 7d3cd3b..9ea258f 100644
--- a/hw/xscreen/xs-window.h
+++ b/hw/xscreen/xs-window.h
@@ -4,7 +4,7 @@
 extern int xsWindowPrivateIndex;
 
 typedef struct {
-  XCBWINDOW window;
+  xcb_window_t window;
   XSOwnership owned;
 } XscreenPrivWindow;
 
@@ -29,7 +29,7 @@ Bool xsUnrealizeWindow(WindowPtr pWin);
 Bool xsPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what);
 void xsPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what);
 Bool xsPositionWindow(WindowPtr pWin, int x, int y);
-void xsConfigureWindow(WindowPtr pWin, CARD32 mask);
+void xsConfigureWindow(WindowPtr pWin, uint32_t mask);
 
 void xsWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr pOther);
 void xsCopyWindow(WindowPtr pWin, xPoint old_orig, RegionPtr old_rgn);



More information about the xorg-commit mailing list