Xlib:如何检查窗口是否最小化?

时间:2011-09-09 17:27:32

标签: c x11 xlib xorg windowing

如何使用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;
}

1 个答案:

答案 0 :(得分:2)