summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-05-18 11:36:55 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-05-19 13:17:31 -0400
commitd47197e65b59406e0f25c5a4db56e68da61bec30 (patch)
tree5bf3a646f14643aa49f69bad2d5f8fe4d5ec74e3
parent771d8803dddfda2bd161821c217e7e8f3d56fd47 (diff)
downloadefl-d47197e65b59406e0f25c5a4db56e68da61bec30.tar.gz
evas: add evas_device_get_by_seat_id()
sometimes it may be more useful to find a device by its hw id @feature
-rw-r--r--src/lib/evas/Evas_Common.h14
-rw-r--r--src/lib/evas/canvas/evas_device.c23
2 files changed, 37 insertions, 0 deletions
diff --git a/src/lib/evas/Evas_Common.h b/src/lib/evas/Evas_Common.h
index c7928aac4f..2cccabf107 100644
--- a/src/lib/evas/Evas_Common.h
+++ b/src/lib/evas/Evas_Common.h
@@ -1022,6 +1022,20 @@ EAPI const Eina_List *evas_device_list(Evas *e, const Evas_Device *dev);
EAPI Evas_Device *evas_device_get(Evas *e, const char *name);
/**
+ * Get a device by its seat id
+ *
+ * @param e The canvas to find the device on
+ * @param id The seat id of the device.
+ *
+ * Gets the device with id @p id on Evas @p e list of devices.
+ *
+ * @return the device or NULL if no device with a matching id was found.
+ *
+ * @since 1.20
+ */
+EAPI Evas_Device *evas_device_get_by_seat_id(Evas *eo_e, unsigned int id);
+
+/**
* Set the name of a device as a string
*
* @p dev The device to set the name of
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index 3d63a4c7c1..2e7763aa1c 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -122,6 +122,29 @@ evas_device_get(Evas *eo_e, const char *name)
}
EAPI Evas_Device *
+evas_device_get_by_seat_id(Evas *eo_e, unsigned int id)
+{
+ unsigned int seat_id;
+ Evas_Public_Data *e;
+ Evas_Device *dev;
+ Eina_List *l;
+
+ SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
+
+ e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
+
+ EINA_LIST_FOREACH(e->devices, l, dev)
+ {
+ seat_id = efl_input_device_seat_id_get(dev);
+
+ if (seat_id == id)
+ return dev;
+ }
+
+ return NULL;
+}
+
+EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
return evas_device_add_full(eo_e, NULL, NULL, NULL, NULL,