From 73a074498a18dfe5217c3eedec8be9cf1388a1dd Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 14 Dec 2016 09:04:52 -0500 Subject: [PATCH] elput: Add API functions to get/set touchpad click method This patch adds API functions to get or set the click method used on touch devices. The click method defines when to generate software emulated buttons @feature Signed-off-by: Chris Michael --- src/lib/elput/Elput.h | 25 +++++++++++++++++++++++++ src/lib/elput/elput_touch.c | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index 40bc2d9..9429bdb 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -540,6 +540,31 @@ EAPI Eina_Bool elput_touch_scroll_method_set(Elput_Device *device, int method); */ EAPI int elput_touch_scroll_method_get(Elput_Device *device); +/** + * Set the button click method for a device. The button click method defines + * when to generate software emulated buttons + * + * @param device + * @param method + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI Eina_Bool elput_touch_click_method_set(Elput_Device *device, int method); + +/** + * Get the current button click method for a device + * + * @param device + * + * @return The current button click method + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI int elput_touch_click_method_get(Elput_Device *device); # endif diff --git a/src/lib/elput/elput_touch.c b/src/lib/elput/elput_touch.c index 821d33d..58576a2 100644 --- a/src/lib/elput/elput_touch.c +++ b/src/lib/elput/elput_touch.c @@ -118,3 +118,23 @@ elput_touch_scroll_method_get(Elput_Device *device) return libinput_device_config_scroll_get_method(device->device); } + +EAPI Eina_Bool +elput_touch_click_method_set(Elput_Device *device, int method) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); + + if (libinput_device_config_click_set_method(device->device, method) == + LIBINPUT_CONFIG_STATUS_SUCCESS) + return EINA_TRUE; + + return EINA_FALSE; +} + +EAPI int +elput_touch_click_method_get(Elput_Device *device) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(device, -1); + + return libinput_device_config_click_get_method(device->device); +} -- 2.7.4