--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Thu Oct 29 15:17:57 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Fri Oct 30 13:23:35 2015 +0300
@@ -42,6 +42,7 @@
-(void) deliverResize: (NSRect) rect;
-(void) resetTrackingArea;
-(void) deliverJavaKeyEventHelper: (NSEvent*) event;
+-(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint;
@end
// Uncomment this line to see fprintfs of each InputMethod API being called on this View
@@ -509,6 +510,14 @@
}
}
+-(BOOL) isCodePointInUnicodeBlockNeedingIMEvent: (unichar) codePoint {
+ if ((codePoint >= 0x3000) && (codePoint <= 0x303F)) {
+ // Code point is in 'CJK Symbols and Punctuation' Unicode block.
+ return YES;
+ }
+ return NO;
+}
+
// NSAccessibility support
- (jobject)awtComponent:(JNIEnv*)env
{
@@ -889,8 +898,14 @@
// (i.e., when the user uses the Character palette or Inkwell), or when the string to insert is a complex
// Unicode value.
NSUInteger utf16Length = [aString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
+ NSUInteger utf8Length = [aString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ BOOL aStringIsComplex = NO;
+ if ((utf16Length > 2) ||
+ ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:[aString characterAtIndex:0]])) {
+ aStringIsComplex = YES;
+ }
- if ([self hasMarkedText] || !fProcessingKeystroke || (utf16Length > 2)) {
+ if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
JNIEnv *env = [ThreadUtilities getJNIEnv];
static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");