summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp22
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp2
-rw-r--r--src/platformsupport/input/tslib/qtslib.cpp2
3 files changed, 21 insertions, 5 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 737d85d5c3..c51db59e1f 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
** Contact: https://www.qt.io/licensing/
**
@@ -69,6 +69,7 @@ extern "C" {
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(qLcEvdevTouch, "qt.qpa.input")
+Q_LOGGING_CATEGORY(qLcEvents, "qt.qpa.input.events")
/* android (and perhaps some other linux-derived stuff) don't define everything
* in linux/input.h, so we'll need to do that ourselves.
@@ -77,7 +78,7 @@ Q_LOGGING_CATEGORY(qLcEvdevTouch, "qt.qpa.input")
#define ABS_MT_TOUCH_MAJOR 0x30 /* Major axis of touching ellipse */
#endif
#ifndef ABS_MT_POSITION_X
-#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
+#define ABS_MT_POSITION_X 0x35 /* Center X ellipse position */
#endif
#ifndef ABS_MT_POSITION_Y
#define ABS_MT_POSITION_Y 0x36 /* Center Y ellipse position */
@@ -91,6 +92,9 @@ Q_LOGGING_CATEGORY(qLcEvdevTouch, "qt.qpa.input")
#ifndef ABS_MT_TRACKING_ID
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#endif
+#ifndef ABS_MT_PRESSURE
+#define ABS_MT_PRESSURE 0x3a
+#endif
#ifndef SYN_MT_REPORT
#define SYN_MT_REPORT 2
#endif
@@ -535,7 +539,10 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_currentData.state = Qt::TouchPointReleased;
if (m_typeB)
m_contacts[m_currentSlot].maj = m_currentData.maj;
- } else if (data->code == ABS_PRESSURE) {
+ } else if (data->code == ABS_PRESSURE || data->code == ABS_MT_PRESSURE) {
+ if (Q_UNLIKELY(qLcEvents().isDebugEnabled()))
+ qCDebug(qLcEvents, "EV_ABS code 0x%x: pressure %d; bounding to [%d,%d]",
+ data->code, data->value, hw_pressure_min, hw_pressure_max);
m_currentData.pressure = qBound(hw_pressure_min, data->value, hw_pressure_max);
if (m_typeB || m_singleTouch)
m_contacts[m_currentSlot].pressure = m_currentData.pressure;
@@ -574,6 +581,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_lastTouchPoints = m_touchPoints;
m_touchPoints.clear();
Qt::TouchPointStates combinedStates;
+ bool hasPressure = false;
for (auto i = m_contacts.begin(), end = m_contacts.end(); i != end; /*erasing*/) {
auto it = i++;
@@ -604,6 +612,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
continue;
}
+ if (contact.pressure)
+ hasPressure = true;
+
addTouchPoint(contact, &combinedStates);
}
@@ -648,7 +659,7 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data)
m_contacts.clear();
- if (!m_touchPoints.isEmpty() && combinedStates != Qt::TouchPointStationary)
+ if (!m_touchPoints.isEmpty() && (hasPressure || combinedStates != Qt::TouchPointStationary))
reportPoints();
}
@@ -774,6 +785,9 @@ void QEvdevTouchScreenData::reportPoints()
tp.pressure = tp.state == Qt::TouchPointReleased ? 0 : 1;
else
tp.pressure = (tp.pressure - hw_pressure_min) / qreal(hw_pressure_max - hw_pressure_min);
+
+ if (Q_UNLIKELY(qLcEvents().isDebugEnabled()))
+ qCDebug(qLcEvents) << "reporting" << tp;
}
// Let qguiapp pick the target window.
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index b280f27fac..bf2df93d11 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -98,8 +98,8 @@ void QEvdevTouchManager::addDevice(const QString &deviceNode)
qCDebug(qLcEvdevTouch, "evdevtouch: Adding device at %ls", qUtf16Printable(deviceNode));
auto handler = qt_make_unique<QEvdevTouchScreenHandlerThread>(deviceNode, m_spec);
if (handler) {
- m_activeDevices.add(deviceNode, std::move(handler));
connect(handler.get(), &QEvdevTouchScreenHandlerThread::touchDeviceRegistered, this, &QEvdevTouchManager::updateInputDeviceCount);
+ m_activeDevices.add(deviceNode, std::move(handler));
} else {
qWarning("evdevtouch: Failed to open touch device %ls", qUtf16Printable(deviceNode));
}
diff --git a/src/platformsupport/input/tslib/qtslib.cpp b/src/platformsupport/input/tslib/qtslib.cpp
index df57147af6..e105f5ea98 100644
--- a/src/platformsupport/input/tslib/qtslib.cpp
+++ b/src/platformsupport/input/tslib/qtslib.cpp
@@ -68,7 +68,9 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key,
return;
}
+#ifdef TSLIB_VERSION_EVENTPATH /* also introduced in 1.15 */
qCDebug(qLcTsLib) << "tslib device is" << ts_get_eventpath(m_dev);
+#endif
m_notify = new QSocketNotifier(ts_fd(m_dev), QSocketNotifier::Read, this);
connect(m_notify, &QSocketNotifier::activated, this, &QTsLibMouseHandler::readMouseData);
}