Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/backends/x11/x11_backend.h
- This file was moved from kcms/input/backends/x11/x11mousebackend.h.
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright 2017 Xuetian Weng <wengxt@gmail.com> | 2 | * Copyright 2017 Xuetian Weng <wengxt@gmail.com> | ||
3 | * Copyright 2018 Roman Gilg <subdiff@gmail.com> | ||||
3 | * | 4 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | 5 | * 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 | * 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 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | 8 | * (at your option) any later version. | ||
8 | * | 9 | * | ||
9 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
13 | * | 14 | * | ||
14 | * You should have received a copy of the GNU General Public License | 15 | * 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 | * 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 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | 18 | */ | ||
18 | 19 | | |||
19 | #ifndef XLIBMOUSEBACKEND_H | 20 | #ifndef X11BACKEND_H | ||
20 | #define XLIBMOUSEBACKEND_H | 21 | #define X11BACKEND_H | ||
21 | 22 | | |||
22 | #include "mousebackend.h" | 23 | #include "inputbackend.h" | ||
24 | #include "evdev_settings.h" | ||||
23 | 25 | | |||
24 | #include <QX11Info> | 26 | #include <QX11Info> | ||
25 | #include <X11/Xdefs.h> | 27 | #include <X11/Xdefs.h> | ||
26 | 28 | | |||
27 | class X11MouseBackend : public MouseBackend | 29 | class ConfigPlugin; | ||
30 | | ||||
31 | class X11Backend : public InputBackend | ||||
28 | { | 32 | { | ||
29 | Q_OBJECT | 33 | Q_OBJECT | ||
30 | public: | 34 | public: | ||
31 | X11MouseBackend(QObject *parent = nullptr); | 35 | X11Backend(QObject *parent = nullptr); | ||
32 | ~X11MouseBackend(); | 36 | ~X11Backend(); | ||
33 | 37 | | |||
34 | bool isValid() const override { return m_dpy != nullptr; } | 38 | bool isValid() const override { return m_dpy != nullptr; } | ||
35 | 39 | | |||
36 | void load() override; | 40 | void load() override; | ||
37 | bool supportScrollPolarity() override; | | |||
38 | QStringList supportedAccelerationProfiles() override; | | |||
39 | QString accelerationProfile() override; | | |||
40 | double accelRate() override; | | |||
41 | MouseHanded handed() override; | | |||
42 | int threshold() override; | | |||
43 | void apply(const MouseSettings & settings, bool force) override; | | |||
44 | 41 | | |||
45 | QString currentCursorTheme() override; | 42 | void apply(bool force = false); | ||
46 | void applyCursorTheme(const QString &name, int size) override; | 43 | | ||
44 | EvdevSettings* settings() { | ||||
45 | return m_settings; | ||||
46 | } | ||||
47 | | ||||
48 | bool supportScrollPolarity(); | ||||
49 | QStringList supportedAccelerationProfiles(); | ||||
50 | QString accelerationProfile(); | ||||
51 | double accelRate(); | ||||
52 | Handed handed(); | ||||
53 | int threshold(); | ||||
54 | | ||||
55 | QString currentCursorTheme(); | ||||
56 | void applyCursorTheme(const QString &name, int size); | ||||
57 | | ||||
58 | Q_SIGNALS: | ||||
59 | void mouseStateChanged(); | ||||
60 | void mousesChanged(); | ||||
61 | void mouseReset(); | ||||
47 | 62 | | |||
48 | private: | 63 | private: | ||
49 | void initAtom(); | 64 | void initAtom(); | ||
50 | bool evdevApplyReverseScroll(int deviceid, bool reverse); | 65 | bool evdevApplyReverseScroll(int deviceid, bool reverse); | ||
51 | bool libinputApplyReverseScroll(int deviceid, bool reverse); | 66 | bool libinputApplyReverseScroll(int deviceid, bool reverse); | ||
52 | void libinputApplyAccelerationProfile(int deviceid, QString profile); | 67 | void libinputApplyAccelerationProfile(int deviceid, QString profile); | ||
53 | 68 | | |||
54 | Atom m_libinputAccelProfileAvailableAtom; | 69 | Atom m_libinputAccelProfileAvailableAtom; | ||
55 | Atom m_libinputAccelProfileEnabledAtom; | 70 | Atom m_libinputAccelProfileEnabledAtom; | ||
56 | Atom m_libinputNaturalScrollAtom; | 71 | Atom m_libinputNaturalScrollAtom; | ||
57 | 72 | | |||
58 | Atom m_evdevWheelEmulationAtom; | 73 | Atom m_evdevWheelEmulationAtom; | ||
59 | Atom m_evdevScrollDistanceAtom; | 74 | Atom m_evdevScrollDistanceAtom; | ||
60 | Atom m_evdevWheelEmulationAxesAtom; | 75 | Atom m_evdevWheelEmulationAxesAtom; | ||
61 | 76 | | |||
62 | Atom m_touchpadAtom; | 77 | Atom m_touchpadAtom; | ||
63 | // We may still need to do something on non-X11 platform due to Xwayland. | 78 | // We may still need to do something on non-X11 platform due to Xwayland. | ||
64 | Display* m_dpy; | 79 | Display* m_dpy; | ||
65 | bool m_platformX11; | 80 | bool m_platformX11; | ||
81 | EvdevSettings *m_settings = nullptr; | ||||
66 | int m_numButtons = 1; | 82 | int m_numButtons = 1; | ||
67 | MouseHanded m_handed = MouseHanded::NotSupported; | 83 | Handed m_handed = Handed::NotSupported; | ||
68 | double m_accelRate = 1.0; | 84 | double m_accelRate = 1.0; | ||
69 | int m_threshold = 0; | 85 | int m_threshold = 0; | ||
70 | int m_middleButton = -1; | 86 | int m_middleButton = -1; | ||
71 | QStringList m_supportedAccelerationProfiles; | 87 | QStringList m_supportedAccelerationProfiles; | ||
72 | QString m_accelerationProfile; | 88 | QString m_accelerationProfile; | ||
73 | }; | 89 | }; | ||
74 | 90 | | |||
75 | #endif // XLIBMOUSEBACKEND_H | 91 | #endif // X11BACKEND_H |