diff options
author | Johannes Zellner <johannes.zellner@nokia.com> | 2012-05-25 16:42:55 -0700 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-30 04:25:48 +0200 |
commit | e6a4d6054d6c4c9c2d8796255659bb6b3fcca635 (patch) | |
tree | 0d925b86b6ed07b6679c10b712043811916a3efc /src/plugins/generic/evdevmouse | |
parent | a530ffd6def62b0d81f8bdfd02e54c62cd4d8d8f (diff) |
evdev: Cleanup mouse and keyboard plugins
Remove fallback event0 device usage. All available devices should be
detected automatically from DeviceDiscovery either through udev or the
static fallback discovery method. This also removes the never used 'key'
argument, which was pulled over from Qt4.
Change-Id: Iffe8bd80f0770664024019a220cbbc6f98843340
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
Diffstat (limited to 'src/plugins/generic/evdevmouse')
-rw-r--r-- | src/plugins/generic/evdevmouse/qevdevmousehandler.cpp | 22 | ||||
-rw-r--r-- | src/plugins/generic/evdevmouse/qevdevmousehandler.h | 7 | ||||
-rw-r--r-- | src/plugins/generic/evdevmouse/qevdevmousemanager.cpp | 9 |
3 files changed, 11 insertions, 27 deletions
diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp b/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp index 55392c20c4..439d2c095a 100644 --- a/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp +++ b/src/plugins/generic/evdevmouse/qevdevmousehandler.cpp @@ -62,15 +62,12 @@ QT_BEGIN_NAMESPACE -QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QString &key, const QString &specification) +QEvdevMouseHandler *QEvdevMouseHandler::create(const QString &device, const QString &specification) { #ifdef QT_QPA_MOUSE_HANDLER_DEBUG - qWarning() << "Try to create mouse handler with" << key << specification; -#else - Q_UNUSED(key) + qWarning() << "Try to create mouse handler for" << device << specification; #endif - QString device = "/dev/input/event0"; bool compression = true; int jitterLimit = 0; @@ -80,28 +77,21 @@ QEvdevMouseHandler *QEvdevMouseHandler::createLinuxInputMouseHandler(const QStri compression = false; else if (arg.startsWith("dejitter=")) jitterLimit = arg.mid(9).toInt(); - else if (arg.startsWith(QLatin1String("/dev/"))) - device = arg; } -#ifdef QT_QPA_MOUSE_HANDLER_DEBUG - qDebug("evdevmouse: Using device %s", qPrintable(device)); -#endif - int fd; fd = qt_safe_open(device.toLocal8Bit().constData(), O_RDONLY | O_NDELAY, 0); if (fd >= 0) { - return new QEvdevMouseHandler(fd, compression, jitterLimit); + return new QEvdevMouseHandler(device, fd, compression, jitterLimit); } else { qWarning("Cannot open mouse input device '%s': %s", qPrintable(device), strerror(errno)); return 0; } } -QEvdevMouseHandler::QEvdevMouseHandler(int deviceDescriptor, bool compression, int jitterLimit) - : m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), - m_fd(deviceDescriptor), m_compression(compression), - m_buttons(0) +QEvdevMouseHandler::QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit) + : m_device(device), m_fd(fd), m_notify(0), m_x(0), m_y(0), m_prevx(0), m_prevy(0), + m_compression(compression), m_buttons(0) { setObjectName(QLatin1String("Evdev Mouse Handler")); diff --git a/src/plugins/generic/evdevmouse/qevdevmousehandler.h b/src/plugins/generic/evdevmouse/qevdevmousehandler.h index d3d07bdce5..e3444735fe 100644 --- a/src/plugins/generic/evdevmouse/qevdevmousehandler.h +++ b/src/plugins/generic/evdevmouse/qevdevmousehandler.h @@ -55,7 +55,7 @@ class QEvdevMouseHandler : public QObject { Q_OBJECT public: - static QEvdevMouseHandler *createLinuxInputMouseHandler(const QString &key, const QString &specification); + static QEvdevMouseHandler *create(const QString &device, const QString &specification); ~QEvdevMouseHandler(); signals: @@ -65,14 +65,15 @@ private slots: void readMouseData(); private: - QEvdevMouseHandler(int deviceDescriptor, bool compression, int jitterLimit); + QEvdevMouseHandler(const QString &device, int fd, bool compression, int jitterLimit); void sendMouseEvent(); + QString m_device; + int m_fd; QSocketNotifier *m_notify; int m_x, m_y; int m_prevx, m_prevy; - int m_fd; bool m_compression; Qt::MouseButtons m_buttons; int m_jitterLimitSquared; diff --git a/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp b/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp index 8547e444f0..459164b9be 100644 --- a/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp +++ b/src/plugins/generic/evdevmouse/qevdevmousemanager.cpp @@ -138,15 +138,8 @@ void QEvdevMouseManager::addMouse(const QString &deviceNode) qWarning() << "Adding mouse at" << deviceNode; #endif - QString specification = m_spec; - - if (!deviceNode.isEmpty()) { - specification.append(":"); - specification.append(deviceNode); - } - QEvdevMouseHandler *handler; - handler = QEvdevMouseHandler::createLinuxInputMouseHandler("EvdevMouse", specification); + handler = QEvdevMouseHandler::create(deviceNode, m_spec); if (handler) { connect(handler, SIGNAL(handleMouseEvent(int, int, Qt::MouseButtons)), this, SLOT(handleMouseEvent(int, int, Qt::MouseButtons))); m_mice.insert(deviceNode, handler); |