--- old/src/windows/native/sun/windows/awt_Component.cpp 2012-09-11 16:42:57.380080400 +0400 +++ new/src/windows/native/sun/windows/awt_Component.cpp 2012-09-11 16:42:56.662039300 +0400 @@ -3144,7 +3144,8 @@ return; } -UINT AwtComponent::WindowsKeyToJavaKey(UINT windowsKey, UINT modifiers) +UINT AwtComponent::WindowsKeyToJavaKey(UINT windowsKey, UINT modifiers, UINT character, BOOL isDeadKey) + { // Handle the few cases where we need to take the modifier into // consideration for the Java VK code or where we have to take the keyboard @@ -3171,6 +3172,15 @@ break; }; + // check dead key + if(isDeadKey){ + for (int i = 0; charToDeadVKTable[i].c != 0; i++) { + if (charToDeadVKTable[i].c == character) { + return charToDeadVKTable[i].javaKey; + } + } + } + // for the general case, use a bi-directional table for (int i = 0; keyMapTable[i].windowsKey != 0; i++) { if (keyMapTable[i].windowsKey == windowsKey) { @@ -3384,15 +3394,20 @@ } } -UINT AwtComponent::WindowsKeyToJavaChar(UINT wkey, UINT modifiers, TransOps ops) +void AwtComponent::WindowsKeyToJavaChar(UINT wkey, UINT modifiers, TransOps ops, UINT *character, BOOL *isDeadKey) { static Hashtable transTable("VKEY translations"); + static Hashtable deadKeyFlagTable("Dead Key Flags"); + *isDeadKey = FALSE; // Try to translate using last saved translation if (ops == LOAD) { void* value = transTable.remove(reinterpret_cast(static_cast(wkey))); + void* deadKeyFlag = deadKeyFlagTable.remove(reinterpret_cast(static_cast(wkey))); if (value != NULL) { - return static_cast(reinterpret_cast(value)); + *character = static_cast(reinterpret_cast(value)); + *isDeadKey = static_cast(reinterpret_cast(deadKeyFlag)); + return; } } @@ -3400,8 +3415,10 @@ // In this case, we want to return 10 ('\n') // Since ToAscii would convert VK_RETURN to '\r', we need // to have a special case here. - if (wkey == VK_RETURN) - return '\n'; + if (wkey == VK_RETURN){ + *character= '\n'; + return; + } // high order bit in keyboardState indicates whether the key is down static const BYTE KEY_STATE_DOWN = 0x80; @@ -3490,6 +3507,7 @@ &mbChar, 0, GetKeyboardLayout()); UINT translation; + BOOL deadKeyFlag = (converted == 2); // Dead Key if (converted < 0) { @@ -3517,8 +3535,13 @@ if (ops == SAVE) { transTable.put(reinterpret_cast(static_cast(wkey)), reinterpret_cast(static_cast(translation))); + deadKeyFlagTable.put(reinterpret_cast(static_cast(wkey)), + reinterpret_cast(static_cast(deadKeyFlag))); } - return translation; + + *character = translation; + *isDeadKey = deadKeyFlag; + return; } MsgRouting AwtComponent::WmKeyDown(UINT wkey, UINT repCnt, @@ -3537,8 +3560,10 @@ UINT modifiers = GetJavaModifiers(); jint keyLocation = GetKeyLocation(wkey, flags); - UINT jkey = WindowsKeyToJavaKey(wkey, modifiers); - UINT character = WindowsKeyToJavaChar(wkey, modifiers, SAVE); + BOOL isDeadKey = FALSE; + UINT character; + WindowsKeyToJavaChar(wkey, modifiers, SAVE, &character, &isDeadKey); + UINT jkey = WindowsKeyToJavaKey(wkey, modifiers, character, isDeadKey); UpdateDynPrimaryKeymap(wkey, jkey, keyLocation, modifiers); @@ -3579,8 +3604,10 @@ UINT modifiers = GetJavaModifiers(); jint keyLocation = GetKeyLocation(wkey, flags); - UINT jkey = WindowsKeyToJavaKey(wkey, modifiers); - UINT character = WindowsKeyToJavaChar(wkey, modifiers, LOAD); + BOOL isDeadKey = FALSE; + UINT character; + WindowsKeyToJavaChar(wkey, modifiers, LOAD, &character, &isDeadKey); + UINT jkey = WindowsKeyToJavaKey(wkey, modifiers, character, isDeadKey); UpdateDynPrimaryKeymap(wkey, jkey, keyLocation, modifiers); SendKeyEventToFocusOwner(java_awt_event_KeyEvent_KEY_RELEASED, @@ -5628,7 +5655,10 @@ } } - modifiedChar = p->WindowsKeyToJavaChar(winKey, modifiers, AwtComponent::NONE); + BOOL isDeadKey = FALSE; + UINT character; + p->WindowsKeyToJavaChar(winKey, modifiers, AwtComponent::NONE, &character, &isDeadKey); + modifiedChar = character; bCharChanged = (keyChar != modifiedChar); } break; @@ -7166,4 +7196,4 @@ removedDCs = removedDCs->next; delete tmpDCList; } -} +} \ No newline at end of file