Changeset View
Changeset View
Standalone View
Standalone View
kcms/touchpadx/src/backends/x11/libinputtouchpad.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2015 Red Hat, Inc. | ||||
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 | #include "libinputtouchpad.h" | ||||
20 | | ||||
21 | #include <stddef.h> | ||||
22 | #include <limits.h> | ||||
23 | | ||||
24 | const struct Parameter libinputProperties[] = { | ||||
25 | /* This is a boolean for all three fingers, no per-finger config */ | ||||
26 | {"Tapping", PT_INT, 0, 1, "libinput Tapping Enabled", 8, 0}, | ||||
27 | /* libinput normalizes the accel to -1/1 */ | ||||
28 | {"AccelFactor", PT_DOUBLE, -1.0, 1.0, "libinput Accel Speed", 0 /*float */, 0}, | ||||
29 | /* Only one of these may be set at one time */ | ||||
30 | {"VertEdgeScroll", PT_INT, 0, 1, "libinput Scroll Method Enabled", 8, 1}, | ||||
31 | {"VertTwoFingerScroll", PT_INT, 0, 1, "libinput Scroll Method Enabled", 8, 0}, | ||||
32 | {"InvertVertScroll", PT_INT, 0, 1, "libinput Natural Scrolling Enabled", 8, 0}, | ||||
33 | /* libinput doesn't have a separate toggle for horiz scrolling */ | ||||
34 | { NULL, PT_INT, 0, 0, 0, 0, 0 } | ||||
35 | }; | ||||
36 | | ||||
37 | LibinputTouchpad::LibinputTouchpad(Display *display, int deviceId): XlibTouchpad(display, deviceId) | ||||
38 | { | ||||
39 | loadSupportedProperties(libinputProperties); | ||||
40 | | ||||
41 | /* FIXME: has a different format than Synaptics Off but we don't expose | ||||
42 | the toggle so this is just to stop it from crashing when we check | ||||
43 | m_touchpadOffAtom */ | ||||
44 | m_touchpadOffAtom.intern(m_connection, | ||||
45 | "libinput Send Events Mode enabled"); | ||||
46 | | ||||
47 | | ||||
48 | XcbAtom scroll_methods(m_connection, | ||||
49 | "libinput Scroll Methods Available", | ||||
50 | true); | ||||
51 | if (scroll_methods.atom() != 0) { | ||||
52 | PropertyInfo methods(m_display, | ||||
53 | m_deviceId, | ||||
54 | scroll_methods.atom(), | ||||
55 | 0); | ||||
56 | if (!methods.value(0).toInt()) | ||||
57 | m_supported.removeAll("VertTwoFingerScroll"); | ||||
58 | else if (!methods.value(1).toInt()) | ||||
59 | m_supported.removeAll("VertEdgeScroll"); | ||||
60 | } | ||||
61 | } |