< prev index next >

src/java.desktop/unix/classes/sun/awt/X11InputMethod.java

Print this page




 538             InputMethodEvent event = new InputMethodEvent(source,
 539                 id, when, text, committedCharacterCount, caret, visiblePosition);
 540             SunToolkit.postEvent(SunToolkit.targetToAppContext(source), (AWTEvent)event);
 541         }
 542     }
 543 
 544     private void postInputMethodEvent(int id,
 545                                       AttributedCharacterIterator text,
 546                                       int committedCharacterCount,
 547                                       TextHitInfo caret,
 548                                       TextHitInfo visiblePosition) {
 549         postInputMethodEvent(id, text, committedCharacterCount,
 550                              caret, visiblePosition, EventQueue.getMostRecentEventTime());
 551     }
 552 
 553     /**
 554      * Dispatches committed text from XIM to the awt event queue. This
 555      * method is invoked from the event handler in canvas.c in the
 556      * AWT Toolkit thread context and thus inside the AWT Lock.
 557      * @param   str     committed text
 558      * @param   long    when
 559      */
 560     // NOTE: This method may be called by privileged threads.
 561     //       This functionality is implemented in a package-private method
 562     //       to insure that it cannot be overridden by client subclasses.
 563     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 564     void dispatchCommittedText(String str, long when) {
 565         if (str == null)
 566             return;
 567 
 568         if (composedText == null) {
 569             AttributedString attrstr = new AttributedString(str);
 570             postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
 571                                  attrstr.getIterator(),
 572                                  str.length(),
 573                                  null,
 574                                  null,
 575                                  when);
 576         } else {
 577             // if there is composed text, wait until the preedit
 578             // callback is invoked.




 538             InputMethodEvent event = new InputMethodEvent(source,
 539                 id, when, text, committedCharacterCount, caret, visiblePosition);
 540             SunToolkit.postEvent(SunToolkit.targetToAppContext(source), (AWTEvent)event);
 541         }
 542     }
 543 
 544     private void postInputMethodEvent(int id,
 545                                       AttributedCharacterIterator text,
 546                                       int committedCharacterCount,
 547                                       TextHitInfo caret,
 548                                       TextHitInfo visiblePosition) {
 549         postInputMethodEvent(id, text, committedCharacterCount,
 550                              caret, visiblePosition, EventQueue.getMostRecentEventTime());
 551     }
 552 
 553     /**
 554      * Dispatches committed text from XIM to the awt event queue. This
 555      * method is invoked from the event handler in canvas.c in the
 556      * AWT Toolkit thread context and thus inside the AWT Lock.
 557      * @param   str     committed text
 558      * @param   when    when
 559      */
 560     // NOTE: This method may be called by privileged threads.
 561     //       This functionality is implemented in a package-private method
 562     //       to insure that it cannot be overridden by client subclasses.
 563     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 564     void dispatchCommittedText(String str, long when) {
 565         if (str == null)
 566             return;
 567 
 568         if (composedText == null) {
 569             AttributedString attrstr = new AttributedString(str);
 570             postInputMethodEvent(InputMethodEvent.INPUT_METHOD_TEXT_CHANGED,
 571                                  attrstr.getIterator(),
 572                                  str.length(),
 573                                  null,
 574                                  null,
 575                                  when);
 576         } else {
 577             // if there is composed text, wait until the preedit
 578             // callback is invoked.


< prev index next >