xcb_get_property use

View: New views
5 Messages — Rating Filter:   Alert me  

xcb_get_property use

by Michele Comignano-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
Web: http://comick.playlinux.net
_______________________________________________
Xcb mailing list
Xcb@...
http://lists.freedesktop.org/mailman/listinfo/xcb

Re: xcb_get_property use

by Julien Danjou-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 1256565230 time_t, Michele Comignano wrote:
>         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)
>                 );

In awesome, we use something like:
xcb_get_property(d->conn, 0, d->screen->root, atom, PIXMAP, 0, 1);

PIXMAP being xcb_atom_get(d->conn, "PIXMAP") or PIXMAP if you use
xcb_atom from xcb-util, if I'm correct.

--
Julien Danjou
// ᐰ <julien@...>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// Life is life. Lalalalala.


_______________________________________________
Xcb mailing list
Xcb@...
http://lists.freedesktop.org/mailman/listinfo/xcb

signature.asc (205 bytes) Download Attachment

Re: xcb_get_property use

by Michele Comignano-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 26 October 2009 15:39:52 Julien Danjou wrote:
> In awesome, we use something like:
> xcb_get_property(d->conn, 0, d->screen->root, atom, PIXMAP, 0, 1);
>
> PIXMAP being xcb_atom_get(d->conn, "PIXMAP") or PIXMAP if you use
> xcb_atom from xcb-util, if I'm correct.
>
        cookie = xcb_get_property(d->conn,
                0, d->screen->root, atom,
                PIXMAP, 0, 1);
        reply = xcb_get_property_reply(d->conn, cookie, NULL);
        if (reply && reply->type == PIXMAP) {
            // Upper conditions are OK, so I need to obtain the XID of the pixmap
            memcpy(&root_tile_pixmap, reply->pad0, sizeof (xcb_pixmap_t));
        }

Is this the correct way to obtain the pixmap xid?
The reply looks like ok.

Thanks again :)

--
Michele Comignano (comick)
Jabber: comick@...
Web: http://comick.playlinux.net
_______________________________________________
Xcb mailing list
Xcb@...
http://lists.freedesktop.org/mailman/listinfo/xcb

Re: xcb_get_property use

by Julien Danjou-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 1256572048 time_t, Michele Comignano wrote:
> Is this the correct way to obtain the pixmap xid?

xcb_pixmap_t pixmap = xcb_get_property_value(reply)[0]

is the correct way.

--
Julien Danjou
// ᐰ <julien@...>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// This is the end of my signature.


_______________________________________________
Xcb mailing list
Xcb@...
http://lists.freedesktop.org/mailman/listinfo/xcb

signature.asc (205 bytes) Download Attachment

Re: xcb_get_property use

by Barton C Massey :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

IIRC there was a bug in xcb_get_property() that was fixed
recently.  Please try again with top-of-tree XCB and let us
know whether your problem persists.  Thanks much.

        Bart

In message <200910261453.50981.comick@...> you wrote:

> 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@...
> Web: http://comick.playlinux.net
> _______________________________________________
> Xcb mailing list
> Xcb@...
> http://lists.freedesktop.org/mailman/listinfo/xcb
_______________________________________________
Xcb mailing list
Xcb@...
http://lists.freedesktop.org/mailman/listinfo/xcb