From 0f81e32433d1dedf5daf128ece3423f2b2a56098 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 14 Dec 2016 08:59:56 -0500 Subject: [PATCH] elput: Add API functions to get/set the scroll method for a touchpad device This patch adds API functions which can be used to get or set the scroll method used for a given device. Scroll method defines when to generate scroll axis events @feature Signed-off-by: Chris Michael --- src/lib/elput/Elput.h | 27 +++++++++++++++++++++++++++ src/lib/elput/elput_touch.c | 20 ++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index c69e0b4..40bc2d9 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -514,6 +514,33 @@ EAPI Eina_Bool elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabl */ EAPI Eina_Bool elput_touch_dwt_enabled_get(Elput_Device *device); +/** + * Set the scroll method used for this device. The scroll method defines when + * to generate scroll axis events instead of pointer motion events. + * + * @param device + * @param method + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI Eina_Bool elput_touch_scroll_method_set(Elput_Device *device, int method); + +/** + * Get the current scroll method set on a device + * + * @param device + * + * @return The current scroll method + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI int elput_touch_scroll_method_get(Elput_Device *device); + + # endif # undef EAPI diff --git a/src/lib/elput/elput_touch.c b/src/lib/elput/elput_touch.c index f26318d..821d33d 100644 --- a/src/lib/elput/elput_touch.c +++ b/src/lib/elput/elput_touch.c @@ -98,3 +98,23 @@ elput_touch_dwt_enabled_get(Elput_Device *device) return libinput_device_config_dwt_get_enabled(device->device); } + +EAPI Eina_Bool +elput_touch_scroll_method_set(Elput_Device *device, int method) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); + + if (libinput_device_config_scroll_set_method(device->device, method) == + LIBINPUT_CONFIG_STATUS_SUCCESS) + return EINA_TRUE; + + return EINA_FALSE; +} + +EAPI int +elput_touch_scroll_method_get(Elput_Device *device) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1); + + return libinput_device_config_scroll_get_method(device->device); +} -- 2.7.4