I'm writing an application using X11, Xt, and Motif directly with C. I want to have the ability to list all the children widgets from a parent Window. Is there a way to do this?
I found the following snippet to recursively parse a Motif widget tree here, but I only have an Xlib Window struct, so I want to be able get the children Widgets of that Window, then pass that Widget to something akin to that recursive tree parser.
My current code looks something like this:
int main() {
Display* display;
int screen_num = 0;
display = XOpenDisplay(NULL);
Window window = XRootWindow(display, screen_num);
dumpWidgetTree((Widget)window);
return 0;
}
I tried simply casting Window to Widget, but that just caused a segfault, as expected.