Back to index

radiance  4R0+20100331
Functions | Variables
x11findwind.c File Reference
#include "copyright.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <X11/Xlib.h>

Go to the source code of this file.

Functions

Window xfindwind (Display *dpy, Window win, char *name, int depth)

Variables

static const char RCSid [] = "$Id: x11findwind.c,v 2.6 2004/07/04 12:08:47 schorsch Exp $"

Function Documentation

Window xfindwind ( Display *  dpy,
Window  win,
char *  name,
int  depth 
)

Definition at line 17 of file x11findwind.c.

{
       char   *nr;
       Window rr, pr, *cl;
       Window wr;
       unsigned int  nc;
       register int  i;

       if (depth == 0)             /* negative depths search all */
              return(None);
       if (!XQueryTree(dpy, win, &rr, &pr, &cl, &nc) || nc == 0)
              return(None);
       wr = None;           /* breadth first search */
       for (i = 0; wr == None && i < nc; i++)
              if (XFetchName(dpy, cl[i], &nr)) {
                     if (!strcmp(nr, name))
                            wr = cl[i];
                     free(nr);
              }
       for (i = 0; wr == None && i < nc; i++)
              wr = xfindwind(dpy, cl[i], name, depth-1);
       XFree((char *)cl);
       return(wr);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char RCSid[] = "$Id: x11findwind.c,v 2.6 2004/07/04 12:08:47 schorsch Exp $" [static]

Definition at line 2 of file x11findwind.c.