diff options
author | Robin Burchell <robin.burchell@jollamobile.com> | 2013-12-20 15:14:42 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-30 16:51:23 +0100 |
commit | 5923196bc3fbed67beb637fd36e1bdf2d6780e36 (patch) | |
tree | 6a2f478385ba26ee89fd55908ca9d47eb315ae3b | |
parent | e8d31d1b315c40ef0906579b429bc04279a1686d (diff) |
mtdev: Change to use configure detection instead of requiring source hacking.
This coincidentally fixes a case of accidental BIC in qevdevtouch_p.h, where not
all users would necessarily define USE_MTDEV: having it centralized inside Qt
makes this now, blessedly, impossible.
Change-Id: I196a8f21742830705759aa917a823afdc94ba2b5
Done-with: Michael Brasser <michael.brasser@jollamobile.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
-rw-r--r-- | src/platformsupport/input/evdevtouch/evdevtouch.pri | 6 | ||||
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouch.cpp | 12 | ||||
-rw-r--r-- | src/platformsupport/input/evdevtouch/qevdevtouch_p.h | 4 | ||||
-rw-r--r-- | src/plugins/generic/evdevtouch/README | 5 |
4 files changed, 15 insertions, 12 deletions
diff --git a/src/platformsupport/input/evdevtouch/evdevtouch.pri b/src/platformsupport/input/evdevtouch/evdevtouch.pri index 16e1a981fa..402c276d4d 100644 --- a/src/platformsupport/input/evdevtouch/evdevtouch.pri +++ b/src/platformsupport/input/evdevtouch/evdevtouch.pri @@ -8,6 +8,8 @@ contains(QT_CONFIG, libudev) { LIBS_PRIVATE += $$QMAKE_LIBS_LIBUDEV } -# DEFINES += USE_MTDEV +contains(CONFIG, mtdev) { + CONFIG += link_pkgconfig + PKGCONFIG_PRIVATE += mtdev +} -contains(DEFINES, USE_MTDEV): LIBS_PRIVATE += -lmtdev diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index 89215557c1..d9468ae1b8 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -49,7 +49,7 @@ #include <QtPlatformSupport/private/qdevicediscovery_p.h> #include <linux/input.h> -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) extern "C" { #include <mtdev.h> } @@ -164,7 +164,7 @@ static inline bool testBit(long bit, const long *array) QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QObject *parent) : QObject(parent), m_notify(0), m_fd(-1), d(0) -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) , m_mtdev(0) #endif { @@ -233,7 +233,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, return; } -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) m_mtdev = static_cast<mtdev *>(calloc(1, sizeof(mtdev))); int mtdeverr = mtdev_open(m_mtdev, m_fd); if (mtdeverr) { @@ -245,7 +245,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, d = new QEvdevTouchScreenData(this, args); -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) const char *mtdevStr = "(mtdev)"; d->m_typeB = true; #else @@ -329,7 +329,7 @@ QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(const QString &specification, QEvdevTouchScreenHandler::~QEvdevTouchScreenHandler() { -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) if (m_mtdev) { mtdev_close(m_mtdev); free(m_mtdev); @@ -347,7 +347,7 @@ void QEvdevTouchScreenHandler::readData() ::input_event buffer[32]; int n = 0; for (; ;) { -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) int result = mtdev_get(m_mtdev, m_fd, buffer, sizeof(buffer) / sizeof(::input_event)); if (result > 0) result *= sizeof(::input_event); diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h index be7dbfba14..dbd401c297 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch_p.h +++ b/src/platformsupport/input/evdevtouch/qevdevtouch_p.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QSocketNotifier; class QEvdevTouchScreenData; -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) struct mtdev; #endif @@ -71,7 +71,7 @@ private: QSocketNotifier *m_notify; int m_fd; QEvdevTouchScreenData *d; -#ifdef USE_MTDEV +#if !defined(QT_NO_MTDEV) mtdev *m_mtdev; #endif }; diff --git a/src/plugins/generic/evdevtouch/README b/src/plugins/generic/evdevtouch/README index ad406254d1..833b511fd8 100644 --- a/src/plugins/generic/evdevtouch/README +++ b/src/plugins/generic/evdevtouch/README @@ -5,8 +5,9 @@ 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 -src/platformsupport/input/evdevtouch/evdevtouch.pri. + +libmtdev is automatically detected based on library availability. To disable it, +pass -no-mtdev to configure. Tested with the following kernel drivers: bcm5974 (type A) |