3
對於我的計劃,我需要其他程序的圖標,這是我保存在一個列表:的xlib得到圖標的數據繪製窗口
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 = ....
我真的不知道該怎麼做。有人舉例說明如何獲得正確的數據或如何使用它(例如,用於像素圖)? 謝謝!
編輯: 現在我有一個其它溶液(其在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);
}
}
類似的東西。