1: #include <X/mit-copyright.h> 2: 3: /* $Header: XQueryTree.c,v 10.4 86/02/01 15:39:07 tony Rel $ */ 4: /* Copyright Massachusetts Institute of Technology 1985 */ 5: 6: #include "XlibInternal.h" 7: Status XQueryTree (w, parent, nchildren, children) 8: Window w; 9: Window *parent; 10: int *nchildren; 11: Window **children; 12: 13: { 14: register Display *dpy; 15: register XReq *req; 16: XRep rep; 17: int nbytes; 18: 19: GetReq(X_QueryTree, w); 20: 21: if (!_XReply(dpy, &rep)) 22: return (0); 23: *parent = rep.param.l[0]; 24: if ((*nchildren = rep.param.l[1]) == 0) { 25: *children = NULL; 26: return (1); 27: } 28: 29: if ((*children = (Window *) malloc (nbytes = rep.param.l[1]*sizeof(Window))) == NULL) 30: _XIOError (dpy); 31: 32: _XRead (dpy, *children, nbytes); 33: return (1); 34: }