diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index 5e935d7d0..76f8990e8 100644 --- a/hw/xnest/Display.c +++ b/hw/xnest/Display.c @@ -182,8 +182,8 @@ xnestOpenDisplay(int argc, char *argv[]) xnestBorderWidth = 1; xnestIconBitmap = - XCreateBitmapFromData(xnestDisplay, - xnestUpstreamInfo.screenInfo->root, + xnestCreateBitmapFromData(xnestUpstreamInfo.conn, + xnestUpstreamInfo.screenInfo->root, (char *) icon_bits, icon_width, icon_height); xnestScreenSaverPixmap = diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index 9d2fd051e..de764b8a5 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -12,6 +12,7 @@ #include #include "include/gc.h" +#include "include/servermd.h" #include "Xnest.h" #include "xnest-xcb.h" @@ -173,3 +174,35 @@ void xnestWMColormapWindows(xcb_connection_t *conn, xcb_window_t w, xcb_window_t free(reply); } + +uint32_t xnestCreateBitmapFromData( + xcb_connection_t *conn, + uint32_t drawable, + const char *data, + uint32_t width, + uint32_t height) +{ + uint32_t pix = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_pixmap(conn, 1, pix, drawable, width, height); + + uint32_t gc = xcb_generate_id(xnestUpstreamInfo.conn); + xcb_create_gc(conn, gc, pix, 0, NULL); + + const int leftPad = 0; + + xcb_put_image(conn, + XYPixmap, + pix, + gc, + width, + height, + 0 /* dst_x */, + 0 /* dst_y */, + leftPad, + 1 /* depth */, + BitmapBytePad(width + leftPad) * height, + (uint8_t*)data); + + xcb_free_gc(conn, gc); + return pix; +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 4a33ec540..062cb142c 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -97,4 +97,7 @@ void xnChangeGC(xcb_connection_t *conn, uint32_t gc, XnGCValues gcval, uint32_t void xnestWMColormapWindows(xcb_connection_t *conn, xcb_window_t w, xcb_window_t *windows, int count); +uint32_t xnestCreateBitmapFromData(xcb_connection_t *conn, uint32_t drawable, + const char *data, uint32_t width, uint32_t height); + #endif /* __XNEST__XCB_H */