Add QEvdev prefix in evdevtouch and update readme
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Fri, 1 Jun 2012 07:17:28 +0000 (10:17 +0300)
committerQt by Nokia <qt-info@nokia.com>
Fri, 1 Jun 2012 13:24:30 +0000 (15:24 +0200)
Now that the code is in platformsupport we need to avoid too generic
names so rename the classes a bit.

Change-Id: I7241aa1a3449be772de369ebd08df01e886dbfa3
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
src/platformsupport/input/evdevtouch/qevdevtouch.cpp
src/platformsupport/input/evdevtouch/qevdevtouch_p.h
src/plugins/generic/evdevtouch/README
src/plugins/generic/evdevtouch/main.cpp

index 1369e2a..0f039a4 100644 (file)
@@ -61,15 +61,15 @@ QT_BEGIN_NAMESPACE
 #define ABS_MT_SLOT 0x2f
 #endif
 
-class QTouchScreenData
+class QEvdevTouchScreenData
 {
 public:
-    QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args);
+    QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args);
 
     void processInputEvent(input_event *data);
     void assignIds();
 
-    QTouchScreenHandler *q;
+    QEvdevTouchScreenHandler *q;
     int m_lastEventType;
     QList<QWindowSystemInterface::TouchPoint> m_touchPoints;
 
@@ -106,7 +106,7 @@ public:
     bool m_typeB;
 };
 
-QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList &args)
+QEvdevTouchScreenData::QEvdevTouchScreenData(QEvdevTouchScreenHandler *q_ptr, const QStringList &args)
     : q(q_ptr),
       m_lastEventType(-1),
       m_currentSlot(0),
@@ -118,7 +118,7 @@ QTouchScreenData::QTouchScreenData(QTouchScreenHandler *q_ptr, const QStringList
     m_forceToActiveWindow = args.contains(QLatin1String("force_window"));
 }
 
-void QTouchScreenData::registerDevice()
+void QEvdevTouchScreenData::registerDevice()
 {
     m_device = new QTouchDevice;
     m_device->setName(hw_name);
@@ -138,7 +138,7 @@ static inline bool testBit(long bit, const long *array)
     return (array[bit / LONG_BITS] >> bit % LONG_BITS) & 1;
 }
 
-QTouchScreenHandler::QTouchScreenHandler(const QString &spec, QObject *parent)
+QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &spec, QObject *parent)
     : QObject(parent), m_notify(0), m_fd(-1), d(0)
 #ifdef USE_MTDEV
       , m_mtdev(0)
@@ -193,7 +193,7 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec, QObject *parent)
     }
 #endif
 
-    d = new QTouchScreenData(this, args);
+    d = new QEvdevTouchScreenData(this, args);
 
     input_absinfo absInfo;
     memset(&absInfo, 0, sizeof(input_absinfo));
@@ -235,7 +235,7 @@ QTouchScreenHandler::QTouchScreenHandler(const QString &spec, QObject *parent)
     d->registerDevice();
 }
 
