From be51772d023161c81978b3a63b6379d4ebb8013f Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Mon, 10 Feb 2014 11:00:00 +0100 Subject: Cleanup TSLib plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch cleans up the coding style and includes Change-Id: I710d4a60795e9975d4f8ee79599018e05d85debe Reviewed-by: Jørgen Lind Reviewed-by: Laszlo Agocs --- src/plugins/generic/tslib/qtslib.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/plugins/generic/tslib/qtslib.cpp b/src/plugins/generic/tslib/qtslib.cpp index 773939b485..9905d9cc9e 100644 --- a/src/plugins/generic/tslib/qtslib.cpp +++ b/src/plugins/generic/tslib/qtslib.cpp @@ -48,8 +48,6 @@ #include #include -#include - #include #include @@ -65,21 +63,21 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key, setObjectName(QLatin1String("TSLib Mouse Handler")); QByteArray device = qgetenv("TSLIB_TSDEVICE"); - if (device.isEmpty()) - device = QByteArrayLiteral("/dev/input/event1"); if (specification.startsWith("/dev/")) device = specification.toLocal8Bit(); + if (device.isEmpty()) + device = QByteArrayLiteral("/dev/input/event1"); + m_dev = ts_open(device.constData(), 1); if (!m_dev) { qErrnoWarning(errno, "ts_open() failed"); return; } - if (ts_config(m_dev)) { + if (ts_config(m_dev)) perror("Error configuring\n"); - } m_rawMode = !key.compare(QLatin1String("TslibRaw"), Qt::CaseInsensitive); @@ -89,7 +87,6 @@ QTsLibMouseHandler::QTsLibMouseHandler(const QString &key, connect(m_notify, SIGNAL(activated(int)), this, SLOT(readMouseData())); } else { qWarning("Cannot open mouse input device '%s': %s", device.constData(), strerror(errno)); - return; } } @@ -103,12 +100,10 @@ QTsLibMouseHandler::~QTsLibMouseHandler() static bool get_sample(struct tsdev *dev, struct ts_sample *sample, bool rawMode) { - if (rawMode) { + if (rawMode) return (ts_read_raw(dev, sample, 1) == 1); - } else { - int ret = ts_read(dev, sample, 1); - return ( ret == 1); - } + else + return (ts_read(dev, sample, 1) == 1); } -- cgit v1.2.3