0

一个“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 书籍或链接到网站以更好地理解,那将非常有帮助。

谢谢,

4

1 回答 1

1

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

于 2013-08-30T14:15:22.233 回答