From b27ebc6294af07c6a95eefdc8a910973a14fcdc1 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Wed, 14 Dec 2016 09:11:50 -0500 Subject: [PATCH] elput: Add API functions to get/set if tap-to-click is enabled This patch adds API functions to get or set if tap-to-click is enabled on a touchpad device @feature Signed-off-by: Chris Michael --- src/lib/elput/Elput.h | 25 +++++++++++++++++++++++++ src/lib/elput/elput_touch.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h index 9429bdb2f9..b48caa12a3 100644 --- a/src/lib/elput/Elput.h +++ b/src/lib/elput/Elput.h @@ -566,6 +566,31 @@ EAPI Eina_Bool elput_touch_click_method_set(Elput_Device *device, int method); */ EAPI int elput_touch_click_method_get(Elput_Device *device); +/** + * Enable or disable tap-to-click on a given device + * + * @param device + * @param enabled + * + * @return EINA_TRUE on success, EINA_FALSE otherwise + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI Eina_Bool elput_touch_tap_enabled_set(Elput_Device *device, Eina_Bool enabled); + +/** + * Get if tap-to-click is enabled on a given device + * + * @param device + * + * @return EINA_TRUE if enabled, EINA_FALSE otherwise + * + * @ingroup Elput_Touch_Group + * @since 1.19 + */ +EAPI Eina_Bool elput_touch_tap_enabled_get(Elput_Device *device); + # endif # undef EAPI diff --git a/src/lib/elput/elput_touch.c b/src/lib/elput/elput_touch.c index 58576a2991..f761ca56bf 100644 --- a/src/lib/elput/elput_touch.c +++ b/src/lib/elput/elput_touch.c @@ -138,3 +138,34 @@ elput_touch_click_method_get(Elput_Device *device) return libinput_device_config_click_get_method(device->device); } + +EAPI Eina_Bool +elput_touch_tap_enabled_set(Elput_Device *device, Eina_Bool enabled) +{ + Eina_Bool ret = EINA_FALSE; + + EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); + + if (enabled) + { + ret = + libinput_device_config_tap_set_enabled(device->device, + LIBINPUT_CONFIG_TAP_ENABLED); + } + else + { + ret = + libinput_device_config_tap_set_enabled(device->device, + LIBINPUT_CONFIG_TAP_DISABLED); + } + + return ret; +} + +EAPI Eina_Bool +elput_touch_tap_enabled_get(Elput_Device *device) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE); + + return libinput_device_config_tap_get_enabled(device->device); +}