summaryrefslogtreecommitdiffstats
path: root/src/platformsupport
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-01-07 16:53:11 +0100
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2015-01-09 10:14:07 +0100
commit532be5959fa1b5a0f07eda1450552c03dbede8d8 (patch)
treed2df1422705d7035ec901c10e20eac29ae7c3542 /src/platformsupport
parentb495a27d4e28ed19b00557dbaf8ab5d31c21ae4f (diff)
Avoid exposing dependencies from libinput support
Do not include other headers from the main qlibinputhandler_p.h that serves as the external interface to the generic plugin for example. This way the clients do not need to care about xkbcommon headers and such. Task-number: QTBUG-43498 Change-Id: I56335cb19200fee830bdf4b1d203904f741f7489 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/platformsupport')
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler.cpp36
-rw-r--r--src/platformsupport/input/libinput/qlibinputhandler_p.h15
2 files changed, 29 insertions, 22 deletions
diff --git a/src/platformsupport/input/libinput/qlibinputhandler.cpp b/src/platformsupport/input/libinput/qlibinputhandler.cpp
index 557c6eb435..cab4527d0a 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler.cpp
+++ b/src/platformsupport/input/libinput/qlibinputhandler.cpp
@@ -32,6 +32,10 @@
****************************************************************************/
#include "qlibinputhandler_p.h"
+#include "qlibinputpointer_p.h"
+#include "qlibinputkeyboard_p.h"
+#include "qlibinputtouch_p.h"
+
#include <libudev.h>
#include <libinput.h>
#include <QtCore/QLoggingCategory>
@@ -94,8 +98,12 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
qFatal("Failed to assign seat");
m_liFd = libinput_get_fd(m_li);
- m_notifier = new QSocketNotifier(m_liFd, QSocketNotifier::Read);
- connect(m_notifier, SIGNAL(activated(int)), SLOT(onReadyRead()));
+ m_notifier.reset(new QSocketNotifier(m_liFd, QSocketNotifier::Read));
+ connect(m_notifier.data(), SIGNAL(activated(int)), SLOT(onReadyRead()));
+
+ m_pointer.reset(new QLibInputPointer);
+ m_keyboard.reset(new QLibInputKeyboard);
+ m_touch.reset(new QLibInputTouch);
// Process the initial burst of DEVICE_ADDED events.
onReadyRead();
@@ -103,8 +111,6 @@ QLibInputHandler::QLibInputHandler(const QString &key, const QString &spec)
QLibInputHandler::~QLibInputHandler()
{
- delete m_notifier;
-
if (m_li)
libinput_unref(m_li);
@@ -141,7 +147,7 @@ void QLibInputHandler::processEvent(libinput_event *ev)
const char *name = libinput_device_get_name(dev);
emit deviceAdded(QString::fromUtf8(sysname), QString::fromUtf8(name));
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH))
- m_touch.registerDevice(dev);
+ m_touch->registerDevice(dev);
break;
}
case LIBINPUT_EVENT_DEVICE_REMOVED:
@@ -150,35 +156,35 @@ void QLibInputHandler::processEvent(libinput_event *ev)
const char *name = libinput_device_get_name(dev);
emit deviceRemoved(QString::fromUtf8(sysname), QString::fromUtf8(name));
if (libinput_device_has_capability(dev, LIBINPUT_DEVICE_CAP_TOUCH))
- m_touch.unregisterDevice(dev);
+ m_touch->unregisterDevice(dev);
break;
}
case LIBINPUT_EVENT_POINTER_BUTTON:
- m_pointer.processButton(libinput_event_get_pointer_event(ev));
+ m_pointer->processButton(libinput_event_get_pointer_event(ev));
break;
case LIBINPUT_EVENT_POINTER_MOTION:
- m_pointer.processMotion(libinput_event_get_pointer_event(ev));
+ m_pointer->processMotion(libinput_event_get_pointer_event(ev));
break;
case LIBINPUT_EVENT_POINTER_AXIS:
- m_pointer.processAxis(libinput_event_get_pointer_event(ev));
+ m_pointer->processAxis(libinput_event_get_pointer_event(ev));
break;
case LIBINPUT_EVENT_KEYBOARD_KEY:
- m_keyboard.processKey(libinput_event_get_keyboard_event(ev));
+ m_keyboard->processKey(libinput_event_get_keyboard_event(ev));
break;
case LIBINPUT_EVENT_TOUCH_DOWN:
- m_touch.processTouchDown(libinput_event_get_touch_event(ev));
+ m_touch->processTouchDown(libinput_event_get_touch_event(ev));
break;
case LIBINPUT_EVENT_TOUCH_MOTION:
- m_touch.processTouchMotion(libinput_event_get_touch_event(ev));
+ m_touch->processTouchMotion(libinput_event_get_touch_event(ev));
break;
case LIBINPUT_EVENT_TOUCH_UP:
- m_touch.processTouchUp(libinput_event_get_touch_event(ev));
+ m_touch->processTouchUp(libinput_event_get_touch_event(ev));
break;
case LIBINPUT_EVENT_TOUCH_CANCEL:
- m_touch.processTouchCancel(libinput_event_get_touch_event(ev));
+ m_touch->processTouchCancel(libinput_event_get_touch_event(ev));
break;
case LIBINPUT_EVENT_TOUCH_FRAME:
- m_touch.processTouchFrame(libinput_event_get_touch_event(ev));
+ m_touch->processTouchFrame(libinput_event_get_touch_event(ev));
break;
default:
break;
diff --git a/src/platformsupport/input/libinput/qlibinputhandler_p.h b/src/platformsupport/input/libinput/qlibinputhandler_p.h
index b6c88111af..a1cfaca3ce 100644
--- a/src/platformsupport/input/libinput/qlibinputhandler_p.h
+++ b/src/platformsupport/input/libinput/qlibinputhandler_p.h
@@ -35,9 +35,7 @@
#define QLIBINPUTHANDLER_P_H
#include <QtCore/QObject>
-#include "qlibinputpointer_p.h"
-#include "qlibinputkeyboard_p.h"
-#include "qlibinputtouch_p.h"
+#include <QtCore/QScopedPointer>
//
// W A R N I N G
@@ -57,6 +55,9 @@ struct libinput_event;
QT_BEGIN_NAMESPACE
class QSocketNotifier;
+class QLibInputPointer;
+class QLibInputKeyboard;
+class QLibInputTouch;
class QLibInputHandler : public QObject
{
@@ -79,10 +80,10 @@ private:
udev *m_udev;
libinput *m_li;
int m_liFd;
- QSocketNotifier *m_notifier;
- QLibInputPointer m_pointer;
- QLibInputKeyboard m_keyboard;
- QLibInputTouch m_touch;
+ QScopedPointer<QSocketNotifier> m_notifier;
+ QScopedPointer<QLibInputPointer> m_pointer;
+ QScopedPointer<QLibInputKeyboard> m_keyboard;
+ QScopedPointer<QLibInputTouch> m_touch;
};
QT_END_NAMESPACE