对于我的程序,我需要其他程序图标,我已将其保存在列表中:
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;
}
我只能使用Imlib2找到解决方案,但如果可能的话,我正在寻找一种更简单的方法。基本上我只想在窗口上绘制这些图标。
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 = ....
我真的不知道该怎么做。有人有一个如何获得正确数据或如何使用它的例子(例如pixmap)? 谢谢!
编辑: 现在我有了另一个解决方案(它在libwnck的源代码中)和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);
}
}
类似的东西。
答案 0 :(得分:1)
使用此
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));