|
|
1.1 ! root 1: #include "copyright.h" ! 2: ! 3: /* $Header: XQuTree.c,v 11.15 87/09/11 08:06:20 toddb Exp $ */ ! 4: /* Copyright Massachusetts Institute of Technology 1986 */ ! 5: ! 6: #define NEED_REPLIES ! 7: #include "Xlibint.h" ! 8: ! 9: Status XQueryTree (dpy, w, root, parent, children, nchildren) ! 10: register Display *dpy; ! 11: Window w; ! 12: Window *root; ! 13: Window *parent; /* RETURN */ ! 14: Window **children; /* RETURN */ ! 15: unsigned int *nchildren; /* RETURN */ ! 16: { ! 17: long nbytes; ! 18: xQueryTreeReply rep; ! 19: register xResourceReq *req; ! 20: ! 21: LockDisplay(dpy); ! 22: GetResReq(QueryTree, w, req); ! 23: if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { ! 24: UnlockDisplay(dpy); ! 25: SyncHandle(); ! 26: return (0); ! 27: } ! 28: *parent = rep.parent; ! 29: *root = rep.root; ! 30: *nchildren = rep.nChildren; ! 31: *children = (Window *) NULL; ! 32: if (rep.nChildren != 0) { ! 33: *children = (Window *) Xmalloc ( ! 34: (unsigned)(nbytes = rep.nChildren * sizeof(Window))); ! 35: _XRead (dpy, (char *) *children, nbytes); ! 36: } ! 37: /* Note: won't work if sizeof(Window) is not 32 bits! */ ! 38: UnlockDisplay(dpy); ! 39: SyncHandle(); ! 40: return (1); ! 41: } ! 42:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.