Changeset View
Changeset View
Standalone View
Standalone View
kcms/input/backends/x11/x11mousebackend.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright 2017 Xuetian Weng <wengxt@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 XLIBMOUSEBACKEND_H | ||||
20 | #define XLIBMOUSEBACKEND_H | ||||
21 | | ||||
22 | #include "mousebackend.h" | ||||
23 | | ||||
24 | #include <QX11Info> | ||||
25 | #include <X11/Xdefs.h> | ||||
26 | | ||||
27 | class X11MouseBackend : public MouseBackend | ||||
28 | { | ||||
29 | Q_OBJECT | ||||
30 | public: | ||||
31 | X11MouseBackend(QObject *parent = nullptr); | ||||
32 | ~X11MouseBackend(); | ||||
33 | | ||||
34 | bool isValid() const override { return m_dpy != nullptr; } | ||||
35 | | ||||
36 | void load() override; | ||||
37 | bool supportScrollPolarity() override; | ||||
38 | double accelRate() override; | ||||
39 | MouseHanded handed() override; | ||||
40 | int threshold() override; | ||||
41 | void apply(const MouseSettings & settings, bool force) override; | ||||
42 | | ||||
43 | QString currentCursorTheme() override; | ||||
44 | void applyCursorTheme(const QString &name, int size) override; | ||||
45 | | ||||
46 | private: | ||||
47 | void initAtom(); | ||||
48 | bool evdevApplyReverseScroll(int deviceid, bool reverse); | ||||
49 | Atom m_evdevWheelEmulationAtom; | ||||
50 | Atom m_evdevScrollDistanceAtom; | ||||
51 | Atom m_evdevWheelEmulationAxesAtom; | ||||
52 | // We may still need to do something on non-X11 platform due to Xwayland. | ||||
53 | Display* m_dpy; | ||||
54 | bool m_platformX11; | ||||
55 | int m_numButtons = 1; | ||||
56 | MouseHanded m_handed = MouseHanded::NotSupported; | ||||
57 | double m_accelRate = 1.0; | ||||
58 | int m_threshold = 0; | ||||
59 | int m_middleButton = -1; | ||||
60 | }; | ||||
61 | | ||||
62 | #endif // XLIBMOUSEBACKEND_H |