diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2014-03-31 17:45:37 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-31 17:45:37 +0200 |
commit | bd822bedfea5126b12c32523a68c3a1ac7a8931d (patch) | |
tree | 0fafd5ac037e3b62ad45e8808989ec89155618b4 /src/plugins/platforms/android/androidjniinput.cpp | |
parent | 84c10500b1730e8d947732728d190fde612fc840 (diff) | |
parent | 3b5c0bc0780f1749fed7c07bd8b691400a0282b7 (diff) |
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/android/androidjniinput.cpp')
-rw-r--r-- | src/plugins/platforms/android/androidjniinput.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 55d44b7377..9efdcad158 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -67,8 +67,6 @@ namespace QtAndroidInput static QPointer<QWindow> m_mouseGrabber; - static int m_lastCursorPos = -1; - void updateSelection(int selStart, int selEnd, int candidatesStart, int candidatesEnd) { AttachedJNIEnv env; @@ -78,21 +76,6 @@ namespace QtAndroidInput #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL qDebug() << ">>> UPDATESELECTION" << selStart << selEnd << candidatesStart << candidatesEnd; #endif - if (candidatesStart == -1 && candidatesEnd == -1 && selStart == selEnd) { - // Qt only gives us position inside the block, so if we move to the - // same position in another block, the Android keyboard will believe - // we have not changed position, and be terribly confused. - if (selStart == m_lastCursorPos) { -#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL - qDebug() << ">>> FAKEUPDATESELECTION" << selStart+1; -#endif - env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, - selStart+1, selEnd+1, candidatesStart, candidatesEnd); - } - m_lastCursorPos = selStart; - } else { - m_lastCursorPos = -1; - } env.jniEnv->CallStaticVoidMethod(applicationClass(), m_updateSelectionMethodID, selStart, selEnd, candidatesStart, candidatesEnd); } @@ -517,6 +500,12 @@ namespace QtAndroidInput } } + // maps 0 to the empty string, and anything else to a single-character string + static inline QString toString(jint unicode) + { + return unicode ? QString(QChar(unicode)) : QString(); + } + static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier) { Qt::KeyboardModifiers modifiers; @@ -533,7 +522,7 @@ namespace QtAndroidInput QEvent::KeyPress, mapAndroidKey(key), modifiers, - QChar(unicode), + toString(unicode), false); } @@ -553,7 +542,7 @@ namespace QtAndroidInput QEvent::KeyRelease, mapAndroidKey(key), modifiers, - QChar(unicode), + toString(unicode), false); } |