[g-a-devel]accessible state of foreground application

hi everyone,

(fyi -- just pulled the latest gnome-head so i think i'm up-to-date)

i am currently trying to figure out the right way to get the Accessible* to the foreground application (without having to trigger on an event).

i was wondering if i could count on the foreground application to have the SPI_STATE_ACTIVE state (if not now - then in the future?).  if i am going about this all wrong please call me on it ;-)

here's an attempt at solving my task (modified sample code) but the stateset seems to be 0...  (i tried a few examples from /gnome/head/cvs/gtk+/examples)

// left off here...
Accessible* gok_get_foreground_accessible ()
	int i,j;
	int n_desktops;
	int n_apps;
	Accessible* desktop;
	Accessible* application;
	AccessibleStateSet* stateset;
	n_desktops = SPI_getDesktopCount ();

	for (i=0; i<n_desktops; ++i)
		desktop = SPI_getDesktop (i);
		n_apps = Accessible_getChildCount (desktop);
		for (j=0; j<n_apps; ++j)
			application = Accessible_getChildAtIndex (desktop, j);
			stateset = Accessible_getStateSet(application);
			printf("looking at an app state set: %d\n",stateset);
			if (AccessibleStateSet_contains(stateset, SPI_STATE_ACTIVE) == TRUE)
				printf("found active app\n");
				Accessible_unref (desktop);
				return application;		
			Accessible_unref (application);
		Accessible_unref (desktop);
	return NULL;




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]