At 05:55 -0800 08/01/09, cocoa-dev-requ...@lists.apple.com wrote:
>From: Jerry Krinock <je...@ieee.org>
>References: <63539670901072146w570a8dc1wc13c58b8ecb43...@mail.gmail.com>
>       <f9d125f1-0873-4967-893a-20e851278...@codeferous.com>
>       <63539670901072246j1f659c63q33a73b501233f...@mail.gmail.com>
>       <63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com>
>In-Reply-To: <63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com>
>Date: Thu, 8 Jan 2009 05:39:57 -0800
>Message-ID: <406b8377-613f-49d2-a3de-2ba381346...@ieee.org>
>
>On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:
>
>>does this work with Dashboard?  it seems that dashboard is a
>>background application that's always open...
>
>Well, obviously it does not.
>
>You'd need a NSWorkspaceDidActivateApplicationNotification, but it looks like 
>there is no such thing.  You could periodically poll -[NSWorkspace 
>activeApplication], but I hope someone has a better idea, because if you do I 
>would not want your process running on my Mac.

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.

-- 
Rainer Brockerhoff  <rai...@brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
_______________________________________________

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