ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/x11findwind.c
Revision: 2.1
Committed: Tue Nov 12 16:55:41 1991 UTC (32 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.1: +0 -0 lines
Log Message:
updated revision number for release 2.0

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1991 Regents of the University of California */
2    
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * find a window by its name under X
9     *
10     * 4/22/91 Greg Ward
11     */
12    
13     #include <stdio.h>
14     #include <X11/Xlib.h>
15    
16    
17     Window
18     xfindwind(dpy, win, name, depth)
19     Display *dpy;
20     Window win;
21     char *name;
22     int depth;
23     {
24     char *nr;
25     Window rr, pr, *cl;
26     int nc;
27    
28     if (XFetchName(dpy, win, &nr)) {
29     register int succ = !strcmp(nr, name);
30     free(nr);
31     if (succ) return(win);
32     }
33     if (depth == 0) /* negative depths search all */
34     return(None);
35     if (!XQueryTree(dpy, win, &rr, &pr, &cl, &nc) || nc == 0)
36     return(None);
37     while (nc--)
38     if ((rr = xfindwind(dpy, cl[nc], name, depth-1)) != None)
39     break;
40     XFree((char *)cl);
41     return(rr);
42     }