From 1b0c45f683cef20aacc8f40273aa89200e9924e4 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Fri, 23 Aug 2019 08:47:30 +0200 Subject: Deliver stationary touchpoints that have changed pressure As a rule, we don't deliver touch events containing only stationary touchpoints. To fix QTBUG-52510 we added an exception in 1bd0ab7050304d9e8989cde77e486947c56b9696 : if the velocity changed, deliver it anyway. Now we need to do the same if the pressure changed. Also, on the customer's hardware, pressure is indicated via ABS_MT_PRESSURE. Change-Id: If7f7088df055d686cdd86967b999e38024f8170f Fixes: QTBUG-77142 Reviewed-by: Laszlo Agocs --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/platformsupport/input') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index f3cc160b3e..b5bd2dcff4 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -532,7 +532,7 @@ 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) { 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; -- cgit v1.2.3 From 15e1c159868774b0b3c532a09281d45798b0f5d8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 16 Sep 2019 17:56:31 +0200 Subject: evdevtouch: Add fallback definition of ABS_MT_PRESSURE; fix alignment Fixes: QTBUG-78298 Change-Id: Ib6acb1fdca551a84aba5dec2f28cf784a212692c Reviewed-by: Laszlo Agocs --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/platformsupport/input') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index b5bd2dcff4..f86f80785e 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: ** Contact: https://www.qt.io/licensing/ ** @@ -74,7 +74,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 */ @@ -88,6 +88,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 -- cgit v1.2.3 From 72d62144ab2bf67266aa0474515b54999b459d32 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Mon, 30 Sep 2019 16:36:30 +0200 Subject: tslib plugin: remove debug print on old tslib versions This introduces a dependency on ts_get_eventpath(), which is only available in tslib 1.15 and newer. This raises the required version to an unneeded level, so just drop the debug message if the API is not available. Change-Id: I4a1cd7abec8d139e70555506d9d21edacf0f4d71 Fixes: QTBUG-78867 Reviewed-by: Shawn Rutledge Reviewed-by: Fabian Vogt --- src/platformsupport/input/tslib/qtslib.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/platformsupport/input') 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); } -- cgit v1.2.3 From ee9bc61cd906505271bad887664c15b9397906ab Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 3 Oct 2019 08:37:28 +0200 Subject: evdevtouch: Report stationary touchpoints that include pressure changes Task-number: QTBUG-77142 Change-Id: I35446092679573df51891302155c896a3bb6fc1c Reviewed-by: Laszlo Agocs --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/platformsupport/input') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index bf044229ff..2802c9b647 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -577,6 +577,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++; @@ -607,6 +608,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) continue; } + if (contact.pressure) + hasPressure = true; + addTouchPoint(contact, &combinedStates); } @@ -651,7 +655,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(); } -- cgit v1.2.3 From 18aa8390ce83b4aa9cabe5609b8f830f86e475e5 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 3 Oct 2019 08:58:06 +0200 Subject: Add qt.qpa.input.events logging to evdevtouch The xcb platform plugin uses this category for detailed input event logging, so we might as well be consistent in evdevtouch. When hardware supports pressure sensing, it's likely to need extra debugging. Task-number: QTBUG-77142 Change-Id: I7682bb5d49e669054523f9cf556715e511bcd572 Reviewed-by: Laszlo Agocs --- src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/platformsupport/input') diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp index 2802c9b647..c51db59e1f 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp @@ -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. @@ -539,6 +540,9 @@ void QEvdevTouchScreenData::processInputEvent(input_event *data) if (m_typeB) m_contacts[m_currentSlot].maj = m_currentData.maj; } 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; @@ -781,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. -- cgit v1.2.3 From 6abbecf9422af043d51cbb8b3d8c2c188ee40fd3 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Thu, 10 Oct 2019 12:45:25 +0200 Subject: evdevtouch: Fix touch device count not being updated When this was refactored in 3bc10fb9bb9 to use unique pointers, a move was added before the connection, so it would essentially always try to connect a nullptr. Change-Id: Iab7fce88bc73afd78e6b63ffaef7358f3f4ce7e3 Reviewed-by: Rainer Keller --- src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/platformsupport/input') 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(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)); } -- cgit v1.2.3