-#define S(x) (sizeof((x))-1)
-
- Atom wm_name= XInternAtom(disp,"WM_NAME",True);
- xassert(wm_name != None);
-
- for (screen=0; screen<ScreenCount(disp); screen++) {
- debugfind("FINDYPP screen %d\n", screen);
- root= RootWindow(disp,screen);
- unsigned int nchildren1;
- Window *children1=0;
-
- xassert( XQueryTree(disp,root,
- &gotroot,&gotparent,
- &children1,&nchildren1) );
- debugfind("FINDYPP screen %d nchildren1=%d\n", screen, nchildren1);
-
- int i;
- for (i=0; i<nchildren1; i++) {
- Window w1= children1[i];
- unsigned int nchildren2;
- Window *children2=0;
-
- xassert( XQueryTree(disp,w1,
- &gotroot,&gotparent,
- &children2,&nchildren2) );
- debugfind("FINDYPP screen %d c1[%2d]=0x%08lx nchildren2=%d\n",
- screen, i, (unsigned long)w1, nchildren2);
-
- int j;
- for (j=-1; j<(int)nchildren2; j++) {
- Window w2= j<0 ? w1 : children2[j];
- debugfind("FINDYPP screen %d c1[%2d]=0x%08lx c2[%2d]=0x%08lx",
- screen, i, (unsigned long)w1, j, (unsigned long)w2);
-
- int gotfmt;
- Atom gottype;
- unsigned long len, gotbytesafter;
- char *title;
- unsigned char *gottitle=0;
- xassert( !XGetWindowProperty(disp,w2, wm_name,0,512, False,
- AnyPropertyType,&gottype, &gotfmt, &len,
- &gotbytesafter, &gottitle) );
- title= (char*)gottitle;
-
- if (DEBUGP(findypp)) {
- debugfind(" gf=%d len=%lu gba=%lu \"", gotfmt,len,gotbytesafter);
- char *p;
- for (p=title; p < title+len; p++) {
- char c= *p;
- if (c>=' ' && c<=126) fputc(c,debug);
- else fprintf(debug,"\\x%02x",c & 0xff);
- }
- fputs("\": ",debug);
- }
+#define S(x) ((int)sizeof((x))-1)
+
+ debugfind("FINDYPP %d/%d screen %d %*s %lx",
+ depth,targetdepth,screen,
+ depth,"",(unsigned long)w);
+
+ if (depth!=targetdepth) {
+ xassert( XQueryTree(disp,w,
+ &gotroot,&gotparent,
+ &children,&nchildren) );
+ debugfind(" nchildren=%d\n",nchildren);
+
+ for (i=0; i<nchildren; i++) {
+ Window child= children[i];
+ findypp_recurse(depth+1, targetdepth, child);
+ }
+ XFree(children);
+ return;
+ }
+