aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_device.c
diff options
context:
space:
mode:
authorBruno Dilly <bdilly@profusion.mobi>2016-11-17 16:50:44 -0200
committerBruno Dilly <bdilly@profusion.mobi>2016-12-19 14:58:35 -0200
commit2958aba23a8dc99503fad8119eeffef82e410b42 (patch)
tree63628c818c4a2ef2be40b207d44a9a490a39e6f6 /src/lib/evas/canvas/evas_device.c
parentbuild: enable -Wfloat-equal for compiling (diff)
downloadefl-2958aba23a8dc99503fad8119eeffef82e410b42.tar.gz
evas: add getter for devices by name
Make it possible to get the evas device given its name. It sounds useful for Edje since programs will reference seats by name.
Diffstat (limited to 'src/lib/evas/canvas/evas_device.c')
-rw-r--r--src/lib/evas/canvas/evas_device.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index 4ab6d1532a..9a65d792fd 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -95,6 +95,32 @@ _del_cb(void *data, const Efl_Event *ev)
}
EAPI Evas_Device *
+evas_device_get(Evas *eo_e, const char *name)
+{
+ const char *dev_name;
+ Evas_Public_Data *e;
+ Evas_Device *dev;
+ Eina_List *l;
+
+ SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
+
+ if (!name)
+ return NULL;
+
+ e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
+
+ EINA_LIST_FOREACH(e->devices, l, dev)
+ {
+ dev_name = efl_input_device_name_get(dev);
+
+ if (eina_streq(dev_name, name))
+ return dev;
+ }
+
+ return NULL;
+}
+
+EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
return evas_device_add_full(eo_e, NULL, NULL, NULL, NULL,