• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGEventKeyboardGetUnicodeString + modifier key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • controlling display sleep
      • From: arri <email@hidden>
References: 
 >Re: CGEventKeyboardGetUnicodeString + modifier key (From: email@hidden)
 >Re: CGEventKeyboardGetUnicodeString + modifier key (From: Eric Schlegel <email@hidden>)
 >Re: CGEventKeyboardGetUnicodeString + modifier key (From: Bill <email@hidden>)

  • Prev by Date: Re: Document based apps & tabbed windows?
  • Next by Date: makeKeyandOrderFront not working.
  • Previous by thread: Re: CGEventKeyboardGetUnicodeString + modifier key
  • Next by thread: controlling display sleep
  • Index(es):
    • Date
    • Thread