Xlib:如何检查窗口是否最小化?
如何使用 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;
}
How can I check if a window is minimized or not using the C interface of xlib?
Edit: Should this code work?
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;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
读取 _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 _NET_WM_STATE property and check its content (as described in http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html#id2507241).
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).