Le 2 févr. 2010 à 15:51, Jerry Krinock a écrit :

> In Mac OS 10.6, during -applicationDidFinishLaunching, [NSEvent currentEvent] 
> returns nil, so the usual code,
> 
>   [[NSEvent currentEvent] modifierFlags]
> 
> is not useful for determining if a modifier key was held down during launch.  
> (By accident, I've noticed that I do get an event with correct modifierFlags 
> if I send the message after a performSelector:withObject:afterDelay:.05.  But 
> I'd rather not do that.)
> 
> Searching the list archives, from 8 years ago I find the solution is to 
> instead #import <Carbon/Carbon.h> and use GetCurrentEventKeyModifiers().
> 
> It works, and although there is copious documentation in the header and in 
> the Carbon Event Manager Programming Guide, searching current Xcode 
> documentation for this function gives "No Results", and since this function 
> returns a UInt32, I wonder if it will be supported in current and future 
> 64-bit builds? 


NSUInteger modifiers  = 
CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState);



-- Jean-Daniel




_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to