I need to get "parent" window of newly created window. For example: I start xterm, type "zenity --info" and I want to set zenity window geometry same as xterm geometry. I looked for XCreateWindowEvent (parent field) but that's not what I want. How I can to do this?
Here is the code:
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With