From a2fb94037bc15ae904d455762b069f4e9434285f Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 17 Jan 2012 11:29:27 +0100 Subject: Fix CJK punctuation input through input methods in OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In this case these string are not input through a composing process (no marked text is set) but they should not be handled by Qt key event handler. Change-Id: I9ea96c29db69d51abc6821e72a3228158012bebc Task-number: QTBUG-23216 Reviewed-by: Morten Johan Sørvig --- src/gui/kernel/qcocoaview_mac.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 2355cda..84cb03a 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1014,7 +1014,13 @@ static int qCocoaViewCount = 0; // When entering characters through Character Viewer or Keyboard Viewer, the text is passed // through this insertText method. Since we dont receive a keyDown Event in such cases, the // composing flag will be false. - if (([aString length] && composing) || !fromKeyDownEvent) { + // + // Characters can be sent through input method directly without composing process as well, + // for instance a Chinese input method will send "," (U+FF0C) to insertText: when "," key + // is pressed. In that case we want to set commit string directly instead of going through + // key events handling again. Hence we only leave the string with Unicode value less than + // 256 to the key events handling process. + if (([aString length] && (composing || commitText.at(0).unicode() > 0xff)) || !fromKeyDownEvent) { // Send the commit string to the widget. composing = false; sendKeyEvents = false; -- cgit v0.12