Getting window previews

Matthew Brush mbrush at codebrainz.ca
Sat Aug 1 02:04:14 CEST 2015


On 15-07-31 11:09 AM, adlo wrote:
> I am writing a GTK2 program that gets previews of all open windows. It uses the XCompositeNameWindowPixmap function.
>
> How do I put these previews into GtkImages?
>

You'd probably get better answers on a GTK+ (or XLib) related mailing 
list but I think this function does what you want:

https://developer.gnome.org/gdk-pixbuf/unstable/gdk-pixbuf-X-Drawables-to-Pixbufs.html#gdk-pixbuf-xlib-get-from-drawable

And then create the GtkImage from the GdkPixbuf. I'd probably use Cairo 
for this myself since you can just make a surface from the Pixmap and 
draw it straight onto whichever widget you need (ex. a GtkDrawingArea).

Cheers,
Matthew Brush


More information about the Xfce4-dev mailing list