For my program i need other programs icons, which i have saved in a list:
Window *windowlist(Display *display, unsigned long *length)
{
Atom prop = XInternAtom(display, "_NET_CLIENT_LIST", False);
Atom type;
int form;
unsigned long remain;
unsigned char *list;
if(XGetWindowProperty(display, XDefaultRootWindow(display), prop, 0, 1024, False, XA_WINDOW, &type, &form, length, &remain, &list) != Success)
{
return 0;
}
return (Window*)list;
}
I could only find solutions using Imlib2, but am searching for an easier way if possible. Basically I only want to draw these icons on a window.
Atom prop = XInternAtom(display, "_NET_WM_ICON", False);
XGetWindowProperty(display, window, prop, 0, 1 or what i need to do here?, False, XA_CARDINAl, &actual_type_return, &actual_format_return, &nitems_return, &bytes_after_return, &data);
width = (int)data;
height = (int)data;
size = width * height;
XGetWindowProperty(display, window, prop, 2 ???, size, False, XA_CARDINAl, &actual_type_return, &actual_format_return, &nitems_return, &bytes_after_return, &data);
Pixmap = ....
I really have no clue what to do. Does someone have an example of how to get the right data or how to use it (e.g. for a pixmap)? Thank you!
Edit: Now i have a other solution (its in the source of libwnck) with XWMHints:
Pixmap icon;
int width, height;
XWMHints *hints;
hints = XGetWMHints(display, window);
if(hints)
{
if(hints->flags & IconPixmapHint)
icon = hints->icon_pixmap;
if(icon != 0)
{
get_pixmap_geometry(icon, &width, &height) //its just XGetGeometry stuff
XCopyArea(display, icon, drawable, gc, 0, 0, width, height 0, 0);
}
}
Something like that.
Use this
gulong i=0;
int result;
Atom type;
int format;
gulong bytes_after;
gulong *data;
gulong nitems;
XGetWindowProperty (display,
w,
prop,
0, G_MAXLONG,
False, XA_CARDINAL , &type, &format, &nitems,
&bytes_after, ((guchar **)&data));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With