Re: How to track global focus?
Re: How to track global focus?
- Subject: Re: How to track global focus?
- From: David Niemeijer <email@hidden>
- Date: Mon, 29 May 2006 21:19:22 +0200
At 12:41 -0400 29/5/06, Bill Cheeseman wrote:
on 2006-05-29 9:35 AM, David Niemeijer at email@hidden wrote:
I need to track the focused UIElement. Within an application I can
get notifications of when the focused UIElement changes, but there
seems to be no way to get a notification system wide, thus when the
focused UIElement changes either within the front app or from app A
to app B or to the Dock, etc.
Here's a thought in case your application is a Cocoa application: Use your
app's Cocoa notification center to register to observe the NSWorkspace
NSWorkspaceDidLaunchApplicationNotification. Every time it detects that a
new application is launched, register an accessibility notification on the
new application to observe the AXApplicationActivated notification. At any
point in time, for example when your application is launched, you can use
NSWorkspace to get a list of all running applications and register to
observe AXApplicationActivated on all of them.
This is similar to what I am already doing under Carbon. It works
great for regular apps, but not for faceless ones that do have a UI.
I believe NSWorkspace does not detect launches of faceless background
applications, which would include the Dock and the SystemUIServer, and I
know it does not include them in its list of running applications. Perhaps
Carbon has better capabilities to notice when faceless background
applications are launched. I know it can give you a list of running
applications that includes faceless background applications.
Yes, I can obtain a list of all running applications, but I am not
sure there is a straightforward way to figure out which of the
background apps has or can have a UI . I know about the Dock and
SystemUIServer, but there might well be others on a user's system
that I do not know about. Perhaps Eric knows the answer to that :-)
Thanks,
david.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Accessibility-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden