我需要得到父母"新创建的窗口的窗口。例如:我启动xterm,输入" zenity --info"我想设置与xterm几何相同的zenity窗口几何。我找了XCreateWindowEvent(父字段),但那不是我想要的。我怎么能这样做?
答案 0 :(得分:2)
以下是代码:
bool getWindowParent(Window & winId, Window & _root) {
Window root, parent, *children = NULL;
unsigned int num_children;
if(!XQueryTree(m_display, winId, &root, &parent, &children, &num_children))
return false;
if (children)
XFree((char *)children);
winId = parent;
_root = root;
return true;
}