summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/directfb/qdirectfbinput.h
blob: 0b2e7ede102d3963048d69806ae56a24faca21bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef QDIRECTFBINPUT_H
#define QDIRECTFBINPUT_H

#include <QSemaphore>
#include <QObject>
#include <QHash>
#include <QPoint>
#include <QEvent>

#include <QtGui/qwindowdefs.h>

#include <directfb.h>

class QDirectFbInput : public QObject
{
    Q_OBJECT
public:
    QDirectFbInput(QObject *parent);
    void addWindow(DFBWindowID id, QWidget *tlw);
    void removeWindow(WId wId);

public slots:
    void runInputEventLoop();
    void stopInputEventLoop();
    void handleEvents();

private:
    void handleMouseEvents(const DFBEvent &event);
    void handleWheelEvent(const DFBEvent &event);
    void handleKeyEvents(const DFBEvent &event);
    void handleEnterLeaveEvents(const DFBEvent &event);
    inline QPoint globalPoint(const DFBEvent &event) const;


    IDirectFB *m_dfbInterface;
    IDirectFBDisplayLayer *m_dfbDisplayLayer;
    IDirectFBEventBuffer *m_eventBuffer;

    bool m_shouldStop;
    QSemaphore m_waitStop;

    QHash<DFBWindowID,QWidget *>m_tlwMap;
};

#endif // QDIRECTFBINPUT_H