aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/evas/canvas/evas_device.c
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2016-09-20 13:44:23 -0300
committerBruno Dilly <bdilly@profusion.mobi>2016-09-26 22:06:59 -0300
commit8acb509fbacbc99e190b0dc74719c2860989ce74 (patch)
treecc34c1cd9bdc213d5862efa9e6d043b61d957a02 /src/lib/evas/canvas/evas_device.c
parentEvas_Common: Fix typo. (diff)
downloadefl-8acb509fbacbc99e190b0dc74719c2860989ce74.tar.gz
Evas_Device: Add evas_device_full_add() API.
This will make it simpler to add a Evas_Device with its fields already set.
Diffstat (limited to 'src/lib/evas/canvas/evas_device.c')
-rw-r--r--src/lib/evas/canvas/evas_device.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index 6285264d6b..7fc8272340 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -36,19 +36,36 @@ _del_cb(void *data, const Efl_Event *ev)
EAPI Evas_Device *
evas_device_add(Evas *eo_e)
{
+ return evas_device_full_add(eo_e, NULL, NULL, NULL, NULL,
+ EVAS_DEVICE_CLASS_NONE,
+ EVAS_DEVICE_SUBCLASS_NONE);
+}
+
+EAPI Evas_Device *
+evas_device_full_add(Evas *eo_e, const char *name, const char *desc,
+ Evas_Device *parent_dev, Evas_Device *emulation_dev,
+ Evas_Device_Class clas, Evas_Device_Subclass sub_clas)
+{
Efl_Input_Device_Data *d;
Evas_Public_Data *e;
Evas_Device *dev;
SAFETY_CHECK(eo_e, EVAS_CANVAS_CLASS, NULL);
- dev = efl_add(EFL_INPUT_DEVICE_CLASS, eo_e);
+ dev = efl_add(EFL_INPUT_DEVICE_CLASS, eo_e,
+ efl_input_device_name_set(efl_added, name),
+ efl_input_device_description_set(efl_added, desc),
+ efl_input_device_type_set(efl_added, clas),
+ efl_input_device_subtype_set(efl_added, sub_clas),
+ efl_input_device_source_set(efl_added, emulation_dev),
+ efl_input_device_parent_set(efl_added, parent_dev));
d = efl_data_scope_get(dev, EFL_INPUT_DEVICE_CLASS);
d->evas = eo_e;
e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
- e->devices = eina_list_append(e->devices, dev);
+ if (!parent_dev)
+ e->devices = eina_list_append(e->devices, dev);
efl_event_callback_add(dev, EFL_EVENT_DEL, _del_cb, e);
evas_event_callback_call(eo_e, EVAS_CALLBACK_DEVICE_CHANGED, dev);