-QTouchScreenHandler::~QTouchScreenHandler()
+QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler()
 {
 #ifdef USE_MTDEV
     if (m_mtdev) {
@@ -250,7 +250,7 @@ QTouchScreenHandler::~QTouchScreenHandler()
     delete d;
 }
 
-void QTouchScreenHandler::readData()
+void QEvdevTouchScreenHandler::readData()
 {
     ::input_event buffer[32];
     int n = 0;
@@ -289,7 +289,7 @@ void QTouchScreenHandler::readData()
         d->processInputEvent(&buffer[i]);
 }
 
-void QTouchScreenData::processInputEvent(input_event *data)
+void QEvdevTouchScreenData::processInputEvent(input_event *data)
 {
     if (data->type == EV_ABS) {
 
@@ -400,7 +400,7 @@ void QTouchScreenData::processInputEvent(input_event *data)
     m_lastEventType = data->type;
 }
 
-int QTouchScreenData::findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist)
+int QEvdevTouchScreenData::findClosestContact(const QHash<int, Contact> &contacts, int x, int y, int *dist)
 {
     int minDist = -1, id = -1;
     for (QHash<int, Contact>::const_iterator it = contacts.constBegin(), ite = contacts.constEnd();
@@ -419,7 +419,7 @@ int QTouchScreenData::findClosestContact(const QHash<int, Contact> &contacts, in
     return id;
 }
 
-void QTouchScreenData::assignIds()
+void QEvdevTouchScreenData::assignIds()
 {
     QHash<int, Contact> candidates = m_lastContacts, pending = m_contacts, newContacts;
     int maxId = -1;
@@ -453,7 +453,7 @@ void QTouchScreenData::assignIds()
     m_contacts = newContacts;
 }
 
-void QTouchScreenData::reportPoints()
+void QEvdevTouchScreenData::reportPoints()
 {
     QRect winRect;
     if (m_forceToActiveWindow) {
@@ -493,21 +493,21 @@ void QTouchScreenData::reportPoints()
 }
 
 
-QTouchScreenHandlerThread::QTouchScreenHandlerThread(const QString &spec)
-    : m_spec(spec), m_handler(0)
+QEvdevTouchScreenHandlerThread::QEvdevTouchScreenHandlerThread(const QString &spec, QObject *parent)
+    : QThread(parent), m_spec(spec), m_handler(0)
 {
     start();
 }
 
-QTouchScreenHandlerThread::~QTouchScreenHandlerThread()
+QEvdevTouchScreenHandlerThread::~QEvdevTouchScreenHandlerThread()
 {
     quit();
     wait();
 }
 
-void QTouchScreenHandlerThread::run()
+void QEvdevTouchScreenHandlerThread::run()
 {
-    m_handler = new QTouchScreenHandler(m_spec);
+    m_handler = new QEvdevTouchScreenHandler(m_spec);
     exec();
     delete m_handler;
     m_handler = 0;
index 63b02f2..f9f8412 100644 (file)
@@ -53,18 +53,18 @@ QT_BEGIN_HEADER
 QT_BEGIN_NAMESPACE
 
 class QSocketNotifier;
-class QTouchScreenData;
+class QEvdevTouchScreenData;
 #ifdef USE_MTDEV
 struct mtdev;
 #endif
 
-class QTouchScreenHandler : public QObject
+class QEvdevTouchScreenHandler : public QObject
 {
     Q_OBJECT
 
 public:
-    QTouchScreenHandler(const QString &spec = QString(), QObject *parent = 0);
-    ~QTouchScreenHandler();
+    QEvdevTouchScreenHandler(const QString &spec = QString(), QObject *parent = 0);
+    ~QEvdevTouchScreenHandler();
 
 private slots:
     void readData();
@@ -72,23 +72,23 @@ private slots:
 private:
     QSocketNotifier *m_notify;
     int m_fd;
-    QTouchScreenData *d;
+    QEvdevTouchScreenData *d;
 #ifdef USE_MTDEV
     mtdev *m_mtdev;
 #endif
 };
 
-class QTouchScreenHandlerThread : public QThread
+class QEvdevTouchScreenHandlerThread : public QThread
 {
 public:
-    QTouchScreenHandlerThread(const QString &spec);
-    ~QTouchScreenHandlerThread();
+    QEvdevTouchScreenHandlerThread(const QString &spec, QObject *parent = 0);
+    ~QEvdevTouchScreenHandlerThread();
     void run();
-    QTouchScreenHandler *handler() { return m_handler; }
+    QEvdevTouchScreenHandler *handler() { return m_handler; }
 
 private:
     QString m_spec;
-    QTouchScreenHandler *m_handler;
+    QEvdevTouchScreenHandler *m_handler;
 };
 
 QT_END_NAMESPACE
index 119f2a2..fca2770 100644 (file)
@@ -1,12 +1,17 @@
-Generic plug-in for evdev touch (ABS_MT) events.
+Generic plug-in for evdev multiple touch (ABS_MT) events.
 Supports protocol type A & B.
 Type B is supported both directly and via libmtdev.
+Single-touch devices reporting ABS_X and Y only are not supported
+by this plugin. Use tslib or evdevmouse instead.
 
 The protocol type will be detected automatically.
 To enable libmtdev support uncomment the USE_MTDEV define in
 evdevtouch.pro.
 
-Tested with the following kernel drivers: bcm5974, hid_magicmouse.
+Tested with the following kernel drivers:
+  bcm5974 (type A)
+  hid_magicmouse (type A with ABS_MT_TRACKING_ID) (type B over libmtdev)
+  wacom (type B)
 
 To use this "driver", pass -plugin EvdevTouch on the command line.
 
@@ -24,9 +29,9 @@ Only touch events are generated, mouse events are not. Be aware however
 that ignored touch events will generate a mouse event from the first
 touch point by default. See AA_SynthesizeMouseForUnhandledTouchEvents.
 
-If no evdev events are read, disable the synaptics driver from X or
-temporarily disable the device by running
-xinput set-prop <device> <device enabled property> 0.
+If no evdev events are read, X may be grabbing the device.
+Disable the synaptics driver from X or temporarily disable the device
+by running xinput set-prop <device> <device enabled property> 0.
 Use xinput list and xinput list-props to figure out the values.
 
 When not running on a windowing system (eglfs, kms, etc.) and having a
@@ -38,5 +43,5 @@ If the input device cannot be accessed, set up a udev rule.
 For example:
   sudo cp 70-qtouchscreen.rules /etc/udev/rules.d
   sudo udevadm trigger --subsystem-match=input
-The udev rule matches any touchpad or touchscreen device. If there are
-multiple ones, specify the device manually as described above.
+The sample udev rule matches any touchpad or touchscreen device.
+If there are multiple ones, specify the device manually as described above.
index 0068ec8..2bdee0d 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-class QTouchScreenPlugin : public QGenericPlugin
+class QEvdevTouchScreenPlugin : public QGenericPlugin
 {
     Q_OBJECT
     Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QGenericPluginFactoryInterface" FILE "evdevtouch.json")
 
 public:
-    QTouchScreenPlugin();
+    QEvdevTouchScreenPlugin();
 
     QStringList keys() const;
     QObject* create(const QString &key, const QString &specification);
 };
 
-QTouchScreenPlugin::QTouchScreenPlugin()
+QEvdevTouchScreenPlugin::QEvdevTouchScreenPlugin()
 {
 }
 
-QStringList QTouchScreenPlugin::keys() const
+QStringList QEvdevTouchScreenPlugin::keys() const
 {
     return QStringList() << "EvdevTouch";
 }
 
-QObject* QTouchScreenPlugin::create(const QString &key,
-                                    const QString &spec)
+QObject* QEvdevTouchScreenPlugin::create(const QString &key,
+                                         const QString &spec)
 {
     if (!key.compare(QLatin1String("EvdevTouch"), Qt::CaseInsensitive))
-        return new QTouchScreenHandlerThread(spec);
+        return new QEvdevTouchScreenHandlerThread(spec);
 
     return 0;
 }