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 (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