diff options
author | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-09-20 13:40:31 -0300 |
---|---|---|
committer | Guilherme Iscaro <iscaro@profusion.mobi> | 2016-09-26 18:08:42 -0300 |
commit | 5dac5874fdb2b5bbebe5db5153d48ecd2cf338ac (patch) | |
tree | 566460b2e0a3ebf5729125624c23ad27e985f945 | |
parent | a8ba4c28fbfe51a84bc856b6729e4ec3a1610c80 (diff) | |
download | efl-5dac5874fdb2b5bbebe5db5153d48ecd2cf338ac.tar.gz |
Efl_Input_Device: Implement efl_input_device_parent_set().
This commits moves the parent_set implementation where it should be.
-rw-r--r-- | src/lib/efl/interfaces/efl_input_device.c | 19 | ||||
-rw-r--r-- | src/lib/efl/interfaces/efl_input_device.eo | 4 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_device.c | 17 |
3 files changed, 23 insertions, 17 deletions
diff --git a/src/lib/efl/interfaces/efl_input_device.c b/src/lib/efl/interfaces/efl_input_device.c index 6e51972779..1c79e5bee6 100644 --- a/src/lib/efl/interfaces/efl_input_device.c +++ b/src/lib/efl/interfaces/efl_input_device.c @@ -103,4 +103,23 @@ _efl_input_device_parent_get(Eo *obj EINA_UNUSED, Efl_Input_Device_Data *pd) return pd->parent; } +EOLIAN static void +_efl_input_device_parent_set(Eo *obj, Efl_Input_Device_Data *pd, Efl_Input_Device *parent) +{ + if (pd->parent == parent) return; + if (pd->parent) + { + Efl_Input_Device_Data *p = efl_data_scope_get(pd->parent, EFL_INPUT_DEVICE_CLASS); + p->children = eina_list_remove(p->children, obj); + efl_unref(obj); + } + pd->parent = parent; + if (parent) + { + Efl_Input_Device_Data *p = efl_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS); + p->children = eina_list_append(p->children, obj); + efl_ref(obj); + } +} + #include "interfaces/efl_input_device.eo.c" diff --git a/src/lib/efl/interfaces/efl_input_device.eo b/src/lib/efl/interfaces/efl_input_device.eo index 14f4470ec6..35052cabac 100644 --- a/src/lib/efl/interfaces/efl_input_device.eo +++ b/src/lib/efl/interfaces/efl_input_device.eo @@ -39,7 +39,7 @@ enum Efl.Input.Device.Sub_Class /* This represents Evas_Device */ -/* FIXME: no parent, no children and no Evas */ +/* FIXME: no children and no Evas */ class Efl.Input.Device (Efl.Object) { @@ -75,7 +75,7 @@ class Efl.Input.Device (Efl.Object) } } @property parent { - /* set {} */ + set {} get {} values { parent: Efl.Input.Device; diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c index 228009fa87..6285264d6b 100644 --- a/src/lib/evas/canvas/evas_device.c +++ b/src/lib/evas/canvas/evas_device.c @@ -155,24 +155,11 @@ evas_device_parent_set(Evas_Device *dev, Evas_Device *parent) SAFETY_CHECK(parent, EFL_INPUT_DEVICE_CLASS); } - /* FIXME: move this to Efl.Input.Device */ - if (d->parent == parent) return; - if (d->parent) - { - Efl_Input_Device_Data *p = efl_data_scope_get(d->parent, EFL_INPUT_DEVICE_CLASS); - p->children = eina_list_remove(p->children, dev); - } - else if (parent) - e->devices = eina_list_remove(e->devices, dev); - d->parent = parent; + efl_input_device_parent_set(dev, parent); if (parent) - { - Efl_Input_Device_Data *p = efl_data_scope_get(parent, EFL_INPUT_DEVICE_CLASS); - p->children = eina_list_append(p->children, dev); - } + e->devices = eina_list_remove(e->devices, dev); else e->devices = eina_list_append(e->devices, dev); - evas_event_callback_call(d->evas, EVAS_CALLBACK_DEVICE_CHANGED, dev); } |