I'm currently cribbing from here:

http://lists.apple.com/archives/carbon-dev/2005/May/msg01062.html

 

And I got rid of the non-uchr section. I can require Leopard in this case.

 

 

From: Jean-Daniel Dupas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 17, 2008 9:37 AM
To: John Stiles
Cc: cocoa dev
Subject: Re: -charactersIgnoringModifiers and the shift key

 

 

Le 17 avr. 08 à 18:18, John Stiles a écrit :





Sweet, I will take a look at this and post back when I have results or 
questions. Thanks!

Greg Titus wrote:



I think you'd ask the NSEvent for its -keyCode, then pass that key code to 
UCKeyTranslate() with all the modifier key state (including shift) turned off 
in order to get a unicode string for what that key would mean if the user 
hadn't been pressing any modifiers.

         

        Hope that helps,

           - Greg

 

This way works well if you target Leopard only, but some layout do not have 
uchr resources on Tiger.

 

At least on Leopard, you can retreive the keyboard layout like that:

 

TISInputSourceRef input = TISCopyCurrentKeyboardLayoutInputSource();

CFDataRef uchr = TISGetInputSourceProperty(input, 
kTISPropertyUnicodeKeyLayoutData);

const UCKeyboardLayout *layout = (const UCKeyboardLayout * 
)CFDataGetBytePtr(uchr);

 

 

If you need help for Tiger, just ask, I already did it too.

 

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to