summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/input/evdevtouch
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/input/evdevtouch')
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp41
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h12
-rw-r--r--src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp2
3 files changed, 25 insertions, 30 deletions
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
index 5f71e7e6a2..5a964c0a17 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler.cpp
@@ -44,9 +44,9 @@
#include <QHash>
#include <QSocketNotifier>
#include <QGuiApplication>
-#include <QTouchDevice>
#include <QLoggingCategory>
#include <QtCore/private/qcore_unix_p.h>
+#include <QtGui/qpointingdevice.h>
#include <QtGui/private/qhighdpiscaling_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -358,7 +358,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &device, const
qUtf16Printable(d->deviceNode), qUtf16Printable(d->m_screenName));
}
- registerTouchDevice();
+ registerPointingDevice();
}
QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
@@ -375,7 +375,7 @@ QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
delete d;
- unregisterTouchDevice();
+ unregisterPointingDevice();
}
bool QEvdevTouchScreenHandler::isFiltered() const
@@ -383,7 +383,7 @@ bool QEvdevTouchScreenHandler::isFiltered() const
return d && d->m_filtered;
}
-QTouchDevice *QEvdevTouchScreenHandler::touchDevice() const
+QPointingDevice *QEvdevTouchScreenHandler::touchDevice() const
{
return m_device;
}
@@ -444,40 +444,33 @@ err:
QT_CLOSE(m_fd);
m_fd = -1;
- unregisterTouchDevice();
+ unregisterPointingDevice();
}
return;
}
}
}
-void QEvdevTouchScreenHandler::registerTouchDevice()
+void QEvdevTouchScreenHandler::registerPointingDevice()
{
if (m_device)
return;
- m_device = new QTouchDevice;
- m_device->setName(d->hw_name);
- m_device->setType(QTouchDevice::TouchScreen);
- m_device->setCapabilities(QTouchDevice::Position | QTouchDevice::Area);
+ static int id = 1;
+ QPointingDevice::Capabilities caps = QPointingDevice::Capability::Position | QPointingDevice::Capability::Area;
if (d->hw_pressure_max > d->hw_pressure_min)
- m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure);
+ caps.setFlag(QPointingDevice::Capability::Pressure);
- QWindowSystemInterface::registerTouchDevice(m_device);
+ // TODO get evdev ID instead of an incremeting number; set USB ID too
+ m_device = new QPointingDevice(d->hw_name, id++,
+ QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger,
+ caps, 16, 0);
+ QWindowSystemInterface::registerInputDevice(m_device);
}
-void QEvdevTouchScreenHandler::unregisterTouchDevice()
+void QEvdevTouchScreenHandler::unregisterPointingDevice()
{
- if (!m_device)
- return;
-
- // At app exit the cleanup may have already been done, avoid
- // double delete by checking the list first.
- if (QWindowSystemInterface::isTouchDeviceRegistered(m_device)) {
- QWindowSystemInterface::unregisterTouchDevice(m_device);
- delete m_device;
- }
-
+ delete m_device;
m_device = nullptr;
}
@@ -833,7 +826,7 @@ void QEvdevTouchScreenHandlerThread::run()
m_handler = nullptr;
}
-bool QEvdevTouchScreenHandlerThread::isTouchDeviceRegistered() const
+bool QEvdevTouchScreenHandlerThread::isPointingDeviceRegistered() const
{
return m_touchDeviceRegistered;
}
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
index 56308d0352..3ad2602811 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchhandler_p.h
@@ -52,6 +52,7 @@
// We mean it.
//
+//#include <QtGui/qpointingdevice.h>
#include <QtGui/private/qtguiglobal_p.h>
#include <QObject>
#include <QString>
@@ -69,6 +70,7 @@ QT_BEGIN_NAMESPACE
class QSocketNotifier;
class QEvdevTouchScreenData;
+class QPointingDevice;
class QEvdevTouchScreenHandler : public QObject
{
@@ -78,7 +80,7 @@ public:
explicit QEvdevTouchScreenHandler(const QString &device, const QString &spec = QString(), QObject *parent = nullptr);
~QEvdevTouchScreenHandler();
- QTouchDevice *touchDevice() const;
+ QPointingDevice *touchDevice() const;
bool isFiltered() const;
@@ -91,13 +93,13 @@ private:
friend class QEvdevTouchScreenData;
friend class QEvdevTouchScreenHandlerThread;
- void registerTouchDevice();
- void unregisterTouchDevice();
+ void registerPointingDevice();
+ void unregisterPointingDevice();
QSocketNotifier *m_notify;
int m_fd;
QEvdevTouchScreenData *d;
- QTouchDevice *m_device;
+ QPointingDevice *m_device;
#if QT_CONFIG(mtdev)
mtdev *m_mtdev;
#endif
@@ -111,7 +113,7 @@ public:
~QEvdevTouchScreenHandlerThread();
void run() override;
- bool isTouchDeviceRegistered() const;
+ bool isPointingDeviceRegistered() const;
bool eventFilter(QObject *object, QEvent *event) override;
diff --git a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
index bf2df93d11..a1226ac66a 100644
--- a/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
+++ b/src/platformsupport/input/evdevtouch/qevdevtouchmanager.cpp
@@ -117,7 +117,7 @@ void QEvdevTouchManager::updateInputDeviceCount()
{
int registeredTouchDevices = 0;
for (const auto &device : m_activeDevices) {
- if (device.handler->isTouchDeviceRegistered())
+ if (device.handler->isPointingDeviceRegistered())
++registeredTouchDevices;
}