[cairo] pb with cairo && xcb

vincent.siles at gmail.com vincent.siles at gmail.com
Fri Nov 25 10:03:51 PST 2005


Hi,
I'm currently writing a windows manager with some friends and we are using xcb
and cairo. I'm currently trying to acces to a window content with cairo (to make
a nice icons with it). What I do is:
    - getting the window content
    - creating another window of the same size (for now, I'll deal with resizing
      later)
    - drawing the window content to my new window

But it doesn't seems to work. I tried to save the window content to a png file
and it works great, so maybe my code to draw to another window is bad. Here is
how I do it:

/* I've got a parent windows (titlebar & co) and another window which is its
 * child/


XCBDRAWABLE child;
child.window = my_win; /* this is the windows I want to copy */
cairo_surface_t *content = cairo_xcb_surface_create (dpy, child,
                        visual, width, height);

/* surf is a cairo_surface_t* linked to the new window I'll draw to */
cairo_t *cr = cairo_create(surf);
cairo_set_source_surface (cr, content, 0 ,0);
cairo_paint (cr);
/* cairo_surface_write_to_png (content , "./toto.png"); */

cairo_surface_destroy (content);
cairo_destroy (cr);

XCBFlush (dpy);

What I actually get is the content of the parent window but the child is all
black (in the png file, I get both good). 
Anybody knows how to do this right ?

Vincent
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/cairo/attachments/20051125/d15d6248/attachment.pgp


More information about the cairo mailing list