summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-15 10:54:56 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-06-16 12:13:58 +0000
commitcef33870e4310ad4d86f33a1a3d967ace9f31433 (patch)
tree6198e8e8ee1bb6c1be77ac6fe182bf4d264c0942 /src/plugins/platforms/android
parentfb8b3e1bee867c86bbb848d2c3947e78f9d0e07e (diff)
Workaround for Google Keyboard strangeness
When deleting selected text, Google Keyboard will call deleteSurroundingText() with a negative beforeLength. This does not make any sense, and not all our controls are able to handle the resulting input method events. This patch interprets a negative beforeLength as a positive afterLength. This works with the cases I have seen so far, but since the keyboard is not following the specification, there may be more weirdness later. Task-number: QTBUG-46637 Change-Id: I410832417f6fb21139c338355e8fcfa57b9e544c Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms/android')
-rw-r--r--src/plugins/platforms/android/qandroidinputcontext.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp
index 5c8406ca03..5a007b58c5 100644
--- a/src/plugins/platforms/android/qandroidinputcontext.cpp
+++ b/src/plugins/platforms/android/qandroidinputcontext.cpp
@@ -650,6 +650,11 @@ jboolean QAndroidInputContext::deleteSurroundingText(jint leftLength, jint right
m_composingText.clear();
m_composingTextStart = -1;
+ if (leftLength < 0) {
+ rightLength += -leftLength;
+ leftLength = 0;
+ }
+
QInputMethodEvent event;
event.setCommitString(QString(), -leftLength, leftLength+rightLength);
sendInputMethodEventThreadSafe(&event);