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>bb10
parent
b495a27d4e
commit
532be5959f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue