src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m
changeset 59182 d0bfaae2ff33
parent 58320 3020baa4efa4
equal deleted inserted replaced
59181:a4ecc45541da 59182:d0bfaae2ff33
   949 
   949 
   950     NSMutableString * useString = [self parseString:aString];
   950     NSMutableString * useString = [self parseString:aString];
   951     NSUInteger utf16Length = [useString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
   951     NSUInteger utf16Length = [useString lengthOfBytesUsingEncoding:NSUTF16StringEncoding];
   952     NSUInteger utf8Length = [useString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
   952     NSUInteger utf8Length = [useString lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
   953     BOOL aStringIsComplex = NO;
   953     BOOL aStringIsComplex = NO;
       
   954 
       
   955     unichar codePoint = [useString characterAtIndex:0];
       
   956 
       
   957 #ifdef IM_DEBUG
       
   958     NSLog(@"insertText kbdlayout %@ ",(NSString *)kbdLayout);
       
   959 #endif // IM_DEBUG
       
   960 
   954     if ((utf16Length > 2) ||
   961     if ((utf16Length > 2) ||
   955         ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:[useString characterAtIndex:0]])) {
   962         ((utf8Length > 1) && [self isCodePointInUnicodeBlockNeedingIMEvent:codePoint]) ||
       
   963         ((codePoint == 0x5c) && ([(NSString *)kbdLayout containsString:@"Kotoeri"]))) {
   956         aStringIsComplex = YES;
   964         aStringIsComplex = YES;
   957     }
   965     }
   958 
   966 
   959     if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
   967     if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
   960         JNIEnv *env = [ThreadUtilities getJNIEnv];
   968         JNIEnv *env = [ThreadUtilities getJNIEnv];
   986 
   994 
   987     // Abandon input to reset IM and unblock input after entering accented
   995     // Abandon input to reset IM and unblock input after entering accented
   988     // symbols
   996     // symbols
   989 
   997 
   990     [self abandonInput];
   998     [self abandonInput];
       
   999 }
       
  1000 
       
  1001 - (void)keyboardInputSourceChanged:(NSNotification *)notification
       
  1002 {
       
  1003 #ifdef IM_DEBUG
       
  1004     NSLog(@"keyboardInputSourceChangeNotification received");
       
  1005 #endif
       
  1006     NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
       
  1007     kbdLayout = curContxt.selectedKeyboardInputSource;
   991 }
  1008 }
   992 
  1009 
   993 - (void) doCommandBySelector:(SEL)aSelector
  1010 - (void) doCommandBySelector:(SEL)aSelector
   994 {
  1011 {
   995 #ifdef IM_DEBUG
  1012 #ifdef IM_DEBUG
  1313     // Save a global ref to the new input method.
  1330     // Save a global ref to the new input method.
  1314     if (inputMethod != NULL)
  1331     if (inputMethod != NULL)
  1315         fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
  1332         fInputMethodLOCKABLE = JNFNewGlobalRef(env, inputMethod);
  1316     else
  1333     else
  1317         fInputMethodLOCKABLE = NULL;
  1334         fInputMethodLOCKABLE = NULL;
       
  1335 
       
  1336     NSTextInputContext *curContxt = [NSTextInputContext currentInputContext];
       
  1337     kbdLayout = curContxt.selectedKeyboardInputSource;
       
  1338     [[NSNotificationCenter defaultCenter] addObserver:self
       
  1339                                            selector:@selector(keyboardInputSourceChanged:)
       
  1340                                                name:NSTextInputContextKeyboardSelectionDidChangeNotification
       
  1341                                              object:nil];
  1318 }
  1342 }
  1319 
  1343 
  1320 - (void)abandonInput
  1344 - (void)abandonInput
  1321 {
  1345 {
  1322 #ifdef IM_DEBUG
  1346 #ifdef IM_DEBUG