elput: Add API to allow settings tap-to-click on pointer device
authorMichaël Bouchaud (yoz) <yoz@efl.so>
Thu, 31 Jan 2019 13:39:41 +0000 (08:39 -0500)
committerJongmin Lee <jm105.lee@samsung.com>
Wed, 6 Feb 2019 22:20:10 +0000 (07:20 +0900)
Summary:
Add a way to configure pointer device with tap-to-click features.

@feature

Reviewers: ManMower, devilhorns

Reviewed By: devilhorns

Subscribers: devilhorns, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D7843

src/lib/elput/Elput.h
src/lib/elput/elput_input.c

index e38adf5..a651ccf 100644 (file)
@@ -375,6 +375,20 @@ EAPI void elput_input_pointer_max_set(Elput_Manager *manager, int maxw, int maxh
 EAPI Eina_Bool elput_input_pointer_rotation_set(Elput_Manager *manager, int rotation);
 
 /**
+ * Set tap-to-click status
+ *
+ * @param manager
+ * @param status
+ *
+ * @return EINA_TRUE on success, EINA_FALSE otherwise
+ *
+ * @ingroup Elput_Input_Group
+ * @since 1.22
+ */
+EAPI void elput_input_touch_tap_to_click_enabled_set(Elput_Manager *manager, const char *seat, Eina_Bool enabled);
+
+
+/**
  * Calibrate input devices for given screen size
  *
  * @param manager
index ca0e130..392b157 100644 (file)
@@ -847,6 +847,44 @@ elput_input_pointer_accel_speed_set(Elput_Manager *manager, const char *seat, do
      }
 }
 
+EAPI void
+elput_input_touch_tap_to_click_enabled_set(Elput_Manager *manager, const char *seat, Eina_Bool enabled)
+{
+   Elput_Seat *eseat;
+   Elput_Device *edev;
+   Eina_List *l, *ll;
+   enum libinput_config_tap_state state;
+
+   EINA_SAFETY_ON_NULL_RETURN(manager);
+
+   state = enabled ? LIBINPUT_CONFIG_TAP_ENABLED : LIBINPUT_CONFIG_TAP_DISABLED;
+
+   /* if no seat name is passed in, just use default seat name */
+   if (!seat) seat = "seat0";
+
+   EINA_LIST_FOREACH(manager->input.seats, l, eseat)
+     {
+        if ((eseat->name) && (strcmp(eseat->name, seat)))
+          continue;
+
+        EINA_LIST_FOREACH(eseat->devices, ll, edev)
+          {
+             if (!libinput_device_has_capability(edev->device,
+                                                 LIBINPUT_DEVICE_CAP_POINTER))
+               continue;
+
+             if (libinput_device_config_tap_set_enabled(edev->device, state)
+                 != LIBINPUT_CONFIG_STATUS_SUCCESS)
+               {
+                  WRN("Failed to %s tap-to-click on device: %s",
+                      enabled ? "enable" : "disable",
+                      libinput_device_get_name(edev->device));
+                  continue;
+               }
+          }
+     }
+}
+
 EAPI Elput_Seat *
 elput_device_seat_get(const Elput_Device *dev)
 {