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>bb10
parent
5f25dc6be7
commit
638d9d3831
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -266,6 +266,12 @@ namespace QtAndroid
|
|||
m_surfaceMutex.unlock();
|
||||
}
|
||||
|
||||
QAndroidPlatformIntegration *androidPlatformIntegration()
|
||||
{
|
||||
QMutexLocker locker(&m_surfaceMutex);
|
||||
return m_androidPlatformIntegration;
|
||||
}
|
||||
|
||||
void setFullScreen(QWidget *widget)
|
||||
{
|
||||
AttachedJNIEnv env;
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class QWindow;
|
|||
|
||||
namespace QtAndroid
|
||||
{
|
||||
QAndroidPlatformIntegration *androidPlatformIntegration();
|
||||
void setAndroidPlatformIntegration(QAndroidPlatformIntegration *androidPlatformIntegration);
|
||||
void setQtThread(QThread *thread);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,8 +84,9 @@ void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteA
|
|||
}
|
||||
|
||||
QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶mList)
|
||||
: m_touchDevice(0)
|
||||
#ifdef ANDROID_PLUGIN_OPENGL
|
||||
: m_primaryWindow(0)
|
||||
, m_primaryWindow(0)
|
||||
#endif
|
||||
{
|
||||
Q_UNUSED(paramList);
|
||||
|
|
@ -179,6 +180,7 @@ QAndroidPlatformIntegration::~QAndroidPlatformIntegration()
|
|||
{
|
||||
delete m_androidPlatformNativeInterface;
|
||||
delete m_androidFDB;
|
||||
delete m_touchDevice;
|
||||
QtAndroid::setAndroidPlatformIntegration(NULL);
|
||||
}
|
||||
QPlatformFontDatabase *QAndroidPlatformIntegration::fontDatabase() const
|
||||
|
|
|
|||
|
|
@ -126,9 +126,15 @@ public:
|
|||
return QSize(m_defaultGeometryWidth, m_defaultGeometryHeight);
|
||||
}
|
||||
|
||||
QTouchDevice *touchDevice() const { return m_touchDevice; }
|
||||
void setTouchDevice(QTouchDevice *touchDevice) { m_touchDevice = touchDevice; }
|
||||
|
||||
private:
|
||||
|
||||
friend class QEglFSAndroidHooks;
|
||||
|
||||
QTouchDevice *m_touchDevice;
|
||||
|
||||
#ifndef ANDROID_PLUGIN_OPENGL
|
||||
QAbstractEventDispatcher *m_eventDispatcher;
|
||||
QAndroidPlatformScreen *m_primaryScreen;
|
||||
|
|
|
|||
Loading…
Reference in New Issue