summaryrefslogtreecommitdiff
path: root/src/lib/ecore_drm
diff options
context:
space:
mode:
authorJengHyun Kang <jhyuni.kang@samsung.com>2015-12-29 09:03:43 -0500
committerChris Michael <cpmichael@osg.samsung.com>2015-12-29 09:04:16 -0500
commiteb9b894167ea2bf0628f5b93a47e47e5c6d19cfd (patch)
tree47a4ecf48bf43f69a5cd635e2e1b196d1e6fbb69 /src/lib/ecore_drm
parentd05a14671e8d0a0100aa71b853cd36d848c6d05c (diff)
Add a new Ecore_Drm API for setting left-handed mouse
Summary: Add a new Ecore_Drm API named ecore_drm_device_left_handed_set(). Libinput support various input options. Left handed mode is one of options. Right-handed people and left-handed people use a mouse using different button mapping. So if a left handed option is enabled, libinput change right mouse button and left mouse button. So support this option, I added this api using libinput's left handed option. @feature Test Plan: After set left handed mode, left mouse button generate button numbered 3, and right mouse button generate button numbered 1. Reviewers: raster, ManMower, devilhorns Subscribers: ohduna, cedric, jpeg, input.hacker Differential Revision: https://phab.enlightenment.org/D3431
Diffstat (limited to 'src/lib/ecore_drm')
-rw-r--r--src/lib/ecore_drm/Ecore_Drm.h17
-rw-r--r--src/lib/ecore_drm/ecore_drm_device.c34
-rw-r--r--src/lib/ecore_drm/ecore_drm_evdev.c11
3 files changed, 62 insertions, 0 deletions
diff --git a/src/lib/ecore_drm/Ecore_Drm.h b/src/lib/ecore_drm/Ecore_Drm.h
index b7dccce576..1f110efd28 100644
--- a/src/lib/ecore_drm/Ecore_Drm.h
+++ b/src/lib/ecore_drm/Ecore_Drm.h
@@ -129,6 +129,7 @@ struct _Ecore_Drm_Device
129 drmEventContext drm_ctx; 129 drmEventContext drm_ctx;
130 130
131 Eina_Bool active : 1; 131 Eina_Bool active : 1;
132 Eina_Bool left_handed : 1;
132}; 133};
133 134
134struct _Ecore_Drm_Event_Activate 135struct _Ecore_Drm_Event_Activate
@@ -365,6 +366,22 @@ EAPI const char *ecore_drm_device_name_get(Ecore_Drm_Device *dev);
365EAPI Eina_Bool ecore_drm_device_software_setup(Ecore_Drm_Device *dev); 366EAPI Eina_Bool ecore_drm_device_software_setup(Ecore_Drm_Device *dev);
366 367
367/** 368/**
369 * Set a left handed mode at the given Ecore_Drm_Device
370 *
371 * This function will loop all the registered inputs in Ecore_Drm_Device and
372 * set/unset left handed mode.
373 *
374 * @param dev The Ecore_Drm_Device to set left handed mode
375 * @param left_handed The flag of enable/disable left handed mode
376 *
377 * @return EINA_TRUE on success, EINA_FALSE on failure
378 *
379 * @ingroup Ecore_Drm_Device_Group
380 * @since 1.17
381 */
382EAPI Eina_Bool ecore_drm_device_pointer_left_handed_set(Ecore_Drm_Device *dev, Eina_Bool left_handed);
383
384/**
368 * Find an Ecore_Drm_Output at the given coordinates 385 * Find an Ecore_Drm_Output at the given coordinates
369 * 386 *
370 * This function will loop all the existing outputs in Ecore_Drm_Device and 387 * This function will loop all the existing outputs in Ecore_Drm_Device and
diff --git a/src/lib/ecore_drm/ecore_drm_device.c b/src/lib/ecore_drm/ecore_drm_device.c
index 9d0442caa4..f0c0cfe470 100644
--- a/src/lib/ecore_drm/ecore_drm_device.c
+++ b/src/lib/ecore_drm/ecore_drm_device.c
@@ -556,3 +556,37 @@ ecore_drm_device_output_name_find(Ecore_Drm_Device *dev, const char *name)
556 556
557 return NULL; 557 return NULL;
558} 558}
559
560EAPI Eina_Bool
561ecore_drm_device_pointer_left_handed_set(Ecore_Drm_Device *dev, Eina_Bool left_handed)
562{
563 Ecore_Drm_Seat *seat = NULL;
564 Ecore_Drm_Evdev *edev = NULL;
565 Eina_List *l = NULL, *l2 = NULL;
566
567 EINA_SAFETY_ON_NULL_RETURN_VAL(dev, EINA_FALSE);
568 EINA_SAFETY_ON_NULL_RETURN_VAL(dev->seats, EINA_FALSE);
569
570 if (dev->left_handed == left_handed)
571 return EINA_TRUE;
572 dev->left_handed = !!left_handed;
573
574 EINA_LIST_FOREACH(dev->seats, l, seat)
575 {
576 EINA_LIST_FOREACH(seat->devices, l2, edev)
577 {
578 if (libinput_device_has_capability(edev->device,
579 LIBINPUT_DEVICE_CAP_POINTER))
580 {
581 if (libinput_device_config_left_handed_set(edev->device, (int)left_handed) !=
582 LIBINPUT_CONFIG_STATUS_SUCCESS)
583 {
584 WRN("Failed to set left hand mode about device: %s\n",
585 libinput_device_get_name(edev->device));
586 continue;
587 }
588 }
589 }
590 }
591 return EINA_TRUE;
592}
diff --git a/src/lib/ecore_drm/ecore_drm_evdev.c b/src/lib/ecore_drm/ecore_drm_evdev.c
index 1052f98f7c..b40aa43962 100644
--- a/src/lib/ecore_drm/ecore_drm_evdev.c
+++ b/src/lib/ecore_drm/ecore_drm_evdev.c
@@ -651,6 +651,17 @@ _ecore_drm_evdev_device_create(Ecore_Drm_Seat *seat, struct libinput_device *dev
651 651
652 /* TODO: make this configurable */ 652 /* TODO: make this configurable */
653 edev->mouse.threshold = 250; 653 edev->mouse.threshold = 250;
654
655 dev = seat->input->dev;
656 if (dev->left_handed == EINA_TRUE)
657 {
658 if (libinput_device_config_left_handed_set(device, 1) !=
659 LIBINPUT_CONFIG_STATUS_SUCCESS)
660 {
661 WRN("Failed to set left hand mode about device: %s\n",
662 libinput_device_get_name(device));
663 }
664 }
654 } 665 }
655 666
656 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH)) 667 if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))