Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/backends/x11/xlibbackend.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2013 Alexander Mezin <mezin.alexander@gmail.com> | ||||
3 | * | ||||
4 | * This program is free software; you can redistribute it and/or modify | ||||
5 | * it under the terms of the GNU General Public License as published by | ||||
6 | * the Free Software Foundation; either version 2 of the License, or | ||||
7 | * (at your option) any later version. | ||||
8 | * | ||||
9 | * This program is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
12 | * GNU General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU General Public License | ||||
15 | * along with this program; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
17 | */ | ||||
18 | | ||||
19 | #ifndef XLIBBACKEND_H | ||||
20 | #define XLIBBACKEND_H | ||||
21 | | ||||
22 | #include <QMap> | ||||
23 | #include <QSet> | ||||
24 | #include <QScopedPointer> | ||||
25 | #include <QLatin1String> | ||||
26 | #include <QStringList> | ||||
27 | #include <QSharedPointer> | ||||
28 | #include <QX11Info> | ||||
29 | | ||||
30 | #include "touchpadbackend.h" | ||||
31 | #include "xlibtouchpad.h" | ||||
32 | | ||||
33 | #include <xcb/xcb.h> | ||||
34 | | ||||
35 | #include "xcbatom.h" | ||||
36 | #include "propertyinfo.h" | ||||
37 | | ||||
38 | class XlibTouchpad; | ||||
39 | class XlibNotifications; | ||||
40 | class XRecordKeyboardMonitor; | ||||
41 | | ||||
42 | class XlibBackend : public TouchpadBackend | ||||
43 | { | ||||
44 | Q_OBJECT | ||||
45 | | ||||
46 | public: | ||||
47 | static XlibBackend* initialize(QObject *parent = 0); | ||||
48 | ~XlibBackend(); | ||||
49 | | ||||
50 | bool applyConfig(const QVariantHash &) override; | ||||
51 | bool getConfig(QVariantHash &) override; | ||||
52 | QStringList supportedParameters() const override { | ||||
53 | return m_device ? m_device->supportedParameters() : QStringList(); | ||||
54 | } | ||||
55 | QString errorString() const override { return m_errorString; } | ||||
56 | int touchpadCount() const override { return m_device ? 1 : 0; } | ||||
57 | | ||||
58 | void setTouchpadOff(TouchpadOffState) override; | ||||
59 | TouchpadOffState getTouchpadOff() override; | ||||
60 | | ||||
61 | bool isTouchpadAvailable() override; | ||||
62 | bool isTouchpadEnabled() override; | ||||
63 | void setTouchpadEnabled(bool) override; | ||||
64 | | ||||
65 | void watchForEvents(bool keyboard) override; | ||||
66 | | ||||
67 | QStringList listMouses(const QStringList &blacklist) override; | ||||
68 | | ||||
69 | private slots: | ||||
70 | void propertyChanged(xcb_atom_t); | ||||
71 | void touchpadDetached(); | ||||
72 | void devicePlugged(int); | ||||
73 | | ||||
74 | protected: | ||||
75 | explicit XlibBackend(QObject *parent); | ||||
76 | | ||||
77 | struct XDisplayCleanup { | ||||
78 | static void cleanup(Display *); | ||||
79 | }; | ||||
80 | | ||||
81 | QScopedPointer<Display, XDisplayCleanup> m_display; | ||||
82 | xcb_connection_t *m_connection; | ||||
83 | | ||||
84 | XcbAtom m_enabledAtom, m_mouseAtom, m_keyboardAtom, m_touchpadAtom; | ||||
85 | XcbAtom m_synapticsIdentifierAtom; | ||||
86 | XcbAtom m_libinputIdentifierAtom; | ||||
87 | | ||||
88 | XlibTouchpad *findTouchpad(); | ||||
89 | QScopedPointer<XlibTouchpad> m_device; | ||||
90 | | ||||
91 | QString m_errorString; | ||||
92 | QScopedPointer<XlibNotifications> m_notifications; | ||||
93 | QScopedPointer<XRecordKeyboardMonitor> m_keyboard; | ||||
94 | }; | ||||
95 | | ||||
96 | #endif // XLIBBACKEND_H |