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);
}
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);
}
示例#3
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();
}
SQByteArray * windows_desktop ( int _desktop )
{
    return windows_from_accessible ( SPI_getDesktop ( _desktop ) );
}