如何使用xlib的C接口检查窗口是否最小化?
编辑:这段代码应该有效吗?
int window_is_minimized(Display *display, Window window) {
Atom actual_type;
int actual_format;
unsigned long i, num_items, bytes_after;
Atom *atoms;
atoms=NULL;
XGetWindowProperty(display, window, vdl_x11_usefull_atoms->_NET_WM_STATE, 0, 1024, False, XA_ATOM, &actual_type, &actual_format, &num_items, &bytes_after, (unsigned char**)&atoms);
for(i=0; i<num_items; ++i) {
if(atoms[i]==vdl_x11_usefull_atoms->_NET_WM_STATE_HIDDEN) {
XFree(atoms);
return 1;
}
}
XFree(atoms);
return 0;
}
最佳答案 >读取_NET_WM_STATE属性并检查其内容(如
http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507241中所述).
>读取WM_STATE属性并检查其内容(如
http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1中所述).