Get raw data of Xrender Picture structure

Gregoire Gentil gregoire at
Mon Dec 8 20:16:14 PST 2008

Thanks for all your answers. I appreciate. Unfortunately, so far, I
didn't get anything working:

- I was thinking of gdk_pixbuf_xlib_get_from_drawable but same story:
"If the specified drawable is a window, then it must be viewable, i.e.
all of its ancestors up to the root window must be mapped."

- I tried XGetImage:

XImage * x;
x = XGetImage(GDK_DISPLAY(), netk_window_get_xid(window), 0, 0, width,
height, AllPlanes, ZPixmap);
pixbuf = gdk_pixbuf_new_from_data(x->data, GDK_COLORSPACE_RGB, False, 8,
width, height, x->bytes_per_line, NULL, NULL);

but I receive an xserver error "The error was 'BadMatch (invalid
parameter attributes)'." when the window is partially hidden or
minimized. Note that it's working when the window is fully visible.

- So, at this point, I consider more patching/hacking the
window/compositing manager xfwm4 to add a screenshot when the window is
about to be umapped. Patching something like "no more unmap" seems
overkill for what I want to achieve.

Let me know if you have any other comment or idea,


On Mon, 2008-12-08 at 12:17 -0500, Gregoire Gentil wrote:
> Hello,
> I would like to get the raw data of the Picture structure in Xrender.
> Basically, I would like to import into a GdkPixbuf, a picture returned
> by XRenderCreatePicture. There doesn't seem to be any data export
> function in Xrender. Any pointer how I could achieve this?
> Grégoire
> PS: What do I need to do that? Because I want to preview in a gtk+
> application the content of a window that is minimized (like Compiz or
> Vista can do). gdk_pixbuf_get_from_drawable returns garbage with a
> minimized windows and I think that xrender will return at least the
> outdated content of the window. My windows and compositing manager is
> xfwm4 which doesn't support this feature. I'm then trying to shortcut
> xfwm4 and get what I want directly from Xrender.

More information about the xorg mailing list