From cdc5ecec1e5ee37d4de57f20a627ceba7d39ceca Mon Sep 17 00:00:00 2001 From: Guilherme Iscaro Date: Tue, 20 Sep 2016 13:40:31 -0300 Subject: [PATCH] Efl_Input_Device: Implement efl_input_device_parent_set(). This commits moves the parent_set implementation where it should be. --- src/lib/efl/interfaces/efl_input_device.c | 19 +++++++++++++++++++ src/lib/efl/interfaces/efl_input_device.eo | 4 ++-- 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 6e51972..1c79e5b 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 14f4470..35052ca 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 228009f..6285264 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); } -- 2.7.4