Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/xinputintegration.h
Show All 17 Lines | |||||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #ifndef KWIN_XINPUTINTEGRATION_H | 20 | #ifndef KWIN_XINPUTINTEGRATION_H | ||
21 | #define KWIN_XINPUTINTEGRATION_H | 21 | #define KWIN_XINPUTINTEGRATION_H | ||
22 | 22 | | |||
23 | #include <QObject> | 23 | #include <QObject> | ||
24 | #include <QPointer> | 24 | #include <QPointer> | ||
25 | #include <QScopedPointer> | 25 | #include <QScopedPointer> | ||
26 | typedef struct _XDisplay Display; | ||||
26 | 27 | | |||
27 | namespace KWin | 28 | namespace KWin | ||
28 | { | 29 | { | ||
29 | 30 | | |||
30 | class XInputEventFilter; | 31 | class XInputEventFilter; | ||
31 | class XKeyPressReleaseEventFilter; | 32 | class XKeyPressReleaseEventFilter; | ||
32 | class X11Cursor; | 33 | class X11Cursor; | ||
33 | class Xkb; | 34 | class Xkb; | ||
34 | 35 | | |||
35 | class XInputIntegration : public QObject | 36 | class XInputIntegration : public QObject | ||
36 | { | 37 | { | ||
37 | Q_OBJECT | 38 | Q_OBJECT | ||
38 | public: | 39 | public: | ||
39 | explicit XInputIntegration(QObject *parent); | 40 | explicit XInputIntegration(Display *display, QObject *parent); | ||
40 | virtual ~XInputIntegration(); | 41 | virtual ~XInputIntegration(); | ||
41 | 42 | | |||
42 | void init(); | 43 | void init(); | ||
43 | void startListening(); | 44 | void startListening(); | ||
44 | 45 | | |||
45 | bool hasXinput() const { | 46 | bool hasXinput() const { | ||
46 | return m_hasXInput; | 47 | return m_hasXInput; | ||
47 | } | 48 | } | ||
48 | void setCursor(X11Cursor *cursor); | 49 | void setCursor(X11Cursor *cursor); | ||
49 | void setXkb(Xkb *xkb); | 50 | void setXkb(Xkb *xkb); | ||
50 | 51 | | |||
51 | private: | 52 | private: | ||
53 | Display *display() const { | ||||
54 | return m_x11Display; | ||||
55 | } | ||||
52 | 56 | | |||
53 | bool m_hasXInput = false; | 57 | bool m_hasXInput = false; | ||
54 | int m_xiOpcode = 0; | 58 | int m_xiOpcode = 0; | ||
55 | int m_majorVersion = 0; | 59 | int m_majorVersion = 0; | ||
56 | int m_minorVersion = 0; | 60 | int m_minorVersion = 0; | ||
57 | QPointer<X11Cursor> m_x11Cursor; | 61 | QPointer<X11Cursor> m_x11Cursor; | ||
58 | // TODO: QPointer | 62 | // TODO: QPointer | ||
59 | Xkb *m_xkb = nullptr; | 63 | Xkb *m_xkb = nullptr; | ||
64 | Display *m_x11Display; | ||||
60 | 65 | | |||
61 | QScopedPointer<XInputEventFilter> m_xiEventFilter; | 66 | QScopedPointer<XInputEventFilter> m_xiEventFilter; | ||
62 | QScopedPointer<XKeyPressReleaseEventFilter> m_keyPressFilter; | 67 | QScopedPointer<XKeyPressReleaseEventFilter> m_keyPressFilter; | ||
63 | QScopedPointer<XKeyPressReleaseEventFilter> m_keyReleaseFilter; | 68 | QScopedPointer<XKeyPressReleaseEventFilter> m_keyReleaseFilter; | ||
64 | }; | 69 | }; | ||
65 | 70 | | |||
66 | } | 71 | } | ||
67 | 72 | | |||
68 | #endif | 73 | #endif |