开发者

Xlib: How to check if a window is minimized or not?

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) {
    Ato开发者_StackOverflow中文版m 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;
}


  • 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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