366 // Likewise, if the modifier field is nonzero, that means
367 // transform this character if only these modifiers are
368 // set in the testable flags.
369 return cur->javaChar;
370 }
371 }
372 }
373
374 if (nsChar >= NSUpArrowFunctionKey && nsChar <= NSModeSwitchFunctionKey) {
375 return java_awt_event_KeyEvent_CHAR_UNDEFINED;
376 }
377
378 // otherwise return character unchanged
379 return nsChar;
380 }
381
382 static unichar NsGetDeadKeyChar(unsigned short keyCode)
383 {
384 TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
385 CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
386 const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);
387 // Carbon modifiers should be used instead of NSEvent modifiers
388 UInt32 modifierKeyState = (GetCurrentEventKeyModifiers() >> 8) & 0xFF;
389
390 if (keyboardLayout) {
391 UInt32 deadKeyState = 0;
392 UniCharCount maxStringLength = 255;
393 UniCharCount actualStringLength = 0;
394 UniChar unicodeString[maxStringLength];
395
396 // get the deadKeyState
397 OSStatus status = UCKeyTranslate(keyboardLayout,
398 keyCode, kUCKeyActionDown, modifierKeyState,
399 LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit,
400 &deadKeyState,
401 maxStringLength,
402 &actualStringLength, unicodeString);
403
404 if (status == noErr && deadKeyState != 0) {
405 // Press SPACE to get the dead key char
|
366 // Likewise, if the modifier field is nonzero, that means
367 // transform this character if only these modifiers are
368 // set in the testable flags.
369 return cur->javaChar;
370 }
371 }
372 }
373
374 if (nsChar >= NSUpArrowFunctionKey && nsChar <= NSModeSwitchFunctionKey) {
375 return java_awt_event_KeyEvent_CHAR_UNDEFINED;
376 }
377
378 // otherwise return character unchanged
379 return nsChar;
380 }
381
382 static unichar NsGetDeadKeyChar(unsigned short keyCode)
383 {
384 TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
385 CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
386 if (uchr == nil) { return; }
387 const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);
388 // Carbon modifiers should be used instead of NSEvent modifiers
389 UInt32 modifierKeyState = (GetCurrentEventKeyModifiers() >> 8) & 0xFF;
390
391 if (keyboardLayout) {
392 UInt32 deadKeyState = 0;
393 UniCharCount maxStringLength = 255;
394 UniCharCount actualStringLength = 0;
395 UniChar unicodeString[maxStringLength];
396
397 // get the deadKeyState
398 OSStatus status = UCKeyTranslate(keyboardLayout,
399 keyCode, kUCKeyActionDown, modifierKeyState,
400 LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit,
401 &deadKeyState,
402 maxStringLength,
403 &actualStringLength, unicodeString);
404
405 if (status == noErr && deadKeyState != 0) {
406 // Press SPACE to get the dead key char
|