1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
/*
* Hierarchie
*
*/
static void Hierarchie ( Display display, Window racine )
{
Window w1, child, *children=(Window *)NULL ;
int nchildren, i ;
char *p=NULL ;
XQueryTree ( display, racine, &w1, &child, &children, &nchildren );
if ( nchildren > 0 )
{
for ( i = 0 ; i < nchildren ; i++ )
Hierarchie ( display, children[i] );
XFree(children);
}
XFetchName(display, window, &p) ;
if ( p != NULL )
{
fprintf ( stderr, "Nom : %s\n", p) ;
XFree(p);
}
else
fprintf ( stderr, "Une fenetre avec un nom NULL\n") ;
}
int main ( void)
{
Display display ;
Window root ;
display = XOpenDisplay ("");
root = XRootWindow (display, 0);
Hierarchie(display, root);
XCloseDisplay(display);
return 0 ;
} |
Partager