+ case kEventClassKeyboard :
+ {
+ converted = true ;
+ switch( GetEventKind(event) )
+ {
+ case kEventRawKeyDown :
+ rec->what = keyDown ;
+ break ;
+ case kEventRawKeyRepeat :
+ rec->what = autoKey ;
+ break ;
+ case kEventRawKeyUp :
+ rec->what = keyUp ;
+ break ;
+ case kEventRawKeyModifiersChanged :
+ rec->what = nullEvent ;
+ break ;
+ default :
+ converted = false ;
+ break ;
+ }
+ if ( converted )
+ {
+ UInt32 keyCode ;
+ unsigned char charCode ;
+ UInt32 modifiers ;
+ GetMouse( &rec->where) ;
+
+ err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
+ err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
+ err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
+ rec->modifiers = modifiers ;
+ rec->message = (keyCode << 8 ) + charCode ;
+ }
+ }
+ break ;
+ case kEventClassTextInput :
+ {
+ switch( GetEventKind( event ) )
+ {
+ case kEventTextInputUnicodeForKeyEvent :
+ {
+ EventRef rawEvent ;
+ err = GetEventParameter( event , kEventParamTextInputSendKeyboardEvent ,typeEventRef,NULL,sizeof(rawEvent),NULL,&rawEvent ) ;
+ converted = true ;
+ {
+ UInt32 keyCode ;
+ unsigned char charCode ;
+ UInt32 modifiers ;
+ GetMouse( &rec->where) ;
+ rec->what = keyDown ;
+ err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
+ err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
+ err = GetEventParameter(rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
+ rec->modifiers = modifiers ;
+ rec->message = (keyCode << 8 ) + charCode ;
+ }
+ }
+ break ;
+ default :
+ break ;
+ }
+ }
+ break ;