summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/src/androidjniinput.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2013-03-06 11:54:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-12 09:16:42 +0100
commit638d9d3831357f80800a2fae4925f71648907f30 (patch)
tree7eb12b5a1c657cac51a167468cc2c0dc1112add0 /src/plugins/platforms/android/src/androidjniinput.cpp
parent5f25dc6be7e6a8f185d37884611123f7d3af7615 (diff)
Fix multi-touch input on Android
The touch events were collected but then thrown away because of a missing port of he handleTouchEvent() function call. Task-number: QTBUG-29126 Change-Id: I02f7380945be04a36da14a89f2f3ff9429b17cbc Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'src/plugins/platforms/android/src/androidjniinput.cpp')
-rw-r--r--src/plugins/platforms/android/src/androidjniinput.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/platforms/android/src/androidjniinput.cpp b/src/plugins/platforms/android/src/androidjniinput.cpp
index 6a3dd1f349..da6156a330 100644
--- a/src/plugins/platforms/android/src/androidjniinput.cpp
+++ b/src/plugins/platforms/android/src/androidjniinput.cpp
@@ -41,6 +41,7 @@
#include "androidjniinput.h"
#include "androidjnimain.h"
+#include "qandroidplatformintegration.h"
#include <qpa/qwindowsysteminterface.h>
#include <QTouchEvent>
@@ -219,6 +220,9 @@ namespace QtAndroidInput
static void touchEnd(JNIEnv */*env*/, jobject /*thiz*/, jint /*winId*/, jint action)
{
+ if (m_touchPoints.isEmpty())
+ return;
+
QEvent::Type eventType = QEvent::None;
switch (action) {
case 0:
@@ -232,8 +236,21 @@ namespace QtAndroidInput
break;
}
- // FIXME
- // QWindowSystemInterface::handleTouchEvent(0, 0, eventType, QTouchEvent::TouchScreen, m_touchPoints);
+ QAndroidPlatformIntegration *platformIntegration = QtAndroid::androidPlatformIntegration();
+ QTouchDevice *touchDevice = platformIntegration->touchDevice();
+ if (touchDevice == 0) {
+ touchDevice = new QTouchDevice;
+ touchDevice->setType(QTouchDevice::TouchScreen);
+ touchDevice->setCapabilities(QTouchDevice::Position
+ | QTouchDevice::Area
+ | QTouchDevice::Pressure
+ | QTouchDevice::NormalizedPosition);
+ QWindowSystemInterface::registerTouchDevice(touchDevice);
+ platformIntegration->setTouchDevice(touchDevice);
+ }
+
+ QWindow *window = QtAndroid::topLevelWindowAt(m_touchPoints.at(0).area.center().toPoint());
+ QWindowSystemInterface::handleTouchEvent(window, touchDevice, m_touchPoints);
}
static int mapAndroidKey(int key)