summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-09-06 12:31:22 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-09-06 12:31:22 -0400
commit486f1e31fad8161055889feb029901e7dc6cead3 (patch)
tree6601a8ac301a072f39cbaffde520d5cc2117c78c
parenta9db26e077902b3eb7830a85a8e6f66fb5e3c371 (diff)
completely freeze collectionview items to prevent recalcsdevs/zmike/cv
collectionview item layouts no longer recalc. ever.
-rw-r--r--src/lib/elementary/efl_ui_collection_view.c39
-rw-r--r--src/lib/elementary/efl_ui_widget.c14
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c9
3 files changed, 47 insertions, 15 deletions
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index 48dfbd2e20..e768c45023 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -85,6 +85,7 @@ struct _Efl_Ui_Collection_View_Data
85 } match_content; 85 } match_content;
86 86
87 Efl_Ui_Position_Manager_Request_Range current_range, running_range; 87 Efl_Ui_Position_Manager_Request_Range current_range, running_range;
88 Eina_Bool model_has_size : 1;
88}; 89};
89 90
90struct _Efl_Ui_Collection_View_Focus_Manager_Data 91struct _Efl_Ui_Collection_View_Focus_Manager_Data
@@ -136,6 +137,7 @@ _item_cleanup(Efl_Ui_Factory *factory, Efl_Ui_Collection_Item *item)
136 137
137 efl_ui_view_model_set(entity, NULL); 138 efl_ui_view_model_set(entity, NULL);
138 efl_replace(&item->entity, NULL); 139 efl_replace(&item->entity, NULL);
140 efl_event_thaw(entity);
139 efl_ui_factory_release(factory, entity); 141 efl_ui_factory_release(factory, entity);
140} 142}
141 143
@@ -311,7 +313,12 @@ if (!index)
311 pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL); 313 pd->cache = eina_rbtree_inline_insert(pd->cache, EINA_RBTREE_GET(insert), _cache_tree_cmp, NULL);
312 printf("INSERTING %lu\n", insert->index); 314 printf("INSERTING %lu\n", insert->index);
313 } 315 }
316 {
317 Eina_Value prop;
314 318
319 prop = eina_value_bool_init(pd->model_has_size);
320 efl_model_property_set(child, "avoid_recalc", &prop);
321 }
315 } 322 }
316 323
317 return v; 324 return v;
@@ -352,13 +359,6 @@ _entity_fetch_cb(Eo *obj, void *data EINA_UNUSED, const Eina_Value v)
352 } 359 }
353 360
354 r = efl_ui_view_factory_create_with_event(pd->factory, eina_array_iterator_new(&tmp), obj); 361 r = efl_ui_view_factory_create_with_event(pd->factory, eina_array_iterator_new(&tmp), obj);
355 if ((!pd->last_base.w) && (!pd->last_base.h))
356 {
357 efl_canvas_group_calculate(r);
358 pd->last_base = efl_gfx_hint_size_combined_min_get(r);
359 }
360 else
361 efl_canvas_group_need_recalculate_set(r, 0);
362 362
363 eina_array_flush(&tmp); 363 eina_array_flush(&tmp);
364 364
@@ -419,6 +419,16 @@ printf("ENTITY FETCHED %d -> %d\n", request->offset, request->length);
419 /* fix eventing in scroller by ensuring collection items are in the scroller hierarchy */ 419 /* fix eventing in scroller by ensuring collection items are in the scroller hierarchy */
420 efl_canvas_group_member_add(pd->pan, child); 420 efl_canvas_group_member_add(pd->pan, child);
421 efl_gfx_entity_visible_set(child, EINA_FALSE); 421 efl_gfx_entity_visible_set(child, EINA_FALSE);
422 if ((!pd->last_base.w) && (!pd->last_base.h))
423 {
424 efl_canvas_group_calculate(child);
425 pd->last_base = efl_gfx_hint_size_combined_min_get(child);
426 }
427 else
428 {
429 efl_event_freeze(child);
430 efl_canvas_group_need_recalculate_set(child, 0);
431 }
422 if (request->offset + i == 0) 432 if (request->offset + i == 0)
423 { 433 {
424 printf("NEW0 %p\n", child); 434 printf("NEW0 %p\n", child);
@@ -484,6 +494,7 @@ if (!pd->viewport[v]->items[index].model)
484 494
485 if (!lookup) 495 if (!lookup)
486 { 496 {
497 efl_event_thaw(child);
487 efl_ui_factory_release(pd->factory, child); 498 efl_ui_factory_release(pd->factory, child);
488 continue; 499 continue;
489 } 500 }
@@ -559,11 +570,11 @@ _cache_size_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
559 model = lookup->item.model; 570 model = lookup->item.model;
560 571
561 // If we do not know the size 572 // If we do not know the size
562 if (!ITEM_SIZE_FROM_MODEL(model, item_size)) 573 if (!ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size))
563 { 574 {
564 item_size = efl_gfx_hint_size_combined_min_get(lookup->item.entity); 575 ITEM_SIZE_FROM_MODEL(model, item_size);
565 if (item_size.h == 0 && item_size.w == 0) 576 if (item_size.h == 0 && item_size.w == 0)
566 ITEM_BASE_SIZE_FROM_MODEL(pd->model, item_size); 577 item_size = efl_gfx_hint_size_combined_min_get(lookup->item.entity);
567 else 578 else
568 _size_to_model(model, item_size); 579 _size_to_model(model, item_size);
569 } 580 }
@@ -782,7 +793,6 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
782 Efl_Ui_Position_Manager_Size_Batch_Result result = {0}; 793 Efl_Ui_Position_Manager_Size_Batch_Result result = {0};
783 Efl_Model *parent; 794 Efl_Model *parent;
784 Eina_List *requests = NULL; 795 Eina_List *requests = NULL;
785 Eina_Size2D item_base;
786 unsigned int limit; 796 unsigned int limit;
787 unsigned int idx = 0; 797 unsigned int idx = 0;
788 798
@@ -890,7 +900,7 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
890 { 900 {
891 sizes[idx].depth_leader = EINA_FALSE; 901 sizes[idx].depth_leader = EINA_FALSE;
892 sizes[idx].element_depth = 0; 902 sizes[idx].element_depth = 0;
893 sizes[idx].size = item_base; 903 sizes[idx].size = pd->last_base;
894 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT"); 904 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT");
895 idx++; 905 idx++;
896 } 906 }
@@ -902,7 +912,7 @@ _batch_size_cb(void *data, Efl_Ui_Position_Manager_Size_Call_Config conf, Eina_R
902 uint64_t search_index = conf.range.start_id + idx; 912 uint64_t search_index = conf.range.start_id + idx;
903 // printf("%lu LINE %d\n", search_index, __LINE__); 913 // printf("%lu LINE %d\n", search_index, __LINE__);
904 requests = _cache_size_fetch(requests, &request, pd, 914 requests = _cache_size_fetch(requests, &request, pd,
905 search_index, &sizes[idx], item_base); 915 search_index, &sizes[idx], pd->last_base);
906 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT"); 916 if (!sizes[idx].size.w || !sizes[idx].size.h) ERR("NULL SIZE ENT");
907 idx++; 917 idx++;
908 } 918 }
@@ -1692,6 +1702,7 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1692 efl_del(pd->model); 1702 efl_del(pd->model);
1693 pd->model = NULL; 1703 pd->model = NULL;
1694 last_base = pd->last_base; 1704 last_base = pd->last_base;
1705 pd->model_has_size = EINA_FALSE;
1695 pd->last_base = EINA_SIZE2D(0, 0); 1706 pd->last_base = EINA_SIZE2D(0, 0);
1696 1707
1697 if (!ev->current) return ; 1708 if (!ev->current) return ;
@@ -1738,7 +1749,7 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1738 1749
1739 requests = eina_list_append(requests, request); 1750 requests = eina_list_append(requests, request);
1740 }*/ 1751 }*/
1741 ITEM_BASE_SIZE_FROM_MODEL(model, pd->last_base); 1752 pd->model_has_size = ITEM_BASE_SIZE_FROM_MODEL(model, pd->last_base);
1742 requests = _batch_request_flush(requests, data, pd); 1753 requests = _batch_request_flush(requests, data, pd);
1743 1754
1744 pd->model = model; 1755 pd->model = model;
diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c
index 997d7819b9..660f22a6e1 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -6058,7 +6058,19 @@ _efl_ui_widget_efl_ui_view_model_set(Eo *obj,
6058 if (ev.current == pd->properties.model) 6058 if (ev.current == pd->properties.model)
6059 efl_event_callback_call(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, &ev); 6059 efl_event_callback_call(obj, EFL_UI_VIEW_EVENT_MODEL_CHANGED, &ev);
6060 6060
6061 if (pd->properties.model) _efl_ui_widget_model_update(obj, pd); 6061 if (pd->properties.model)
6062 {
6063 Eina_Value *value;
6064 _efl_ui_widget_model_update(obj, pd);
6065 value = efl_model_property_get(pd->properties.model, "avoid_recalc");
6066 if (eina_value_type_get(value) != EINA_VALUE_TYPE_ERROR)
6067 {
6068 Eina_Bool avoid_recalc;
6069
6070 if (eina_value_bool_convert(value, &avoid_recalc) && avoid_recalc)
6071 efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
6072 }
6073 }
6062 6074
6063 efl_unref(ev.current); 6075 efl_unref(ev.current);
6064 efl_unref(ev.previous); 6076 efl_unref(ev.previous);
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index aed2ceb6a6..b34101ebbd 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -135,11 +135,20 @@ _efl_ui_widget_create(const Efl_Ui_Factory *factory,
135 Efl_Model *model) 135 Efl_Model *model)
136{ 136{
137 Efl_Ui_Widget *w; 137 Efl_Ui_Widget *w;
138 Eina_Value *value;
138 139
139 w = efl_add(klass, parent, 140 w = efl_add(klass, parent,
140 efl_ui_view_model_set(efl_added, model), 141 efl_ui_view_model_set(efl_added, model),
141 efl_ui_factory_constructing(factory, efl_added)); 142 efl_ui_factory_constructing(factory, efl_added));
142 efl_ui_factory_building(factory, w); 143 efl_ui_factory_building(factory, w);
144 value = efl_model_property_get(model, "avoid_recalc");
145 if (eina_value_type_get(value) != EINA_VALUE_TYPE_ERROR)
146 {
147 Eina_Bool avoid_recalc;
148
149 if (eina_value_bool_convert(value, &avoid_recalc) && avoid_recalc)
150 efl_canvas_group_need_recalculate_set(w, EINA_FALSE);
151 }
143 return w; 152 return w;
144} 153}
145 154