static void
control_spi_listener_build_actions_list (ControlSpiListener *listener, Accessible *parent, int depth)
{
    Accessible* child;
    AccessibleRole role;

    int i, child_count;

    if (depth > SEARCH_DEPTH)
        return;

    child_count = Accessible_getChildCount (parent);

    child_count = MIN (child_count, SEARCH_BREADTH);

    for (i = 0; i < child_count; ++i) {
        char *name;
        char *normalized_name;

        child = Accessible_getChildAtIndex (parent, i);

        if (child == parent)
            continue;

        name = Accessible_getName (child);

#if DEBUG
        {
            gchar *role_name;

            role_name = Accessible_getRoleName (child);
            g_message ("Looking at %s %s", role_name, name);
        }
#endif

        if (name) {
            normalized_name = control_spi_listener_normalize (name);
            if (normalized_name && strlen(normalized_name) > 0 && is_actionable (child)) {
                AccessibleItem *item;

                item = g_new0(AccessibleItem, 1);
                Accessible_ref (child);
                item->accessible = child;
                item->name = g_strdup (normalized_name);

                listener->actions = g_slist_append (listener->actions, item);
            }
            SPI_freeString (name);
            g_free (normalized_name);
        }

        if (is_worth_searching (child))
            control_spi_listener_build_actions_list (listener, child, depth+1);

        Accessible_unref (child);
    }
}
Esempio n. 2
0
static void search_for_matching_frame( Driver* dp, Accessible* application ) {
    int child_count = Accessible_getChildCount( application );
    int i;
    for ( i = 0; i < child_count; ++i ) {
        Accessible* child = Accessible_getChildAtIndex( application, i );
        check_for_matching_frame( dp, child );
        Accessible_unref( child );
        if ( dp->found_application )
            break;
    }
}
static void
validate_tree (Accessible *accessible,
	       gboolean    has_parent,
	       gboolean    recurse_down)
{
	Accessible  *parent;
	long         len, i;

	parent = Accessible_getParent (accessible);
	if (has_parent) {
		long        index;
		Accessible *child_at_index;

		g_assert (parent != NULL);

		index = Accessible_getIndexInParent (accessible);
		g_assert (index >= 0); 

		child_at_index = Accessible_getChildAtIndex (parent, index);

		g_assert (child_at_index == accessible);

		Accessible_unref (child_at_index);
		Accessible_unref (parent);
	}

	len = Accessible_getChildCount (accessible);
	print_tree_depth++;
	for (i = 0; i < len; i++) {
		Accessible *child;

		child = Accessible_getChildAtIndex (accessible, i);
#ifdef ROPEY
		if (!child)
			fprintf (stderr, "Unusual - ChildGone at %ld\n", i);

		g_assert (Accessible_getIndexInParent (child) == i);
		g_assert (Accessible_getParent (child) == accessible);
#endif

		if (recurse_down && child)
			validate_accessible (child, has_parent, recurse_down);

		Accessible_unref (child);
	}
	print_tree_depth--;
}
Esempio n. 4
0
static void search_for_application( Driver* dp, Accessible* desktop ) {
    int child_count = Accessible_getChildCount( desktop );
    if ( child_count == 0 )
        report_error( "The Desktop has no children. Have you re-logged in?" );

    int i;
    for ( i = 0; i < child_count; ++i ) {
        Accessible* child = Accessible_getChildAtIndex( desktop, i );
        if ( child == NULL )
            continue;

        search_for_matching_frame( dp, child );
        Accessible_unref( child );
        if ( dp->found_application )
            break;
    }
}
long windows_children ( SQByteArray * _pointer )
{
   Accessible * accessibleObject = windows_to_accessible(_pointer);
   return Accessible_getChildCount ( accessibleObject );
}