summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Michael <cpmichael@osg.samsung.com>2016-05-24 09:19:04 -0400
committerChris Michael <cpmichael@osg.samsung.com>2016-05-24 09:19:04 -0400
commiteec50ed7bdf629ab30d0e5720ef7e0171eb44bae (patch)
tree7adb0b0783a2a8d427ec5fcc5bf7aed44629ca74
parent39b9c7564aa7e5751adbbeaf1715cacd6f80a443 (diff)
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>
-rw-r--r--src/lib/elput/Elput.h14
-rw-r--r--src/lib/elput/elput_input.c41
-rw-r--r--src/lib/elput/elput_private.h2
3 files changed, 57 insertions, 0 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index dfddf78723..6a4545d8cd 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -286,6 +286,20 @@ EAPI void elput_input_pointer_xy_get(Elput_Manager *manager, const char *seat, i
286EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y); 286EAPI void elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int y);
287 287
288/** 288/**
289 * Set the pointer left-handed mode
290 *
291 * @param manager
292 * @param seat
293 * @param left
294 *
295 * @return EINA_TRUE on success, EINA_FALSE otherwise
296 *
297 * @ingroup Elput_Input_Group
298 * @since 1.18
299 */
300EAPI Eina_Bool elput_input_pointer_left_handed_set(Elput_Manager *manager, const char *seat, Eina_Bool left);
301
302/**
289 * Get the list of devices on a given seat 303 * Get the list of devices on a given seat
290 * 304 *
291 * @param seat 305 * @param seat
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index 2dd5607f80..d49a2d0236 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -332,6 +332,47 @@ elput_input_pointer_xy_set(Elput_Manager *manager, const char *seat, int x, int
332 } 332 }
333} 333}
334 334
335EAPI Eina_Bool
336elput_input_pointer_left_handed_set(Elput_Manager *manager, const char *seat, Eina_Bool left)
337{
338 Elput_Seat *eseat;
339 Elput_Device *edev;
340 Eina_List *l, *ll;
341
342 EINA_SAFETY_ON_NULL_RETURN_VAL(manager, EINA_FALSE);
343
344 /* if no seat name is passed in, just use default seat name */
345 if (!seat) seat = "seat0";
346
347 EINA_LIST_FOREACH(manager->input.seats, l, eseat)
348 {
349 if ((eseat->name) && (strcmp(eseat->name, seat)))
350 continue;
351
352 EINA_LIST_FOREACH(eseat->devices, ll, edev)
353 {
354 if (!libinput_device_has_capability(edev->device,
355 LIBINPUT_DEVICE_CAP_POINTER))
356 continue;
357
358 if (edev->left_handed == left) continue;
359
360 if (libinput_device_config_left_handed_set(edev->device,
361 (int)left) !=
362 LIBINPUT_CONFIG_STATUS_SUCCESS)
363 {
364 WRN("Failed to set left handed mode for device: %s",
365 libinput_device_get_name(edev->device));
366 continue;
367 }
368 else
369 edev->left_handed = !!left;
370 }
371 }
372
373 return EINA_TRUE;
374}
375
335EAPI const Eina_List * 376EAPI const Eina_List *
336elput_input_devices_get(Elput_Seat *seat) 377elput_input_devices_get(Elput_Seat *seat)
337{ 378{
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index d3297fad00..1f6d6084d8 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -212,6 +212,8 @@ struct _Elput_Device
212 struct libinput_device *device; 212 struct libinput_device *device;
213 213
214 Elput_Device_Capability caps; 214 Elput_Device_Capability caps;
215
216 Eina_Bool left_handed : 1;
215}; 217};
216 218
217struct _Elput_Manager 219struct _Elput_Manager