Xlib:如何检查窗口是否最小化? [英] Xlib: How to check if a window is minimized or not?
本文介绍了Xlib:如何检查窗口是否最小化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用xlib的C接口检查窗口是否最小化?
How can I check if a window is minimized or not using the C interface of xlib?
此代码是否有效?
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).
read the WM_STATE property and check its content (as described in http://tronche.com/gui/x/icccm/sec-4.html#s-4.1.3.1).
这篇关于Xlib:如何检查窗口是否最小化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文