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 46 47 48 49 50
|
Boolean JS_ChecksIfWindowExists ( Display *Station,
Window Base,
char *Nom)
{
Window Generale, Parent, *Enfants=(Window *)NULL ;
int i ;
unsigned int Nb_Enfants ;
XClassHint *Hint=(XClassHint *)NULL;
/*
--- Checks the name of the base
*/
Hint = XAllocClassHint ();
if ( Hint == (XClassHint *)NULL )
return False ;
i = XGetClassHint (Station, Base, Hint );
if ( i != 0 )
{
if ( ((Hint->res_name != (char *)NULL) && (strstr (Hint->res_name, Nom) != (char *)NULL)) ||
((Hint->res_class != (char *)NULL) && (strstr (Hint->res_class, Nom) != (char *)NULL)) )
{
XFree ( Hint );
return True ;
}
}
XFree ( Hint);
/*
--- If it is not the right name, gets which windows are children and tests them iteratively
*/
XQueryTree ( Station, Base, &Generale,
&Parent, &Enfants, &Nb_Enfants );
if ( Nb_Enfants == 0 )
return False ;
for ( i = (Nb_Enfants-1) ; i >= 0 ; i-- )
if ( JS_ChecksIfWindowExists (Station, Enfants[i], Nom) )
{
XFree ( Enfants );
return True ;
}
XFree ( Enfants );
return False ;
} |
Partager