예제 #1
0
파일: screen.c 프로젝트: Feechka/UOBP
static void finiTerm(void) {
  logMessage(LOG_DEBUG,"end of term %p",curTerm);
  Accessible_unref(curTerm);
  curTerm = NULL;
  Accessible_unref(curFocus);
  curFocus = NULL;
  curPosX = curPosY = 0;
}
static void
test_desktop (void)
{
	Accessible  *desktop;
	Accessible  *application;
	Accessible **list;

	fprintf (stderr, "Testing desktop...\n");

	g_assert (SPI_getDesktop (-1) == NULL);
	desktop = SPI_getDesktop (0);
	g_assert (desktop != NULL);

	g_assert ((SPI_getDesktopList (&list)) > 0);
	g_assert (list[0] == desktop);
	SPI_freeDesktopList (list);

	validate_accessible (desktop, FALSE, FALSE);

	application = Accessible_getChildAtIndex (desktop, 0);
	g_assert (application != NULL);
	AccessibleApplication_unref (application);

	Accessible_unref (desktop);
}
예제 #3
0
static gboolean
control_spi_listener_process_event (gpointer data)
{
    AccessibleEvent *event;
    ControlSpiListener *listener = CONTROL_SPI_LISTENER (data);

    while (g_queue_is_empty(listener->event_queue) == FALSE) {
        event = (AccessibleEvent *)g_queue_pop_head(listener->event_queue);

        if (strcmp (event->type, "window:activate") == 0) {
            if (listener->root)
                Accessible_unref (listener->root);
            Accessible_ref (event->source);
            listener->root = event->source;
        }

        AccessibleEvent_unref (event);
    }

    control_spi_listener_free_actions_list (listener);
    control_spi_listener_build_actions_list (listener, listener->root, 0);
    control_spi_listener_dump_actions_list (listener);

    g_signal_emit (listener,
                   control_spi_listener_signals[SIGNAL_CHANGED], 0, NULL);

    listener->idle_id = 0;

    return FALSE;
}
static void
global_listener_cb (const AccessibleEvent *event,
		    void                  *user_data)
{
	TestWindow *win = user_data;
	Accessible *desktop;
	AccessibleApplication *application;

	g_assert (win->magic == WINDOW_MAGIC);
	g_assert (!strcmp (event->type, "focus:"));

	fprintf (stderr, "Fielded focus event ...\n");

	if (!do_poke) {
		desktop = SPI_getDesktop (0);
		application = Accessible_getChildAtIndex (desktop, 0);
		g_assert (application != NULL);
		Accessible_unref (desktop);
		
		test_application (application);
		
		AccessibleApplication_unref (application);
		
		print_tree = FALSE;

		validate_accessible (event->source, TRUE, TRUE);

		fprintf (stderr, "quitting mainloop.\n");
		gtk_main_quit ();
	}

	print_tree = TRUE;
	validate_accessible (event->source, TRUE, TRUE);
}
static void
test_table (AccessibleTable *table)
{
	Accessible *header;
	gint index;
	gint rows, columns;

	fprintf (stderr, "Testing table ...\n");

	rows = AccessibleTable_getNRows (table);
	g_assert (rows > 0);

	columns = AccessibleTable_getNColumns (table);
	g_assert (columns > 0);

	index = AccessibleTable_getIndexAt (table, rows - 1, columns - 1);

	g_assert (AccessibleTable_getRowAtIndex (table, index) == rows - 1);

	g_assert (AccessibleTable_getColumnAtIndex (table, index) == columns - 1);

	g_assert ((header = AccessibleTable_getColumnHeader (table, 0)));
	Accessible_unref (header);

	AccessibleTable_isSelected (table, 0, 0);
	
	/* FIXME: lots more tests */
}
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--;
}
예제 #7
0
static gboolean
mt_main_use_move_release (MTClosure *mt)
{
    Accessible *point, *search;

    point = mt_accessible_at_point (mt->pointer_x, mt->pointer_y);
    if (point) {
	search = mt_accessible_search (point,
				       MT_SEARCH_TYPE_BREADTH,
				       eval_func, push_func, mt);
	Accessible_unref (point);
	if (search) {
	    Accessible_unref (search);
	    return TRUE;
	}
    }
    return FALSE;
}
예제 #8
0
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);
    }
}
예제 #9
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;
    }
}
예제 #10
0
static void
control_spi_listener_free_actions_list (ControlSpiListener *listener)
{
    GSList *l;
    AccessibleItem *item;

    for (l = listener->actions; l; l = l->next) {
        item = (AccessibleItem *)l->data;
        Accessible_unref (item->accessible);
        g_free (item->name);
        g_free (item);
    }
    g_slist_free (listener->actions);
    listener->actions = NULL;
}
예제 #11
0
static void search_desktop_for_application( Driver* dp ) {
    SPIExceptionHandler handler = exception_handler;
    if ( ! SPI_exceptionHandlerPush(&handler) )
        report_error( "Failed to add an ExceptionHandler." );

    int count = SPI_getDesktopCount();
    if ( count != 1 )
        rb_raise( rb_eSystemCallError,
                "There are %d desktops.  Expected to find one.", count );

    Accessible* desktop = SPI_getDesktop( 0 );
    search_for_application( dp, desktop );
    Accessible_unref( desktop );

    SPI_exceptionHandlerPop();
}
static void
test_component (AccessibleComponent *component)
{
	long x, y, width, height;

	fprintf (stderr, "Testing component...\n");

	AccessibleComponent_getExtents (
		component, &x, &y, &width, &height, SPI_COORD_TYPE_SCREEN);

	AccessibleComponent_getPosition (
		component, &x, &y, SPI_COORD_TYPE_SCREEN);

	AccessibleComponent_getSize (component, &width, &height);

	if (width > 0 && height > 0) {
#ifdef FIXME
		Accessible *accessible, *componentb;
#endif

		g_assert (AccessibleComponent_contains (
			component, x, y, SPI_COORD_TYPE_SCREEN));

		g_assert (AccessibleComponent_contains (
			component, x + width - 1, y, SPI_COORD_TYPE_SCREEN));

		g_assert (AccessibleComponent_contains (
			component, x + width - 1, y + height - 1,
			SPI_COORD_TYPE_SCREEN));

#ifdef FIXME
		accessible = AccessibleComponent_getAccessibleAtPoint (
			component, x, y, SPI_COORD_TYPE_SCREEN);

		g_assert (Accessible_isComponent (accessible));
		componentb = Accessible_getComponent (accessible);
		g_assert (componentb == component);

		AccessibleComponent_unref (componentb);
		Accessible_unref (accessible);
#endif
	}

	AccessibleComponent_getLayer (component);
	AccessibleComponent_getMDIZOrder (component);
/*	AccessibleComponent_grabFocus (component); */
}
예제 #13
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;
    }
}
예제 #14
0
파일: eventlog.c 프로젝트: GNOME/at-poke
void
log_object_active_descendant_changed (EventLog *log, const AccessibleEvent *event)
{
	Accessible *desc;

	if (!log_sanity_check (log, event, SANITY_CHECK_SOURCE) )
		return;

	log_message (log, "active descendant changed %d %d parent: ",
		     event->detail1, event->detail2);
	log_accessible (log, event->source);
	log_message (log, " child: ");
	desc = AccessibleActiveDescendantChangedEvent_getActiveDescendant (event);
	log_accessible (log, desc);
	log_message (log, "\n");
	
	Accessible_unref (desc);
}
예제 #15
0
파일: eventlog.c 프로젝트: GNOME/at-poke
void
log_object_property_change (EventLog *log, const AccessibleEvent *event)
{
	char *detail;

	if (!log_sanity_check (log, event, SANITY_NOCHECK_SOURCE) )
		return;

	{
		char **split = g_strsplit (event->type, ":", -1);
		if (split && split[0] && split[1] && split[2])
			detail = g_strdup (split[2]);
		else
			detail = g_strdup ("");
		g_strfreev (split);
	}

	if (!strcmp (detail, "accessible-name")) {
		char *text = AccessibleNameChangedEvent_getNameString (event);
		log_string_prop_change (log, event, "name", text);
		SPI_freeString (text);

	} else if (!strcmp (detail, "accessible-description")) {
		char *text = AccessibleDescriptionChangedEvent_getDescriptionString (event);
		log_string_prop_change (log, event, "description", text);
		SPI_freeString (text);

	} else if (!strcmp (detail, "accessible-parent")) {
		Accessible *parent = AccessibleParentChangedEvent_getParentAccessible (event);
		log_message (log, "parent change %d %d on ", event->detail1, event->detail2);
		log_accessible (log, event->source);
		log_message (log, " to parent: ");
		log_accessible (log, parent);
		log_message (log, "\n");
		
		Accessible_unref (parent);
 	} else {
		log_message (log, "generic property change (%s) %d %d on ",
			     event->type, event->detail1, event->detail2);
		log_accessible (log, event->source);
		log_message (log, "\n");
	}
	g_free (detail);
}
예제 #16
0
파일: eventlog.c 프로젝트: GNOME/at-poke
void
log_object_children_changed (EventLog *log, const AccessibleEvent *event)
{
	Accessible *child;

	if (!log_sanity_check (log, event, SANITY_CHECK_SOURCE) )
		return;

	log_message (log, "children changed event (%s) %d %d parent: ", event->type,
		     event->detail1, event->detail2);
	log_accessible (log, event->source);

	child = AccessibleChildChangedEvent_getChildAccessible (event);
	log_message (log, " child: ");
	log_accessible (log, child);
	log_message (log, "\n");

	Accessible_unref (child);
}
예제 #17
0
static void closedown( Driver* dp ) {
    Accessible_unref( dp->frame );
    int leaks = SPI_exit();
    report_if_error( "There were %d SPI memory leaks.", leaks );
}
예제 #18
0
void windows_unref ( SQByteArray * _pointer )
{
   Accessible * accessibleObject = windows_to_accessible(_pointer);
   Accessible_unref ( accessibleObject );
}