elput: Add API to allow setting pointer acceleration profile

This patch adds an API that can be used to set a pointer acceleration
profile. This API should be used when addressing T4736

ref T4736

@feature

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2016-11-02 09:44:13 -04:00
parent c4f64a3390
commit 93f7639c0d
2 changed files with 47 additions and 0 deletions

View File

@ -413,6 +413,18 @@ EAPI void elput_input_keyboard_cached_keymap_set(Elput_Manager *manager, void *k
*/
EAPI Eina_Stringshare *elput_input_device_output_name_get(Elput_Device *device);
/**
* Set the pointer acceleration profile
*
* @param manager
* @param seat
* @param profile
*
* @ingroup Elput_Input_Group
* @since 1.19
*/
EAPI void elput_input_pointer_accel_profile_set(Elput_Manager *manager, const char *seat, uint32_t profile);
# endif
# undef EAPI

View File

@ -638,3 +638,38 @@ elput_input_device_output_name_get(Elput_Device *device)
if (!device->output_name) return NULL;
return eina_stringshare_ref(device->output_name);
}
EAPI void
elput_input_pointer_accel_profile_set(Elput_Manager *manager, const char *seat, uint32_t profile)
{
Elput_Seat *eseat;
Elput_Device *edev;
Eina_List *l, *ll;
EINA_SAFETY_ON_NULL_RETURN(manager);
/* 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_accel_set_profile(edev->device,
profile) !=
LIBINPUT_CONFIG_STATUS_SUCCESS)
{
WRN("Failed to set acceleration profile for device: %s",
libinput_device_get_name(edev->device));
continue;
}
}
}
}