【问题标题】:get "parent" window of newly created window获取新创建窗口的“父”窗口
【发布时间】:2014-11-15 02:17:33
【问题描述】:

我需要获取新创建窗口的“父”窗口。例如:我启动 xterm,输入“zenity --info”,我想将 zenity 窗口几何设置为与 xterm 几何相同。我寻找 XCreateWindowEvent (父字段),但这不是我想要的。我该怎么做?

【问题讨论】:

标签: x11


【解决方案1】:

代码如下:

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;
}

【讨论】:

    猜你喜欢
    • 2011-09-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-14
    • 2019-11-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多