aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-01-31 13:02:53 -0500
committerChris Michael <cp.michael@samsung.com>2017-02-07 09:37:47 -0500
commit42bb77a848a5da1d98a300cb9a95133d0f3849c3 (patch)
tree55863715fa99465b32871c99736c08ce4b0eceda
parentcmake: add ecore_x (diff)
downloadefl-42bb77a848a5da1d98a300cb9a95133d0f3849c3.tar.gz
elput: Add API function to return device capabilities
Small patch to add an API function that can return a given input devices capabilities (pointer, keyboard, touch, etc). This patch also exposes the Device_Capability enum to the public. @feature Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r--src/lib/elput/Elput.h19
-rw-r--r--src/lib/elput/elput_evdev.c18
-rw-r--r--src/lib/elput/elput_input.c18
-rw-r--r--src/lib/elput/elput_private.h7
4 files changed, 41 insertions, 21 deletions
diff --git a/src/lib/elput/Elput.h b/src/lib/elput/Elput.h
index 378912eb90..f6d95f1ded 100644
--- a/src/lib/elput/Elput.h
+++ b/src/lib/elput/Elput.h
@@ -84,6 +84,13 @@ typedef enum _Elput_Device_Change_Type
ELPUT_DEVICE_REMOVED,
} Elput_Device_Change_Type;
+typedef enum _Elput_Device_Capability
+{
+ ELPUT_SEAT_POINTER = (1 << 0),
+ ELPUT_SEAT_KEYBOARD = (1 << 1),
+ ELPUT_SEAT_TOUCH = (1 << 2)
+} Elput_Device_Capability;
+
/* structure to represent event for device being added or removed */
typedef struct _Elput_Event_Device_Change
{
@@ -429,6 +436,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);
/**
+ * Return the capabilities of a given device
+ *
+ * @param device
+ *
+ * @return integer representing device capabilities or 0 on failure
+ *
+ * @ingroup Elput_Input_Group
+ * @since 1.19
+ */
+EAPI Elput_Device_Capability elput_input_device_capabilities_get(Elput_Device *device);
+
+/**
* Set the pointer acceleration profile
*
* @param manager
diff --git a/src/lib/elput/elput_evdev.c b/src/lib/elput/elput_evdev.c
index 9580f49909..1f02391eac 100644
--- a/src/lib/elput/elput_evdev.c
+++ b/src/lib/elput/elput_evdev.c
@@ -1264,25 +1264,25 @@ _evdev_device_create(Elput_Seat *seat, struct libinput_device *device)
(libinput_device_keyboard_has_key(device, KEY_ENTER)))
{
_keyboard_init(seat, seat->manager->cached.keymap);
- edev->caps |= EVDEV_SEAT_KEYBOARD;
+ edev->caps |= ELPUT_SEAT_KEYBOARD;
}
if ((libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER) &&
(libinput_device_pointer_has_button(device, BTN_LEFT))))
{
_pointer_init(seat);
- edev->caps |= EVDEV_SEAT_POINTER;
+ edev->caps |= ELPUT_SEAT_POINTER;
}
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TOUCH))
{
_touch_init(seat);
- edev->caps |= EVDEV_SEAT_TOUCH;
+ edev->caps |= ELPUT_SEAT_TOUCH;
}
- if (!((edev->caps & EVDEV_SEAT_KEYBOARD) ||
- (edev->caps & EVDEV_SEAT_POINTER) ||
- (edev->caps & EVDEV_SEAT_TOUCH)))
+ if (!((edev->caps & ELPUT_SEAT_KEYBOARD) ||
+ (edev->caps & ELPUT_SEAT_POINTER) ||
+ (edev->caps & ELPUT_SEAT_TOUCH)))
goto err;
libinput_device_set_user_data(device, edev);
@@ -1313,11 +1313,11 @@ _evdev_device_destroy(Elput_Device *edev)
{
if (!edev) return;
- if (edev->caps & EVDEV_SEAT_POINTER)
+ if (edev->caps & ELPUT_SEAT_POINTER)
_pointer_release(edev->seat);
- if (edev->caps & EVDEV_SEAT_KEYBOARD)
+ if (edev->caps & ELPUT_SEAT_KEYBOARD)
_keyboard_release(edev->seat);
- if (edev->caps & EVDEV_SEAT_TOUCH)
+ if (edev->caps & ELPUT_SEAT_TOUCH)
_touch_release(edev->seat);
libinput_device_unref(edev->device);
diff --git a/src/lib/elput/elput_input.c b/src/lib/elput/elput_input.c
index c854fc9a63..2028323c0e 100644
--- a/src/lib/elput/elput_input.c
+++ b/src/lib/elput/elput_input.c
@@ -182,11 +182,11 @@ _device_add(Elput_Manager *em, struct libinput_device *dev)
eseat->devices = eina_list_append(eseat->devices, edev);
DBG("Input Device Added: %s", libinput_device_get_name(dev));
- if (edev->caps & EVDEV_SEAT_KEYBOARD)
+ if (edev->caps & ELPUT_SEAT_KEYBOARD)
DBG("\tDevice added as Keyboard device");
- if (edev->caps & EVDEV_SEAT_POINTER)
+ if (edev->caps & ELPUT_SEAT_POINTER)
DBG("\tDevice added as Pointer device");
- if (edev->caps & EVDEV_SEAT_TOUCH)
+ if (edev->caps & ELPUT_SEAT_TOUCH)
DBG("\tDevice added as Touch device");
_device_event_send(edev, ELPUT_DEVICE_ADDED);
@@ -577,7 +577,7 @@ elput_input_key_remap_enable(Elput_Manager *manager, Eina_Bool enable)
{
EINA_LIST_FOREACH(eseat->devices, ll, edev)
{
- if (!(edev->caps & EVDEV_SEAT_KEYBOARD)) continue;
+ if (!(edev->caps & ELPUT_SEAT_KEYBOARD)) continue;
edev->key_remap = enable;
if ((!enable) && (edev->key_remap_hash))
@@ -608,7 +608,7 @@ elput_input_key_remap_set(Elput_Manager *manager, int *from_keys, int *to_keys,
{
EINA_LIST_FOREACH(eseat->devices, ll, edev)
{
- if (!(edev->caps & EVDEV_SEAT_KEYBOARD)) continue;
+ if (!(edev->caps & ELPUT_SEAT_KEYBOARD)) continue;
if (!edev->key_remap) continue;
if (!edev->key_remap_hash)
@@ -691,3 +691,11 @@ elput_input_pointer_accel_profile_set(Elput_Manager *manager, const char *seat,
}
}
}
+
+EAPI Elput_Device_Capability
+elput_input_device_capabilities_get(Elput_Device *device)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(device, 0);
+
+ return device->caps;
+}
diff --git a/src/lib/elput/elput_private.h b/src/lib/elput/elput_private.h
index 51c6f0ab07..a33f31bf61 100644
--- a/src/lib/elput/elput_private.h
+++ b/src/lib/elput/elput_private.h
@@ -59,13 +59,6 @@ extern int _elput_log_dom;
# endif
# define CRIT(...) EINA_LOG_DOM_CRIT(_elput_log_dom, __VA_ARGS__)
-typedef enum _Elput_Device_Capability
-{
- EVDEV_SEAT_POINTER = (1 << 0),
- EVDEV_SEAT_KEYBOARD = (1 << 1),
- EVDEV_SEAT_TOUCH = (1 << 2)
-} Elput_Device_Capability;
-
typedef struct _Elput_Interface
{
Eina_Bool (*connect)(Elput_Manager **manager, const char *seat, unsigned int tty);