summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-29 09:30:37 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-29 12:29:04 -0400
commitea9399f12aaa0f94e180c21e7f7720b6d805b703 (patch)
treeb1a6538792519b305959a7cc8d1042242b1fffd0
parent87e589a6b9fb70620afca81d9e4f80b749f083de (diff)
elm/genlist: unify all creation of calc jobs, skip if genlist is dead
Summary: there is no need to recalculate any genlist attributes if the genlist is dead @fix Depends on D8992 Reviewers: cedric, bu5hm4n Reviewed By: cedric, bu5hm4n Subscribers: bu5hm4n, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8993
-rw-r--r--src/lib/elementary/elm_genlist.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/src/lib/elementary/elm_genlist.c b/src/lib/elementary/elm_genlist.c
index ed0c585b18..fdd526e107 100644
--- a/src/lib/elementary/elm_genlist.c
+++ b/src/lib/elementary/elm_genlist.c
@@ -184,6 +184,14 @@ static const Elm_Action key_actions[] = {
184 {NULL, NULL} 184 {NULL, NULL}
185}; 185};
186 186
187static inline void
188_add_calc_job(Elm_Genlist_Data *sd)
189{
190 ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
191 if (!efl_alive_get(sd->obj)) return;
192 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
193}
194
187static void 195static void
188_size_cache_free(void *data) 196_size_cache_free(void *data)
189{ 197{
@@ -321,14 +329,13 @@ _elm_genlist_pan_efl_gfx_entity_size_set(Eo *obj, Elm_Genlist_Pan_Data *psd, Ein
321 } 329 }
322 sd->pan_changed = EINA_TRUE; 330 sd->pan_changed = EINA_TRUE;
323 evas_object_smart_changed(obj); 331 evas_object_smart_changed(obj);
324 ecore_job_del(sd->calc_job);
325 // if the width changed we may have to resize content if scrollbar went 332 // if the width changed we may have to resize content if scrollbar went
326 // away or appeared to queue a job to deal with it. it should settle in 333 // away or appeared to queue a job to deal with it. it should settle in
327 // the end to a steady-state 334 // the end to a steady-state
328 if (old.w != size.w) 335 if (old.w != size.w)
329 sd->calc_job = ecore_job_add(_calc_job, psd->wobj); 336 _add_calc_job(sd);
330 else 337 else
331 sd->calc_job = NULL; 338 ELM_SAFE_FREE(sd->calc_job, ecore_job_del);
332 339
333super: 340super:
334 efl_gfx_entity_size_set(efl_super(obj, MY_PAN_CLASS), size); 341 efl_gfx_entity_size_set(efl_super(obj, MY_PAN_CLASS), size);
@@ -779,8 +786,7 @@ _must_recalc_idler(void *data)
779{ 786{
780 ELM_GENLIST_DATA_GET(data, sd); 787 ELM_GENLIST_DATA_GET(data, sd);
781 788
782 ecore_job_del(sd->calc_job); 789 _add_calc_job(sd);
783 sd->calc_job = ecore_job_add(_calc_job, data);
784 sd->must_recalc_idler = NULL; 790 sd->must_recalc_idler = NULL;
785 return ECORE_CALLBACK_CANCEL; 791 return ECORE_CALLBACK_CANCEL;
786} 792}
@@ -953,8 +959,7 @@ _elm_genlist_elm_layout_sizing_eval(Eo *obj, Elm_Genlist_Data *sd)
953 { 959 {
954 itb->must_recalc = EINA_TRUE; 960 itb->must_recalc = EINA_TRUE;
955 } 961 }
956 ecore_job_del(sd->calc_job); 962 _add_calc_job(sd);
957 sd->calc_job = ecore_job_add(_calc_job, obj);
958 } 963 }
959 minw = vmw; 964 minw = vmw;
960 minh = vmh; 965 minh = vmh;
@@ -3561,8 +3566,8 @@ _elm_genlist_efl_ui_widget_theme_apply(Eo *obj, Elm_Genlist_Data *sd)
3561 3566
3562 itb->changed = EINA_TRUE; 3567 itb->changed = EINA_TRUE;
3563 } 3568 }
3564 ecore_job_del(sd->calc_job); 3569 if (sd->obj)
3565 sd->calc_job = ecore_job_add(_calc_job, obj); 3570 _add_calc_job(sd);
3566 elm_layout_sizing_eval(obj); 3571 elm_layout_sizing_eval(obj);
3567 evas_event_thaw(e); 3572 evas_event_thaw(e);
3568 evas_event_thaw_eval(e); 3573 evas_event_thaw_eval(e);
@@ -3684,8 +3689,7 @@ _item_block_del(Elm_Gen_Item *it)
3684 itb->items = eina_list_remove(itb->items, it); 3689 itb->items = eina_list_remove(itb->items, it);
3685 itb->count--; 3690 itb->count--;
3686 itb->changed = EINA_TRUE; 3691 itb->changed = EINA_TRUE;
3687 ecore_job_del(sd->calc_job); 3692 _add_calc_job(sd);
3688 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
3689 if (itb->count < 1) 3693 if (itb->count < 1)
3690 { 3694 {
3691 Item_Block *itbn; 3695 Item_Block *itbn;
@@ -3833,8 +3837,7 @@ _elm_genlist_item_del_serious(Elm_Gen_Item *it)
3833 sd->group_items = eina_list_remove(sd->group_items, it); 3837 sd->group_items = eina_list_remove(sd->group_items, it);
3834 3838
3835 ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free); 3839 ELM_SAFE_FREE(sd->state, eina_inlist_sorted_state_free);
3836 ecore_job_del(sd->calc_job); 3840 _add_calc_job(sd);
3837 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
3838 3841
3839 ELM_SAFE_FREE(it->item, free); 3842 ELM_SAFE_FREE(it->item, free);
3840} 3843}
@@ -4036,8 +4039,7 @@ _item_mouse_move_cb(void *data,
4036 else 4039 else
4037 _item_position(it, VIEW(it), it->item->scrl_x, y_pos); 4040 _item_position(it, VIEW(it), it->item->scrl_x, y_pos);
4038 4041
4039 ecore_job_del(sd->calc_job); 4042 _add_calc_job(sd);
4040 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
4041 } 4043 }
4042 return; 4044 return;
4043 } 4045 }
@@ -4641,8 +4643,7 @@ newblock:
4641 itb->count++; 4643 itb->count++;
4642 itb->changed = EINA_TRUE; 4644 itb->changed = EINA_TRUE;
4643 it->item->block = itb; 4645 it->item->block = itb;
4644 ecore_job_del(itb->sd->calc_job); 4646 _add_calc_job(itb->sd);
4645 itb->sd->calc_job = ecore_job_add(_calc_job, itb->sd->obj);
4646 4647
4647 if (itb->count > itb->sd->max_items_per_block) 4648 if (itb->count > itb->sd->max_items_per_block)
4648 { 4649 {
@@ -4884,8 +4885,7 @@ _item_idle_enterer(void *data)
4884 if (wakeup) 4885 if (wakeup)
4885 { 4886 {
4886 // wake up mainloop 4887 // wake up mainloop
4887 ecore_job_del(sd->calc_job); 4888 _add_calc_job(sd);
4888 sd->calc_job = ecore_job_add(_calc_job, data);
4889 } 4889 }
4890 if (ok == ECORE_CALLBACK_CANCEL) sd->queue_idle_enterer = NULL; 4890 if (ok == ECORE_CALLBACK_CANCEL) sd->queue_idle_enterer = NULL;
4891 4891
@@ -5130,8 +5130,7 @@ _item_mouse_up_cb(void *data,
5130 } 5130 }
5131 else 5131 else
5132 { 5132 {
5133 ecore_job_del(sd->calc_job); 5133 _add_calc_job(sd);
5134 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
5135 } 5134 }
5136 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_DISABLED, "elm"); 5135 edje_object_signal_emit(VIEW(it), SIGNAL_REORDER_DISABLED, "elm");
5137 if (_elm_config->atspi_mode) 5136 if (_elm_config->atspi_mode)
@@ -5521,8 +5520,7 @@ _update_job(void *data)
5521 } 5520 }
5522 if (position) 5521 if (position)
5523 { 5522 {
5524 ecore_job_del(sd->calc_job); 5523 _add_calc_job(sd);
5525 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
5526 } 5524 }
5527 evas_event_thaw(e); 5525 evas_event_thaw(e);
5528 evas_event_thaw_eval(e); 5526 evas_event_thaw_eval(e);
@@ -7277,8 +7275,7 @@ _elm_genlist_item_coordinates_calc(Elm_Gen_Item *it,
7277 sd->scroll_to_type = type; 7275 sd->scroll_to_type = type;
7278 it->item->show_me = EINA_TRUE; 7276 it->item->show_me = EINA_TRUE;
7279 7277
7280 ecore_job_del(sd->calc_job); 7278 _add_calc_job(sd);
7281 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
7282 7279
7283 return EINA_FALSE; 7280 return EINA_FALSE;
7284 } 7281 }
@@ -7887,8 +7884,7 @@ _item_filtered_get(Elm_Gen_Item *it)
7887 _filter_item_internal(it); 7884 _filter_item_internal(it);
7888 if (it->item->block) 7885 if (it->item->block)
7889 it->item->block->changed = EINA_TRUE; 7886 it->item->block->changed = EINA_TRUE;
7890 ELM_SAFE_FREE(sd->calc_job, ecore_job_del); 7887 _add_calc_job(sd);
7891 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
7892 } 7888 }
7893 if (!it->hide) return EINA_TRUE; 7889 if (!it->hide) return EINA_TRUE;
7894 return EINA_FALSE; 7890 return EINA_FALSE;
@@ -7947,8 +7943,7 @@ _item_filter_enterer(void *data)
7947 if (wakeup) 7943 if (wakeup)
7948 { 7944 {
7949 // wake up mainloop 7945 // wake up mainloop
7950 ELM_SAFE_FREE(sd->calc_job, ecore_job_del); 7946 _add_calc_job(sd);
7951 sd->calc_job = ecore_job_add(_calc_job, data);
7952 } 7947 }
7953 if (ok == ECORE_CALLBACK_CANCEL) 7948 if (ok == ECORE_CALLBACK_CANCEL)
7954 { 7949 {
@@ -8254,8 +8249,7 @@ _elm_genlist_decorate_mode_set(Eo *obj, Elm_Genlist_Data *sd, Eina_Bool decorate
8254 } 8249 }
8255 } 8250 }
8256 8251
8257 ecore_job_del(sd->calc_job); 8252 _add_calc_job(sd);
8258 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
8259} 8253}
8260 8254
8261EOLIAN static void 8255EOLIAN static void
@@ -8401,8 +8395,7 @@ _flip_job(void *data)
8401 8395
8402 it->flipped = EINA_TRUE; 8396 it->flipped = EINA_TRUE;
8403 it->item->nocache = EINA_TRUE; 8397 it->item->nocache = EINA_TRUE;
8404 ecore_job_del(sd->calc_job); 8398 _add_calc_job(sd);
8405 sd->calc_job = ecore_job_add(_calc_job, sd->obj);
8406} 8399}
8407 8400
8408EOLIAN static void 8401EOLIAN static void