[Xcb] xcb_get_property use

Michele Comignano comick at autistici.org
Mon Oct 26 06:53:50 PDT 2009


I'm trying to use the xcb_get_property binding to get the root tile pixmap XID 
in the following manner:

d->conn is an xcb_connection_t and d->screen is a xcb_screen_t *

    int i;
    xcb_get_property_cookie_t cookie;
    xcb_get_property_reply_t * reply;
    xcb_atom_t atom;
    const char *props[] = {"_XROOTPMAP_ID", "_XSETROOT_ID"};

    xcb_pixmap_t root_tile_pixmap = XCB_NONE;

    for (i = 0; i < 2; i++) {
        atom = xcb_atom_get(d->conn, props[i]);

        cookie = xcb_get_property(d->conn,
                0, d->screen->root,
                atom,
                0L, // is it good ?? i've seen AnyPropertyType in the Xlib 
says 0L
                0, sizeof (xcb_pixmap_t)
                );
        reply = xcb_get_property_reply(d->conn, cookie, NULL);
        if (reply) { // Is this a good way to check for failure?
        memcpy(&_this.root_tile_pixmap, reply->pad0, sizeof 
(xcb_pixmap_t));//is pad0 the right place where reply data are stored
        }
        free(reply);
    }
    if (root_tile_pixmap == XCB_NONE) {
// Error
    }else{
// do stuff the the XID
}

My reply is always zero lenght.
Thanks in advance.

-- 
Michele Comignano (comick)
Jabber: comick at autistici.org
Web: http://comick.playlinux.net


More information about the Xcb mailing list