ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/x11findwind.c
(Generate patch)

Comparing ray/src/common/x11findwind.c (file contents):
Revision 2.2 by greg, Thu May 21 10:45:09 1992 UTC vs.
Revision 2.3 by greg, Fri Dec 11 18:23:38 1992 UTC

# Line 23 | Line 23 | int    depth;
23   {
24          char    *nr;
25          Window  rr, pr, *cl;
26 +        Window  wr;
27          unsigned int    nc;
28 +        register int    i;
29  
28        if (XFetchName(dpy, win, &nr)) {
29                register int    succ = !strcmp(nr, name);
30                free(nr);
31                if (succ) return(win);
32        }
30          if (depth == 0)         /* negative depths search all */
31                  return(None);
32          if (!XQueryTree(dpy, win, &rr, &pr, &cl, &nc) || nc == 0)
33                  return(None);
34 <        while (nc--)
35 <                if ((rr = xfindwind(dpy, cl[nc], name, depth-1)) != None)
36 <                        break;
34 >        wr = None;              /* breadth first search */
35 >        for (i = 0; wr == None && i < nc; i++)
36 >                if (XFetchName(dpy, cl[i], &nr)) {
37 >                        if (!strcmp(nr, name))
38 >                                wr = cl[i];
39 >                        free(nr);
40 >                }
41 >        for (i = 0; wr == None && i < nc; i++)
42 >                wr = xfindwind(dpy, cl[i], name, depth-1);
43          XFree((char *)cl);
44 <        return(rr);
44 >        return(wr);
45   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines