elput: Add API to allow settings tap-to-click on pointer device

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
This commit is contained in:
Michaël Bouchaud (yoz) 2019-01-31 08:39:41 -05:00 committed by Christopher Michael
parent 28a88bbfc8
commit ebc84e82ac
2 changed files with 52 additions and 0 deletions

View File

@ -374,6 +374,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
*

View 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)
{