XGetWindowProperty()和XListProperties()与特定窗口ID的关系如何

时间:2013-08-29 20:30:54

标签: x11 xlib xserver

“PropertyNotify”事件由xServer为一个窗口生成,例如id为“win”。现在我调用xlib函数XGetWindowProperty()XListProperties()获取相同的win-id,如下所示

    int getProp(Atom atom, Window win, unsigned long *nitems_ret, 
                unsigned char **prop_return, Atom *type_ret, int *format_ret)
    {
        Atom type;
        int format;
        unsigned long bytes_after_ret;

        if (!type_ret)
            type_ret=&type;

        if (!format_ret)
            format_ret=&format;


        XGetWindowProperty(m_display, win, atom, 0, 65536, 0, 
                           AnyPropertyType, type_ret, format_ret, 
                           nitems_ret, &bytes_after_ret, prop_return);

          // printing the content of variable "prop_return" suppose it's not empty 
                                                               -----------------(1)

       int nprops = 0;
       Atom *prorList = XListProperties(m_display, win, &nprops);

         // printing content of var "prorList"  ------------------------(2)

   };

现在比较(1)和(2)的输出,(1)的输出也应该包含在(2)中。请说明理由来验证答案。据我所知,从网上读到大约XGetWindowProperty(),它从给定的window-id和其他补充的属性返回所需的属性类型。在这里检查我只是传递参数AnyPropertyType

现在我也调用函数XListProperties()列出给定win-id的所有Atom属性并打印它们以与XGetWindowProperty()的输出进行比较(考虑输出不是NULL)但我发现他们没有匹配。现在我的问题是这些属性出现在XGetWindowProperty()中的哪个位置,或者错误在于我的理解。请解释这些函数及其原子属性的差异。如果有人可以推荐优秀的xlib书籍或链接到网站以便更好地理解,那将非常有用。

谢谢,

1 个答案:

答案 0 :(得分:1)

XListProperties列出了属性名称prop_return是属性。它没有理由包含在属性名称列表中。 atom是此属性的名称,应该在该列表中找到。