summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@digia.com>2014-01-14 14:32:39 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 02:35:11 +0100
commit839997adfa6ecf6209dbde94ec831d1c3a203de4 (patch)
tree46dba489e96cf28a553a69793ed0fd752b7783a0
parent96b7ac569c571a38826d5bfb2681889dbf81759d (diff)
downloadqtbase-839997adfa6ecf6209dbde94ec831d1c3a203de4.tar.gz
qtbase-839997adfa6ecf6209dbde94ec831d1c3a203de4.tar.bz2
qtbase-839997adfa6ecf6209dbde94ec831d1c3a203de4.zip
Cocoa: fix single punctuation input via CJK input method
2d05d3bd2815c220474b3c07bf3f2ef7417d3070 was not correct. On OS X, when user uses CJK input method, only types single punctuation, it was converted to CJK ones, and not showed in composing text. Task-number: QTBUG-35700 Change-Id: I2d1063d2f837d075929dc5ebb5722fdefc6ee0f6 Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/plugins/platforms/cocoa/qnsview.h1
-rw-r--r--src/plugins/platforms/cocoa/qnsview.mm8
2 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h
index 403f8dc78a..7e146c5f58 100644
--- a/src/plugins/platforms/cocoa/qnsview.h
+++ b/src/plugins/platforms/cocoa/qnsview.h
@@ -71,6 +71,7 @@ QT_END_NAMESPACE
bool m_subscribesForGlobalFrameNotifications;
QCocoaGLContext *m_glContext;
bool m_shouldSetGLContextinDrawRect;
+ NSString *m_inputSource;
}
- (id)init;
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm
index e75b835d58..ed9aad1654 100644
--- a/src/plugins/platforms/cocoa/qnsview.mm
+++ b/src/plugins/platforms/cocoa/qnsview.mm
@@ -90,6 +90,7 @@ static QTouchDevice *touchDevice = 0;
m_shouldSetGLContextinDrawRect = false;
currentCustomDragTypes = 0;
m_sendUpAsRightButton = false;
+ m_inputSource = 0;
if (!touchDevice) {
touchDevice = new QTouchDevice;
@@ -108,6 +109,7 @@ static QTouchDevice *touchDevice = 0;
m_maskData = 0;
m_window = 0;
m_subscribesForGlobalFrameNotifications = false;
+ [m_inputSource release];
[[NSNotificationCenter defaultCenter] removeObserver:self];
delete currentCustomDragTypes;
@@ -1222,6 +1224,10 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers];
NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers];
NSString *characters = [nsevent characters];
+ if (m_inputSource != characters) {
+ [m_inputSource release];
+ m_inputSource = [characters retain];
+ }
// There is no way to get the scan code from carbon/cocoa. But we cannot
// use the value 0, since it indicates that the event originates from somewhere
@@ -1352,7 +1358,7 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
{
Q_UNUSED(replacementRange)
- if (m_sendKeyEvent && m_composingText.isEmpty()) {
+ if (m_sendKeyEvent && m_composingText.isEmpty() && [aString isEqualToString:m_inputSource]) {
// don't send input method events for simple text input (let handleKeyEvent send key events instead)
return;
}