On Jun 29, 2011, at 7:32 PM, Jerry Krinock wrote:

> When I install a custom URL handler like this:
> 
> NSAppleEventManager *aem = [NSAppleEventManager sharedAppleEventManager] ;
> [aem setEventHandler:self
>         andSelector:@selector(handleGetURLEvent:withReplyEvent:)
>       forEventClass:kInternetEventClass
>          andEventID:kAEGetURL] ;

> still when such custom URL is received, the system still brings all of the 
> app's windows to the front.  I want the app to receive the message silently 
> and then I'll display a window if needed.
> 
> I was wondering if anyone knows any way to change the activation behavior.  
> I've set breakpoints on -[NSApplication activateIgoringOtherApps:] and also 
> NSWindow methods one would use to front or display a window, but they never 
> break.  It's like Apple is using some master 'activate' switch under the hood.

The app doesn't activate itself.  It is being activated by Launch Services, in 
another process -- either the program which used Launch Services or launchd or 
some other system agent.

Being asked to open a URL is analogous to being asked to open a document (and 
identical for file URLs), and your app is brought forward for the same reason.

You could use a background-only sub-application to receive the URL and then 
pass it to your main application using some other IPC mechanism (e.g. 
Distributed Objects).  I suppose you could even forward the Apple Event 
directly.  Either way, your sub-application would have to launch your main 
application if it weren't already running.

Regards,
Ken

_______________________________________________

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