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