Re: Alternative startup for application
Re: Alternative startup for application
- Subject: Re: Alternative startup for application
- From: Gideon King <email@hidden>
- Date: Sat, 3 Apr 2010 09:15:22 +1000
Excellent, I like the new way of doing it using NSEvent directly, but I do need to support Leopard.
If you launch from Finder holding the Option key, Finder closes the window you launched from, but I can tell people to put it in the dock and launch from there to avoid that.
Here's what I'm doing, which appears to work fine (haven't tested on Leopard yet, but have tested the CG code in Snow Leopard and that worked).:
- (void)applicationWillFinishLaunching:(NSNotification*)aNotification {
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_5) {
if (([NSEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask) == NSAlternateKeyMask) {
[self doSpecialStartup];
}
} else {
CGEventRef event = CGEventCreate(NULL);
CGEventFlags modifiers = CGEventGetFlags(event);
CFRelease(event);
if ((modifiers & kCGEventFlagMaskAlternate) == kCGEventFlagMaskAlternate) {
[self doSpecialStartup];
}
}
...
}
Thanks again for the help.
Gideon
> The "modern" (Snow Leopard) equivalent for finding the state of the Option key would be +[NSEvent modifierFlags].
_______________________________________________
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