summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-01-28 17:07:34 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-02-01 14:21:27 -0800
commitfe04fffaba32f9c4b91628be71c9230ffd4de007 (patch)
treedded5c33a24d0755847710bda7e9ec3bc4a94d3a
parentd39d0761bf000b2590420adc7082a7956772a41c (diff)
genlist: switch to efl.core.animator tick.
-rw-r--r--src/lib/elm_genlist.c78
-rw-r--r--src/lib/elm_widget_genlist.h3
2 files changed, 51 insertions, 30 deletions
diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c
index 538e95491..914bb1ca0 100644
--- a/src/lib/elm_genlist.c
+++ b/src/lib/elm_genlist.c
@@ -160,6 +160,9 @@ static void _decorate_item_set(Elm_Gen_Item *);
160static void _internal_elm_genlist_clear(Evas_Object *obj); 160static void _internal_elm_genlist_clear(Evas_Object *obj);
161static Eina_Bool _item_filtered_get(Elm_Gen_Item *it); 161static Eina_Bool _item_filtered_get(Elm_Gen_Item *it);
162 162
163static void _elm_genlist_tree_effect_stop(Elm_Genlist_Data *sd);
164static Eina_Bool _elm_genlist_tree_effect_setup(Elm_Genlist_Data *sd);
165
163static const Elm_Action key_actions[] = { 166static const Elm_Action key_actions[] = {
164 {"move", _key_action_move}, 167 {"move", _key_action_move},
165 {"select", _key_action_select}, 168 {"select", _key_action_select},
@@ -1142,7 +1145,7 @@ _item_tree_effect_finish(Elm_Genlist_Data *sd)
1142 (ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED, NULL)); 1145 (ELM_GENLIST_EVENT_TREE_EFFECT_FINISHED, NULL));
1143 evas_object_smart_changed(sd->pan_obj); 1146 evas_object_smart_changed(sd->pan_obj);
1144 1147
1145 sd->tree_effect_animator = NULL; 1148 _elm_genlist_tree_effect_stop(sd);
1146} 1149}
1147 1150
1148static void 1151static void
@@ -1974,7 +1977,10 @@ _item_realize(Elm_Gen_Item *it,
1974} 1977}
1975 1978
1976static Eina_Bool 1979static Eina_Bool
1977_tree_effect_animator_cb(void *data) 1980_tree_effect_animator_cb(void *data,
1981 Eo *obj EINA_UNUSED,
1982 const Eo_Event_Description *desc EINA_UNUSED,
1983 void *event_info EINA_UNUSED)
1978{ 1984{
1979 int in = 0; 1985 int in = 0;
1980 const Eina_List *l; 1986 const Eina_List *l;
@@ -2127,10 +2133,10 @@ _tree_effect_animator_cb(void *data)
2127 if (end) 2133 if (end)
2128 { 2134 {
2129 _item_tree_effect_finish(sd); 2135 _item_tree_effect_finish(sd);
2130 return ECORE_CALLBACK_CANCEL; 2136 _elm_genlist_tree_effect_stop(sd);
2131 } 2137 }
2132 2138
2133 return ECORE_CALLBACK_RENEW; 2139 return EO_CALLBACK_CONTINUE;
2134} 2140}
2135 2141
2136static void 2142static void
@@ -2386,6 +2392,37 @@ _item_block_realize(Item_Block *itb)
2386 itb->want_unrealize = EINA_FALSE; 2392 itb->want_unrealize = EINA_FALSE;
2387} 2393}
2388 2394
2395static Eina_Bool
2396_elm_genlist_tree_effect_setup(Elm_Genlist_Data *sd)
2397{
2398 if (!sd->tree_effect_animator)
2399 {
2400 Eina_Bool r;
2401
2402 _item_tree_effect_before(sd->expanded_item);
2403 evas_object_raise(sd->event_block_rect);
2404 evas_object_stack_below(sd->event_block_rect, sd->stack[1]);
2405 evas_object_show(sd->event_block_rect);
2406 sd->start_time = ecore_time_get();
2407 eo_do(sd->obj,
2408 r = eo_event_callback_add(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _tree_effect_animator_cb, sd->obj));
2409 sd->tree_effect_animator = 1;
2410 return EINA_TRUE;
2411 }
2412 return EINA_FALSE;
2413}
2414
2415static void
2416_elm_genlist_tree_effect_stop(Elm_Genlist_Data *sd)
2417{
2418 if (sd->tree_effect_animator)
2419 {
2420 sd->tree_effect_animator = 0;
2421 eo_do(sd->obj,
2422 eo_event_callback_del(EFL_CORE_ANIMATOR_EVENT_ANIMATOR_TICK, _tree_effect_animator_cb, sd->obj));
2423 }
2424}
2425
2389EOLIAN static void 2426EOLIAN static void
2390_elm_genlist_pan_evas_object_smart_calculate(Eo *obj, Elm_Genlist_Pan_Data *psd) 2427_elm_genlist_pan_evas_object_smart_calculate(Eo *obj, Elm_Genlist_Pan_Data *psd)
2391{ 2428{
@@ -2414,16 +2451,7 @@ _elm_genlist_pan_evas_object_smart_calculate(Eo *obj, Elm_Genlist_Pan_Data *psd)
2414 if (sd->tree_effect_enabled && 2451 if (sd->tree_effect_enabled &&
2415 (sd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE)) 2452 (sd->move_effect_mode != ELM_GENLIST_TREE_EFFECT_NONE))
2416 { 2453 {
2417 if (!sd->tree_effect_animator) 2454 _elm_genlist_tree_effect_setup(sd);
2418 {
2419 _item_tree_effect_before(sd->expanded_item);
2420 evas_object_raise(sd->event_block_rect);
2421 evas_object_stack_below(sd->event_block_rect, sd->stack[1]);
2422 evas_object_show(sd->event_block_rect);
2423 sd->start_time = ecore_time_get();
2424 sd->tree_effect_animator =
2425 ecore_animator_add(_tree_effect_animator_cb, sd->obj);
2426 }
2427 } 2455 }
2428 2456
2429 EINA_INLIST_FOREACH(sd->blocks, itb) 2457 EINA_INLIST_FOREACH(sd->blocks, itb)
@@ -3693,7 +3721,7 @@ _item_del(Elm_Gen_Item *it)
3693 if (sd->tree_effect_animator) 3721 if (sd->tree_effect_animator)
3694 { 3722 {
3695 _item_tree_effect_finish(sd); 3723 _item_tree_effect_finish(sd);
3696 ELM_SAFE_FREE(sd->tree_effect_animator, ecore_animator_del); 3724 _elm_genlist_tree_effect_stop(sd);
3697 } 3725 }
3698 sd->expanded_item = NULL; 3726 sd->expanded_item = NULL;
3699 sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; 3727 sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE;
@@ -5570,7 +5598,8 @@ _elm_genlist_evas_object_smart_del(Eo *obj, Elm_Genlist_Data *sd)
5570 ecore_idler_del(sd->must_recalc_idler); 5598 ecore_idler_del(sd->must_recalc_idler);
5571 ecore_timer_del(sd->multi_timer); 5599 ecore_timer_del(sd->multi_timer);
5572 eina_stringshare_del(sd->decorate_it_type); 5600 eina_stringshare_del(sd->decorate_it_type);
5573 ecore_animator_del(sd->tree_effect_animator); 5601
5602 _elm_genlist_tree_effect_stop(sd);
5574 5603
5575 eo_do_super(obj, MY_CLASS, evas_obj_smart_del()); 5604 eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
5576} 5605}
@@ -5713,11 +5742,12 @@ _internal_elm_genlist_clear(Evas_Object *obj)
5713 elm_layout_sizing_eval(sd->obj); 5742 elm_layout_sizing_eval(sd->obj);
5714 eo_do(obj, elm_interface_scrollable_content_region_show(0, 0, 0, 0)); 5743 eo_do(obj, elm_interface_scrollable_content_region_show(0, 0, 0, 0));
5715 5744
5745 _elm_genlist_tree_effect_stop(sd);
5746
5716 ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del); 5747 ELM_SAFE_FREE(sd->multi_timer, ecore_timer_del);
5717 ELM_SAFE_FREE(sd->update_job, ecore_job_del); 5748 ELM_SAFE_FREE(sd->update_job, ecore_job_del);
5718 ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del); 5749 ELM_SAFE_FREE(sd->queue_idle_enterer, ecore_idle_enterer_del);
5719 ELM_SAFE_FREE(sd->must_recalc_idler, ecore_idler_del); 5750 ELM_SAFE_FREE(sd->must_recalc_idler, ecore_idler_del);
5720 ELM_SAFE_FREE(sd->tree_effect_animator, ecore_animator_del);
5721 ELM_SAFE_FREE(sd->event_block_rect, evas_object_del); 5751 ELM_SAFE_FREE(sd->event_block_rect, evas_object_del);
5722 ELM_SAFE_FREE(sd->scr_hold_timer, ecore_timer_del); 5752 ELM_SAFE_FREE(sd->scr_hold_timer, ecore_timer_del);
5723 ELM_SAFE_FREE(sd->queue, eina_list_free); 5753 ELM_SAFE_FREE(sd->queue, eina_list_free);
@@ -6643,17 +6673,7 @@ _elm_genlist_item_subitems_clear(Eo *eo_item EINA_UNUSED, Elm_Gen_Item *it)
6643 _item_sub_items_clear(it); 6673 _item_sub_items_clear(it);
6644 else 6674 else
6645 { 6675 {
6646 if (!sd->tree_effect_animator) 6676 if (!_elm_genlist_tree_effect_setup(sd))
6647 {
6648 sd->expanded_item = it;
6649 _item_tree_effect_before(it);
6650 evas_object_stack_below(sd->event_block_rect, sd->stack[1]);
6651 evas_object_show(sd->event_block_rect);
6652 sd->start_time = ecore_time_get();
6653 sd->tree_effect_animator =
6654 ecore_animator_add(_tree_effect_animator_cb, sd->obj);
6655 }
6656 else
6657 _item_sub_items_clear(it); 6677 _item_sub_items_clear(it);
6658 } 6678 }
6659} 6679}
@@ -7769,7 +7789,7 @@ _elm_genlist_decorate_mode_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Bool decorate
7769 // and user can check whether decorate_all_mode_ is enabled. 7789 // and user can check whether decorate_all_mode_ is enabled.
7770 sd->decorate_all_mode = decorated; 7790 sd->decorate_all_mode = decorated;
7771 7791
7772 ELM_SAFE_FREE(sd->tree_effect_animator, ecore_animator_del); 7792 _elm_genlist_tree_effect_stop(sd);
7773 sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE; 7793 sd->move_effect_mode = ELM_GENLIST_TREE_EFFECT_NONE;
7774 7794
7775 list = elm_genlist_realized_items_get(obj); 7795 list = elm_genlist_realized_items_get(obj);
diff --git a/src/lib/elm_widget_genlist.h b/src/lib/elm_widget_genlist.h
index 27f9271b9..8107e20ef 100644
--- a/src/lib/elm_widget_genlist.h
+++ b/src/lib/elm_widget_genlist.h
@@ -137,7 +137,6 @@ struct _Elm_Genlist_Data
137 Eina_List *move_items; /* items move for 137 Eina_List *move_items; /* items move for
138 * tree effect */ 138 * tree effect */
139 Elm_Gen_Item *expanded_next_item; 139 Elm_Gen_Item *expanded_next_item;
140 Ecore_Animator *tree_effect_animator;
141 Elm_Genlist_Item_Move_Effect_Mode move_effect_mode; 140 Elm_Genlist_Item_Move_Effect_Mode move_effect_mode;
142 int reorder_fast; 141 int reorder_fast;
143 142
@@ -199,6 +198,8 @@ struct _Elm_Genlist_Data
199 /**< value whether item loop feature is enabled or not. */ 198 /**< value whether item loop feature is enabled or not. */
200 Eina_Bool item_loop_enable : 1; 199 Eina_Bool item_loop_enable : 1;
201 Eina_Bool item_looping_on : 1; 200 Eina_Bool item_looping_on : 1;
201
202 Eina_Bool tree_effect_animator : 1;
202}; 203};
203 204
204typedef struct _Item_Block Item_Block; 205typedef struct _Item_Block Item_Block;