#ifndef INPUTDEVICEMANAGER_H
#define INPUTDEVICEMANAGER_H

#include <libudev.h>
#include <libinput.h>
#include <QObject>
#include <QtCore/QScopedPointer>
#include <QtCore/QPoint>

struct udev;
struct libinput;
struct libinput_event;

class QSocketNotifier;

class InputDeviceManager : public QObject
{
    Q_OBJECT
public:
    explicit InputDeviceManager(QObject *parent = nullptr);
    virtual ~InputDeviceManager();
    void onReadyRead();

signals:
    void onMouseWheel(QPoint angleDelta);
private:
    udev *m_udev;
    libinput *m_li;
    int m_liFd;
    QPoint m_pos;
    QScopedPointer<QSocketNotifier> m_notifier;

    void processEvent(libinput_event *ev);
    void processAxis(libinput_event_pointer *e);
};

#endif // INPUTDEVICEMANAGER_H
