提交 da3983d9 编写于 作者: A alitvinov

8230926: [macosx] Two apostrophes are entered instead of one with "U.S. International - PC" layout

Reviewed-by: serb, dmarkov
上级 16b475e6
......@@ -180,8 +180,11 @@ final class CPlatformResponder {
// It is necessary to use testCharIgnoringModifiers instead of testChar for event
// generation in such case to avoid uppercase letters in text components.
LWCToolkit lwcToolkit = (LWCToolkit)Toolkit.getDefaultToolkit();
if (lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) {
if ((lwcToolkit.getLockingKeyState(KeyEvent.VK_CAPS_LOCK) &&
Locale.SIMPLIFIED_CHINESE.equals(lwcToolkit.getDefaultKeyboardLocale())) ||
(LWCToolkit.isLocaleUSInternationalPC(lwcToolkit.getDefaultKeyboardLocale()) &&
LWCToolkit.isCharModifierKeyInUSInternationalPC(testChar) &&
(testChar != testCharIgnoringModifiers))) {
testChar = testCharIgnoringModifiers;
}
......
......@@ -726,6 +726,23 @@ public final class LWCToolkit extends LWToolkit {
return locale;
}
public static boolean isLocaleUSInternationalPC(Locale locale) {
return (locale != null ?
locale.toString().equals("_US_UserDefined_15000") : false);
}
public static boolean isCharModifierKeyInUSInternationalPC(char ch) {
// 5 characters: APOSTROPHE, QUOTATION MARK, ACCENT GRAVE, SMALL TILDE,
// CIRCUMFLEX ACCENT
final char[] modifierKeys = {'\'', '"', '`', '\u02DC', '\u02C6'};
for (char modKey : modifierKeys) {
if (modKey == ch) {
return true;
}
}
return false;
}
@Override
public InputMethodDescriptor getInputMethodAdapterDescriptor() {
if (sInputMethodDescriptor == null)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册