【发布时间】:2013-08-29 20:30:53
【问题描述】:
“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 书籍或链接到网站以更好地理解,那将非常有帮助。
谢谢,
【问题讨论】: