diff --git a/hw/xnest/Cursor.c b/hw/xnest/Cursor.c index 8a54cf834..8c7d0914d 100644 --- a/hw/xnest/Cursor.c +++ b/hw/xnest/Cursor.c @@ -26,6 +26,7 @@ is" without express or implied warranty. #include "mipointrst.h" #include "Xnest.h" +#include "xnest-xcb.h" #include "Display.h" #include "Screen.h" @@ -40,7 +41,6 @@ Bool xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { XImage *ximage; - Pixmap source, mask; XColor fg_color, bg_color; unsigned long valuemask; XGCValues values; @@ -56,13 +56,13 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) XChangeGC(xnestDisplay, xnestBitmapGC, valuemask, &values); - source = XCreatePixmap(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - pCursor->bits->width, pCursor->bits->height, 1); + uint32_t winId = xnestDefaultWindows[pScreen->myNum]; - mask = XCreatePixmap(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - pCursor->bits->width, pCursor->bits->height, 1); + Pixmap source = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(xnestUpstreamInfo.conn, 1, source, winId, pCursor->bits->width, pCursor->bits->height); + + Pixmap mask = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(xnestUpstreamInfo.conn, 1, mask, winId, pCursor->bits->width, pCursor->bits->height); ximage = XCreateImage(xnestDisplay, xnestDefaultVisual(pScreen), @@ -101,8 +101,8 @@ xnestRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) XCreatePixmapCursor(xnestDisplay, source, mask, &fg_color, &bg_color, pCursor->bits->xhot, pCursor->bits->yhot); - XFreePixmap(xnestDisplay, source); - XFreePixmap(xnestDisplay, mask); + xcb_free_pixmap(xnestUpstreamInfo.conn, source); + xcb_free_pixmap(xnestUpstreamInfo.conn, mask); return TRUE; } diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index 9e242de06..0ddeeb3d7 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -143,9 +143,13 @@ xnestOpenDisplay(int argc, char *argv[]) for (j = 0; j < xnestNumDepths; j++) if (xnestPixmapFormats[i].depth == 1 || xnestPixmapFormats[i].depth == xnestDepths[j]) { - xnestDefaultDrawables[xnestPixmapFormats[i].depth] = - XCreatePixmap(xnestDisplay, xnestUpstreamInfo.screenInfo->root, - 1, 1, xnestPixmapFormats[i].depth); + uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(xnestUpstreamInfo.conn, + xnestPixmapFormats[i].depth, + pixmap, + xnestUpstreamInfo.screenInfo->root, + 1, 1); + xnestDefaultDrawables[xnestPixmapFormats[i].depth] = pixmap; } xnestBitmapGC = XCreateGC(xnestDisplay, xnestDefaultDrawables[1], 0L, NULL); diff --git a/hw/xnest/Pixmap.c b/hw/xnest/Pixmap.c index 3910db3c7..3772202fd 100644 --- a/hw/xnest/Pixmap.c +++ b/hw/xnest/Pixmap.c @@ -26,6 +26,7 @@ is" without express or implied warranty. #include "mi.h" #include "Xnest.h" +#include "xnest-xcb.h" #include "Display.h" #include "Screen.h" @@ -56,11 +57,12 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, pPixmap->refcnt = 1; pPixmap->devKind = PixmapBytePad(width, depth); pPixmap->usage_hint = usage_hint; - if (width && height) - xnestPixmapPriv(pPixmap)->pixmap = - XCreatePixmap(xnestDisplay, - xnestDefaultWindows[pScreen->myNum], - width, height, depth); + if (width && height) { + uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(xnestUpstreamInfo.conn, depth, pixmap, + xnestDefaultWindows[pScreen->myNum], width, height); + xnestPixmapPriv(pPixmap)->pixmap = pixmap; + } else xnestPixmapPriv(pPixmap)->pixmap = 0; @@ -72,7 +74,7 @@ xnestDestroyPixmap(PixmapPtr pPixmap) { if (--pPixmap->refcnt) return TRUE; - XFreePixmap(xnestDisplay, xnestPixmap(pPixmap)); + xcb_free_pixmap(xnestUpstreamInfo.conn, xnestPixmap(pPixmap)); FreePixmap(pPixmap); return TRUE; } @@ -82,10 +84,11 @@ xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, void *pPixData) { if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) { - xnestPixmapPriv(pPixmap)->pixmap = - XCreatePixmap(xnestDisplay, - xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], - width, height, depth); + uint32_t pixmap = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(xnestUpstreamInfo.conn, depth, pixmap, + xnestDefaultWindows[pPixmap->drawable.pScreen->myNum], + width, height); + xnestPixmapPriv(pPixmap)->pixmap = pixmap; } return miModifyPixmapHeader(pPixmap, width, height, depth,