Receive custom url without bringing app to front?
Receive custom url without bringing app to front?
- Subject: Receive custom url without bringing app to front?
- From: Jerry Krinock <email@hidden>
- Date: Wed, 29 Jun 2011 17:32:51 -0700
When I install a custom URL handler like this:
NSAppleEventManager *aem = [NSAppleEventManager sharedAppleEventManager] ;
[aem setEventHandler:self
andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL] ;
even if I change my handler to no-op like this,
- (void)handleGetURLEvent:(NSAppleEventDescriptor*)event
withReplyEvent:(NSAppleEventDescriptor*)replyEvent {
return ;
...
}
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.
Yes, I know how to fix this by using a less cheesy method of interapplication communication, but I'm trying to be lazy. Another alternative is to re-activate the prior frontmost app, or hide the app, after it activates, but that looks pretty bad. To truly restore the user's workspace I'd need an API which gives the ordering of windows on the screen relative to those of other apps, but I've never been able to find such API.
Thanks,
Jerry Krinock
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden