On 8 Jan 2009, at 14:14, Rainer Brockerhoff wrote:
Today, the only solution seems to be to install a Carbon Event handler for the {kEventClassApplication, kEventAppFrontSwitched} event.

Even if such a NSWorkspace notification were to appear in a future version of Mac OS X, I'd be interested in a lower-level solution. I have a background process that can't link to AppKit due to security restrictions, and Carbon Events have gone away for 64-bit processes.

I did look at how HIToolbox does its magic, but it appears to be listening to a private notification from the Process Manager. And BSD, of course, has no concept of "front process". If nobody knows another public API for an app activation notification, I'll file an enhancement request.

If you don't mind asking your users to switch on accessibility access ("enable access for assistive devices" in the Universal Access preferences), you can use the Accessibility APIs to monitor app switching (this is what's used in the iChatStatusFromApplication sample code, for example - http://developer.apple.com/samplecode/iChatStatusFromApplication/) .

I say this informationally - I don't think it's a great solution either.

Jamie.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to