summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Levin <avi.levin@samsung.com>2015-04-28 14:26:17 +0300
committerAvi Levin <avi.levin@samsung.com>2015-06-29 16:56:13 +0300
commitc3ed861878de07ccae07ddd03805aa42ecccd44f (patch)
tree9fd4e4016cbd5191a9131cefe41bf87665b01c1d
parentd4e4820b030c1f1239f2ad3fbe4a8c287d9c3e4a (diff)
elm_box: porting evas smart callbacks to eo
Replacing calls of evas_object_smart_callback_add/del/call with eo_callback_add/del/call. This will reduce the use of legacy events and callbacks lists in smart_object which in turn will improve performance and reduce memory use.
-rw-r--r--src/lib/elm_box.c58
1 files changed, 31 insertions, 27 deletions
diff --git a/src/lib/elm_box.c b/src/lib/elm_box.c
index 42a6f33e2..f89989fb2 100644
--- a/src/lib/elm_box.c
+++ b/src/lib/elm_box.c
@@ -28,24 +28,26 @@ _elm_box_list_data_get(const Eina_List *list)
28 return opt->obj; 28 return opt->obj;
29} 29}
30 30
31static void 31static Eina_Bool
32_child_added_cb_proxy(void *data, 32_child_added_cb_proxy(void *data,
33 Evas_Object *o EINA_UNUSED, 33 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
34 void *event_info)
35{ 34{
36 Evas_Object *box = data; 35 Evas_Object *box = data;
37 Evas_Object_Box_Option *opt = event_info; 36 Evas_Object_Box_Option *opt = event_info;
38 evas_object_smart_callback_call(box, SIG_CHILD_ADDED, opt->obj); 37 eo_do(box, eo_event_callback_call(ELM_BOX_EVENT_CHILD_ADDED, opt->obj));
38
39 return EINA_TRUE;
39} 40}
40 41
41static void 42static Eina_Bool
42_child_removed_cb_proxy(void *data, 43_child_removed_cb_proxy(void *data,
43 Evas_Object *o EINA_UNUSED, 44 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
44 void *event_info)
45{ 45{
46 Evas_Object *box = data; 46 Evas_Object *box = data;
47 Evas_Object *child = event_info; 47 Evas_Object *child = event_info;
48 evas_object_smart_callback_call(box, SIG_CHILD_REMOVED, child); 48 eo_do(box, eo_event_callback_call(ELM_BOX_EVENT_CHILD_REMOVED, child));
49
50 return EINA_TRUE;
49} 51}
50 52
51EOLIAN static Eina_Bool 53EOLIAN static Eina_Bool
@@ -192,27 +194,27 @@ _transition_animation(void *data)
192 return ECORE_CALLBACK_RENEW; 194 return ECORE_CALLBACK_RENEW;
193} 195}
194 196
195static void 197static Eina_Bool
196_transition_layout_child_added(void *data, 198_transition_layout_child_added(void *data,
197 Evas_Object *obj EINA_UNUSED, 199 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
198 void *event_info)
199{ 200{
200 Transition_Animation_Data *tad; 201 Transition_Animation_Data *tad;
201 Evas_Object_Box_Option *opt = event_info; 202 Evas_Object_Box_Option *opt = event_info;
202 Elm_Box_Transition *layout_data = data; 203 Elm_Box_Transition *layout_data = data;
203 204
204 tad = calloc(1, sizeof(Transition_Animation_Data)); 205 tad = calloc(1, sizeof(Transition_Animation_Data));
205 if (!tad) return; 206 if (!tad) return EINA_TRUE;
206 207
207 tad->obj = opt->obj; 208 tad->obj = opt->obj;
208 layout_data->objs = eina_list_append(layout_data->objs, tad); 209 layout_data->objs = eina_list_append(layout_data->objs, tad);
209 layout_data->recalculate = EINA_TRUE; 210 layout_data->recalculate = EINA_TRUE;
211
212 return EINA_TRUE;
210} 213}
211 214
212static void 215static Eina_Bool
213_transition_layout_child_removed(void *data, 216_transition_layout_child_removed(void *data,
214 Evas_Object *obj EINA_UNUSED, 217 Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info)
215 void *event_info)
216{ 218{
217 Eina_List *l; 219 Eina_List *l;
218 Transition_Animation_Data *tad; 220 Transition_Animation_Data *tad;
@@ -228,6 +230,8 @@ _transition_layout_child_removed(void *data,
228 break; 230 break;
229 } 231 }
230 } 232 }
233
234 return EINA_TRUE;
231} 235}
232 236
233static void 237static void
@@ -319,10 +323,10 @@ _transition_layout_animation_start(Evas_Object *obj,
319 evas_object_event_callback_add 323 evas_object_event_callback_add
320 (obj, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb, 324 (obj, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb,
321 layout_data); 325 layout_data);
322 evas_object_smart_callback_add 326 eo_do(obj, eo_event_callback_add
323 (obj, SIG_CHILD_ADDED, _transition_layout_child_added, layout_data); 327 (ELM_BOX_EVENT_CHILD_ADDED, _transition_layout_child_added, layout_data));
324 evas_object_smart_callback_add 328 eo_do(obj, eo_event_callback_add
325 (obj, SIG_CHILD_REMOVED, _transition_layout_child_removed, layout_data); 329 (ELM_BOX_EVENT_CHILD_REMOVED, _transition_layout_child_removed, layout_data));
326 330
327 if (!layout_data->animator) 331 if (!layout_data->animator)
328 layout_data->animator = ecore_animator_add(transition_animation_cb, obj); 332 layout_data->animator = ecore_animator_add(transition_animation_cb, obj);
@@ -387,10 +391,10 @@ _elm_box_evas_object_smart_add(Eo *obj, Elm_Box_Data *_pd EINA_UNUSED)
387 eo_do_super(obj, MY_CLASS, evas_obj_smart_add()); 391 eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
388 elm_widget_sub_object_parent_add(obj); 392 elm_widget_sub_object_parent_add(obj);
389 393
390 evas_object_smart_callback_add(wd->resize_obj, SIG_CHILD_ADDED, 394 eo_do(wd->resize_obj, eo_event_callback_add
391 _child_added_cb_proxy, obj); 395 (ELM_BOX_EVENT_CHILD_ADDED, _child_added_cb_proxy, obj));
392 evas_object_smart_callback_add(wd->resize_obj, SIG_CHILD_REMOVED, 396 eo_do(wd->resize_obj, eo_event_callback_add
393 _child_removed_cb_proxy, obj); 397 (ELM_BOX_EVENT_CHILD_REMOVED, _child_removed_cb_proxy, obj));
394 398
395 elm_widget_can_focus_set(obj, EINA_FALSE); 399 elm_widget_can_focus_set(obj, EINA_FALSE);
396 elm_widget_highlight_ignore_set(obj, EINA_TRUE); 400 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
@@ -642,10 +646,10 @@ elm_box_transition_free(void *data)
642 646
643 evas_object_event_callback_del 647 evas_object_event_callback_del
644 (box_data->box, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb); 648 (box_data->box, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb);
645 evas_object_smart_callback_del 649 eo_do(box_data->box, eo_event_callback_del(
646 (box_data->box, SIG_CHILD_ADDED, _transition_layout_child_added); 650 ELM_BOX_EVENT_CHILD_ADDED, _transition_layout_child_added, box_data));
647 evas_object_smart_callback_del 651 eo_do(box_data->box, eo_event_callback_del(
648 (box_data->box, SIG_CHILD_REMOVED, _transition_layout_child_removed); 652 ELM_BOX_EVENT_CHILD_REMOVED, _transition_layout_child_removed, box_data));
649 ecore_animator_del(box_data->animator); 653 ecore_animator_del(box_data->animator);
650 654
651 free(data); 655 free(data);