elput: Add API functions to enable/disable dwt support on touchpads
authorChris Michael <cp.michael@samsung.com>
Wed, 14 Dec 2016 13:48:37 +0000 (08:48 -0500)
committerChris Michael <cp.michael@samsung.com>
Wed, 14 Dec 2016 14:18:14 +0000 (09:18 -0500)
This patch adds API functions to get/set if dwt (disable-while-typing) is
enabled on a touchpad.

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/elput/Elput.h
src/lib/elput/elput_touch.c

index edbd496..c69e0b4 100644 (file)
@@ -429,7 +429,7 @@ EAPI void elput_input_pointer_accel_profile_set(Elput_Manager *manager, const ch
 /**
  * @defgroup Elput_Touch_Group Configuration of touch devices
  *
- * Functions related to configuration of touch devic 
+ * Functions related to configuration of touch devices
  */
 
 /**
@@ -467,7 +467,7 @@ EAPI Eina_Bool elput_touch_drag_enabled_get(Elput_Device *device);
  * tap-and-drag will immediately stop the drag.
  *
  * @param device
- * @param enable
+ * @param enabled
  *
  * @return EINA_TRUE on sucess, EINA_FALSE otherwise
  *
@@ -488,6 +488,32 @@ EAPI Eina_Bool elput_touch_drag_lock_enabled_set(Elput_Device *device, Eina_Bool
  */
 EAPI Eina_Bool elput_touch_drag_lock_enabled_get(Elput_Device *device);
 
+/**
+ * Enable or disable touchpad dwt (disable-while-typing) feature. When enabled, the
+ * device will be disabled while typing and for a short period after.
+ *
+ * @param device
+ * @param enabled
+ *
+ * @return EINA_TRUE on success, EINA_FALSE otherwise
+ *
+ * @ingroup Elput_Touch_Group
+ * @since 1.19
+ */
+EAPI Eina_Bool elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabled);
+
+/**
+ * Get if touchpad dwt (disable-while-typing) is enabled.
+ *
+ * @param device
+ *
+ * @return EINA_TRUE if enabled, EINA_FALSE otherwise
+ *
+ * @ingroup Elput_Touch_Group
+ * @since 1.19
+ */
+EAPI Eina_Bool elput_touch_dwt_enabled_get(Elput_Device *device);
+
 # endif
 
 # undef EAPI
index 46b134e..f26318d 100644 (file)
@@ -61,3 +61,40 @@ elput_touch_drag_lock_enabled_get(Elput_Device *device)
 
    return libinput_device_config_tap_get_drag_lock_enabled(device->device);
 }
+
+EAPI Eina_Bool
+elput_touch_dwt_enabled_set(Elput_Device *device, Eina_Bool enabled)
+{
+   Eina_Bool ret = EINA_FALSE;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
+
+   if (!libinput_device_config_dwt_is_available(device->device))
+     return EINA_FALSE;
+
+   if (enabled)
+     {
+        ret =
+          libinput_device_config_dwt_set_enabled(device->device,
+                                                 LIBINPUT_CONFIG_DWT_ENABLED);
+     }
+   else
+     {
+        ret =
+          libinput_device_config_dwt_set_enabled(device->device,
+                                                 LIBINPUT_CONFIG_DWT_DISABLED);
+     }
+
+   return ret;
+}
+
+EAPI Eina_Bool
+elput_touch_dwt_enabled_get(Elput_Device *device)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(device, EINA_FALSE);
+
+   if (!libinput_device_config_dwt_is_available(device->device))
+     return EINA_FALSE;
+
+   return libinput_device_config_dwt_get_enabled(device->device);
+}