forked from enlightenment/efl
elput: Add API function to set left-handed device
This commit adds an API function which Enlightenment can call in order to set an input device to be "left-handed". Mainly used for a mouse pointer, but not specific to pointers. @feature Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
parent
39b9c7564a
commit
eec50ed7bd
|
@ -285,6 +285,20 @@ EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, i
|
|||
*/
|
||||
EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y);
|
||||
|
||||
/**
|
||||
* Set the pointer left-handed mode
|
||||
*
|
||||
* @param manager
|
||||
* @param seat
|
||||
* @param left
|
||||
*
|
||||
* @return EINA_TRUE on success, EINA_FALSE otherwise
|
||||
*
|
||||
* @ingroup Elput_Input_Group
|
||||
* @since 1.18
|
||||
*/
|
||||
EAPI Eina_Bool elput_input_pointer_left_handed_set(Elput_Manager *manager, const char *seat, Eina_Bool left);
|
||||
|
||||
/**
|
||||
* Get the list of devices on a given seat
|
||||
*
|
||||
|
|
|
@ -332,6 +332,47 @@ elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int
|
|||
}
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elput_input_pointer_left_handed_set(Elput_Manager *manager, const char *seat, Eina_Bool left)
|
||||
{
|
||||
Elput_Seat *eseat;
|
||||
Elput_Device *edev;
|
||||
Eina_List *l, *ll;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(manager, EINA_FALSE);
|
||||
|
||||
/* 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 (edev->left_handed == left) continue;
|
||||
|
||||
if (libinput_device_config_left_handed_set(edev->device,
|
||||
(int)left) !=
|
||||
LIBINPUT_CONFIG_STATUS_SUCCESS)
|
||||
{
|
||||
WRN("Failed to set left handed mode for device: %s",
|
||||
libinput_device_get_name(edev->device));
|
||||
continue;
|
||||
}
|
||||
else
|
||||
edev->left_handed = !!left;
|
||||
}
|
||||
}
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI const Eina_List *
|
||||
elput_input_devices_get(Elput_Seat *seat)
|
||||
{
|
||||
|
|
|
@ -212,6 +212,8 @@ struct _Elput_Device
|
|||
struct libinput_device *device;
|
||||
|
||||
Elput_Device_Capability caps;
|
||||
|
||||
Eina_Bool left_handed : 1;
|
||||
};
|
||||
|
||||
struct _Elput_Manager
|
||||
|
|
Loading…
Reference in New Issue