| I use a program that produces output like that below.
It is in the next reply (72 lines). According to its
initial comment it
/*
Walk the window tree. For every window with any of
a class hints application class, class hints application
name, or name, write the window id and the data found
to the standard output.
*/
I use the window id in another program to change the
title, icon, or position, and the class hints application
class or name for the defaults file.
Dan
P.s. sample output:
$ run findappls.exe
window: 9437200
res_class: DECW$BANNER
res_name: Banner
name: Banner
window: 2097173
res_class: DECW$TERMINAL
res_name: decw$terminal
name: ZFC
window: 13631490
res_class: emacs
res_name:
name: GNU Emacs
window: 11534415
res_class: DECW$MAIL
res_name: Mail
name: Mail
window: 3145755
res_class: Decw$Session
res_name: Session Manager
name: Daniel V. D'Eramo
.
.
.
|
| /*
Walk the window tree. For every window with any of
a class hints application class, class hints application
name, or name, write the window id and the data found
to the standard output.
*/
/*
Thanks to Dave Burleigh (TBD1::BURLEIGH) for his XTREE.C
which provided the skeleton for this program.
*/
#include <stdio.h>
#include <decw$include/Xlib.h>
#include <decw$include/Xutil.h>
static void WalkWindowTree(); /* recursive */
main(argc, argv)
unsigned int argc;
char *argv[];
{
Display *display;
if (!(display = XOpenDisplay(NULL))) {
fprintf(stderr, "Can't open display\n");
exit(0);
}
WalkWindowTree(display, RootWindow(display, DefaultScreen(display)));
exit(1);
}
static void WalkWindowTree(display, window)
Display *display;
Window window;
{
Window root, parent, *children;
int nchildren;
XClassHint ch;
char *name;
ch.res_name = NULL;
ch.res_class = NULL;
name = NULL;
XGetClassHint(display, window, &ch);
XFetchName(display, window, &name);
if (ch.res_class || ch.res_name || name) {
printf("window: %d\n", window);
if (ch.res_class)
printf(" res_class: %s\n", ch.res_class);
if (ch.res_name)
printf(" res_name: %s\n", ch.res_name);
if (name)
printf(" name: %s\n", name);
if (ch.res_name) XFree(ch.res_name);
if (ch.res_class) XFree(ch.res_class);
if (name) XFree(name);
}
XQueryTree(display, window, &root, &parent, &children, &nchildren);
if (nchildren) {
register int i;
register Window *child;
for (i = 0, child = children; i < nchildren; ++i, ++child)
WalkWindowTree(display, *child);
XFree(children);
}
return;
}
|