ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/x11findwind.c
Revision: 3.3
Committed: Tue Mar 18 04:45:29 2003 UTC (21 years, 1 month ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 3.2: +1 -1 lines
State: FILE REMOVED
Log Message:
Removed duplicate copies of file and fixed comment in release notes

File Contents

# User Rev Content
1 greg 3.1 #ifndef lint
2 greg 3.3 static const char RCSid[] = "$Id: x11findwind.c,v 3.2 2003/02/25 02:47:24 greg Exp $";
3 greg 3.1 #endif
4     /*
5     * find a window by its name under X
6     */
7    
8 greg 3.2 #include "copyright.h"
9 greg 3.1
10     #include <stdio.h>
11     #include <X11/Xlib.h>
12    
13    
14     Window
15     xfindwind(dpy, win, name, depth)
16     Display *dpy;
17     Window win;
18     char *name;
19     int depth;
20     {
21     char *nr;
22     Window rr, pr, *cl;
23     Window wr;
24     unsigned int nc;
25     register int i;
26    
27     if (depth == 0) /* negative depths search all */
28     return(None);
29     if (!XQueryTree(dpy, win, &rr, &pr, &cl, &nc) || nc == 0)
30     return(None);
31     wr = None; /* breadth first search */
32     for (i = 0; wr == None && i < nc; i++)
33     if (XFetchName(dpy, cl[i], &nr)) {
34     if (!strcmp(nr, name))
35     wr = cl[i];
36     free(nr);
37     }
38     for (i = 0; wr == None && i < nc; i++)
39     wr = xfindwind(dpy, cl[i], name, depth-1);
40     XFree((char *)cl);
41     return(wr);
42     }