963
964 if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
965 JNIEnv *env = [ThreadUtilities getJNIEnv];
966
967 static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
968 // We need to select the previous glyph so that it is overwritten.
969 if (fPAHNeedsToSelect) {
970 JNFCallVoidMethod(env, fInputMethodLOCKABLE, jm_selectPreviousGlyph);
971 fPAHNeedsToSelect = NO;
972 }
973
974 static JNF_MEMBER_CACHE(jm_insertText, jc_CInputMethod, "insertText", "(Ljava/lang/String;)V");
975 jstring insertedText = JNFNSToJavaString(env, aString);
976 JNFCallVoidMethod(env, fInputMethodLOCKABLE, jm_insertText, insertedText); // AWT_THREADING Safe (AWTRunLoopMode)
977 (*env)->DeleteLocalRef(env, insertedText);
978
979 // The input method event will create psuedo-key events for each character in the committed string.
980 // We also don't want to send the character that triggered the insertText, usually a return. [3337563]
981 fKeyEventsNeeded = NO;
982 }
983
984 fPAHNeedsToSelect = NO;
985
986 }
987
988 - (void) doCommandBySelector:(SEL)aSelector
989 {
990 #ifdef IM_DEBUG
991 fprintf(stderr, "AWTView InputMethod Selector Called : [doCommandBySelector]\n");
992 NSLog(@"%@", NSStringFromSelector(aSelector));
993 #endif // IM_DEBUG
994 if (@selector(insertNewline:) == aSelector || @selector(insertTab:) == aSelector || @selector(deleteBackward:) == aSelector)
995 {
996 fKeyEventsNeeded = YES;
997 }
998 }
999
1000 // setMarkedText: cannot take a nil first argument. aString can be NSString or NSAttributedString
1001 - (void) setMarkedText:(id)aString selectedRange:(NSRange)selectionRange replacementRange:(NSRange)replacementRange
1002 {
|
963
964 if ([self hasMarkedText] || !fProcessingKeystroke || aStringIsComplex) {
965 JNIEnv *env = [ThreadUtilities getJNIEnv];
966
967 static JNF_MEMBER_CACHE(jm_selectPreviousGlyph, jc_CInputMethod, "selectPreviousGlyph", "()V");
968 // We need to select the previous glyph so that it is overwritten.
969 if (fPAHNeedsToSelect) {
970 JNFCallVoidMethod(env, fInputMethodLOCKABLE, jm_selectPreviousGlyph);
971 fPAHNeedsToSelect = NO;
972 }
973
974 static JNF_MEMBER_CACHE(jm_insertText, jc_CInputMethod, "insertText", "(Ljava/lang/String;)V");
975 jstring insertedText = JNFNSToJavaString(env, aString);
976 JNFCallVoidMethod(env, fInputMethodLOCKABLE, jm_insertText, insertedText); // AWT_THREADING Safe (AWTRunLoopMode)
977 (*env)->DeleteLocalRef(env, insertedText);
978
979 // The input method event will create psuedo-key events for each character in the committed string.
980 // We also don't want to send the character that triggered the insertText, usually a return. [3337563]
981 fKeyEventsNeeded = NO;
982 }
983 else {
984 // Need to set back the fKeyEventsNeeded flag so that the string following the
985 // marked text is not ignored by keyDown
986 if (utf16Length > 0 || utf8Length > 0) {
987 fKeyEventsNeeded = YES;
988 }
989 }
990
991 fPAHNeedsToSelect = NO;
992
993 }
994
995 - (void) doCommandBySelector:(SEL)aSelector
996 {
997 #ifdef IM_DEBUG
998 fprintf(stderr, "AWTView InputMethod Selector Called : [doCommandBySelector]\n");
999 NSLog(@"%@", NSStringFromSelector(aSelector));
1000 #endif // IM_DEBUG
1001 if (@selector(insertNewline:) == aSelector || @selector(insertTab:) == aSelector || @selector(deleteBackward:) == aSelector)
1002 {
1003 fKeyEventsNeeded = YES;
1004 }
1005 }
1006
1007 // setMarkedText: cannot take a nil first argument. aString can be NSString or NSAttributedString
1008 - (void) setMarkedText:(id)aString selectedRange:(NSRange)selectionRange replacementRange:(NSRange)replacementRange
1009 {
|