Re: CGEventKeyboardGetUnicodeString + modifier key
Re: CGEventKeyboardGetUnicodeString + modifier key
- Subject: Re: CGEventKeyboardGetUnicodeString + modifier key
- From: Eric Schlegel <email@hidden>
- Date: Sun, 15 Apr 2007 22:58:45 -0700
On Apr 15, 2007, at 9:32 PM, Bill wrote:
I did as you suggested, but I can't seem to get anything in the
deadKeyState variable. I'm using a CGEventTapCallBack function
which looks mostly like this:
static UCKeyboardLayout *uchrData; // this is set elsewhere...
static UInt32 deadKeyState = 0;
CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type,
CGEventRef event, void *refcon)
{
UniCharCount maxStringLength = 1;
UniCharCount actualStringLength;
UniChar chars[0];
CGEventKeyboardGetUnicodeString( event, maxStringLength,
&actualStringLength, chars );
CGEventFlags flags = CGEventGetFlags ( event );
UInt16 keycode = CGEventGetIntegerValueField( event,
kCGKeyboardEventKeycode );
OSStatus err = UCKeyTranslate( uchrData, keycode,
kUCKeyActionDisplay, flags, LMGetKbdType(),
1, &deadKeyState, maxStringLength, &actualStringLength, chars );
...
}
I've tried changing the values of the input variables somewhat, but
deadKeyState is always 0. Any hints as to what I may be doing wrong?
My first guess is that you should be using kUCKeyActionDown (or Up)
rather than kUCKeyActionDisplay. Using the Display action probably
prevents dead-key processing. (I don't work on UCKeyTranslate so this
really is just a guess.)
-eric
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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