summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_collection_view.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/efl_ui_collection_view.c')
-rw-r--r--src/lib/elementary/efl_ui_collection_view.c158
1 files changed, 80 insertions, 78 deletions
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index fa2dd42..dcf8f91 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -57,8 +57,7 @@ struct _Efl_Ui_Collection_Request
57 uint64_t offset; 57 uint64_t offset;
58 uint64_t length; 58 uint64_t length;
59 59
60 Eina_Bool model_requested : 1; 60 Eina_Bool need_size : 1;
61 Eina_Bool model_fetched : 1;
62 Eina_Bool need_entity : 1; 61 Eina_Bool need_entity : 1;
63 Eina_Bool entity_requested : 1; 62 Eina_Bool entity_requested : 1;
64}; 63};
@@ -109,7 +108,7 @@ static const char *COLLECTION_VIEW_MANAGED_YES = "yes";
109#define MY_DATA_GET(obj, pd) \ 108#define MY_DATA_GET(obj, pd) \
110 Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS); 109 Efl_Ui_Collection_View_Data *pd = efl_data_scope_get(obj, MY_CLASS);
111 110
112static void _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request); 111static Eina_Bool _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request);
113static void _idle_cb(void *data, const Efl_Event *event); 112static void _idle_cb(void *data, const Efl_Event *event);
114 113
115static int 114static int
@@ -352,6 +351,7 @@ _request_add(Eina_List *requests, Efl_Ui_Collection_Request **request,
352 if ((*request)->offset + (*request)->length == index) 351 if ((*request)->offset + (*request)->length == index)
353 { 352 {
354 if (need_entity) (*request)->need_entity = EINA_TRUE; 353 if (need_entity) (*request)->need_entity = EINA_TRUE;
354 if (!need_entity) (*request)->need_size = EINA_TRUE;
355 (*request)->length += 1; 355 (*request)->length += 1;
356 return requests; 356 return requests;
357 } 357 }
@@ -364,8 +364,8 @@ _request_add(Eina_List *requests, Efl_Ui_Collection_Request **request,
364 (*request)->offset = index; 364 (*request)->offset = index;
365 (*request)->length = 1; 365 (*request)->length = 1;
366 // At this point, we rely on the model caching ability to avoid recreating model 366 // At this point, we rely on the model caching ability to avoid recreating model
367 (*request)->model_requested = EINA_TRUE;
368 (*request)->need_entity = !!need_entity; 367 (*request)->need_entity = !!need_entity;
368 (*request)->need_size = EINA_TRUE;
369 369
370 return requests; 370 return requests;
371} 371}
@@ -379,7 +379,6 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
379 unsigned int i, len; 379 unsigned int i, len;
380 Eina_Bool request_entity = EINA_FALSE; 380 Eina_Bool request_entity = EINA_FALSE;
381 381
382 request->model_fetched = EINA_TRUE;
383 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) 382 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
384 { 383 {
385 Efl_Ui_Collection_Item_Lookup *insert; 384 Efl_Ui_Collection_Item_Lookup *insert;
@@ -437,7 +436,14 @@ _model_fetched_cb(Eo *obj, void *data, const Eina_Value v)
437 if (request_entity) 436 if (request_entity)
438 { 437 {
439 request->need_entity = EINA_TRUE; 438 request->need_entity = EINA_TRUE;
440 _entity_request(obj, request); 439
440 if (!request->entity_requested)
441 _entity_request(obj, request);
442 }
443 else if (request->need_size)
444 {
445 efl_ui_position_manager_entity_item_size_changed(pd->manager, request->offset,
446 request->offset + len);
441 } 447 }
442 448
443 return v; 449 return v;
@@ -449,12 +455,7 @@ _model_free_cb(Eo *o, void *data, const Eina_Future *dead_future EINA_UNUSED)
449 MY_DATA_GET(o, pd); 455 MY_DATA_GET(o, pd);
450 Efl_Ui_Collection_Request *request = data; 456 Efl_Ui_Collection_Request *request = data;
451 457
452 if (request->need_entity) 458 if (!request->entity_requested)
453 {
454 if (!request->entity_requested)
455 _entity_request(o, request);
456 }
457 else
458 { 459 {
459 pd->requests = eina_list_remove(pd->requests, request); 460 pd->requests = eina_list_remove(pd->requests, request);
460 free(request); 461 free(request);
@@ -519,6 +520,10 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
519 unsigned int i, len; 520 unsigned int i, len;
520 uint64_t updated_size_start_id = 0, updated_entity_start_id = 0; 521 uint64_t updated_size_start_id = 0, updated_entity_start_id = 0;
521 Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE; 522 Eina_Bool updated_size = EINA_FALSE, updated_entity = EINA_FALSE;
523 Evas *e;
524
525 e = evas_object_evas_get(obj);
526 evas_event_freeze(e);
522 527
523 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child) 528 EINA_VALUE_ARRAY_FOREACH(&v, len, i, child)
524 { 529 {
@@ -575,7 +580,6 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
575 } 580 }
576 } 581 }
577#endif 582#endif
578
579 // When requesting an entity, the model should already be in the cache 583 // When requesting an entity, the model should already be in the cache
580 if (!child) continue; 584 if (!child) continue;
581 585
@@ -624,16 +628,19 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
624 search_index - 1); 628 search_index - 1);
625 updated_size = EINA_FALSE; 629 updated_size = EINA_FALSE;
626 } 630 }
627 }} 631 }
628 ; 632 }
633
634 evas_event_thaw(e);
635 evas_event_thaw_eval(e);
629 636
630 // Currently position manager will flush its entire size cache on update, so only do 637 // Currently position manager will flush its entire size cache on update, so only do
631 // it when necessary to improve performance. 638 // it when necessary to improve performance.
632 if (updated_size) 639 if (updated_size || request->need_size)
633 { 640 {
634 efl_ui_position_manager_entity_item_size_changed(pd->manager, 641 efl_ui_position_manager_entity_item_size_changed(pd->manager,
635 updated_size_start_id, 642 updated_size_start_id,
636 i - 1); 643 request->offset + i - 1);
637 updated_size = EINA_FALSE; 644 updated_size = EINA_FALSE;
638 } 645 }
639 646
@@ -642,7 +649,7 @@ _entity_fetched_cb(Eo *obj, void *data, const Eina_Value v)
642 { 649 {
643 efl_ui_position_manager_entity_entities_ready(pd->manager, 650 efl_ui_position_manager_entity_entities_ready(pd->manager,
644 updated_entity_start_id, 651 updated_entity_start_id,
645 i - 1); 652 request->offset + i - 1);
646 653
647 efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); 654 efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj);
648 efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj); 655 efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE, _idle_cb, obj);
@@ -749,10 +756,10 @@ _cache_entity_fetch(Eina_List *requests, Efl_Ui_Collection_Request **request,
749 return requests; 756 return requests;
750} 757}
751 758
752static void 759static Eina_Bool
753_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request) 760_entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request)
754{ 761{
755 if (request->model_requested && (!request->model_fetched)) return; 762 if (request->entity_requested) return EINA_TRUE;
756 request->f = efl_future_then(obj, request->f, 763 request->f = efl_future_then(obj, request->f,
757 .success_type = EINA_VALUE_TYPE_ARRAY, 764 .success_type = EINA_VALUE_TYPE_ARRAY,
758 .success = _entity_fetch_cb); 765 .success = _entity_fetch_cb);
@@ -762,17 +769,20 @@ _entity_request(Efl_Ui_Collection_View *obj, Efl_Ui_Collection_Request *request)
762 .data = request, 769 .data = request,
763 .free = _entity_free_cb); 770 .free = _entity_free_cb);
764 request->entity_requested = EINA_TRUE; 771 request->entity_requested = EINA_TRUE;
772 request->need_entity = EINA_TRUE;
773
774 return EINA_TRUE;
765} 775}
766 776
767static inline void 777static inline Eina_Bool
768_entity_inflight_request(Efl_Ui_Collection_View *obj, 778_entity_inflight_request(Efl_Ui_Collection_View *obj,
769 Efl_Ui_Collection_Request *request, 779 Efl_Ui_Collection_Request *request,
770 Efl_Ui_Collection_Request *inflight) 780 Efl_Ui_Collection_Request *inflight)
771{ 781{
772 if (request->need_entity == EINA_FALSE) return ; 782 inflight->need_size |= request->need_size;
773 if (inflight->entity_requested) return ; 783 if (request->need_entity == EINA_FALSE) return EINA_TRUE;
774 784
775 _entity_request(obj, inflight); 785 return _entity_request(obj, inflight);
776} 786}
777 787
778static Eina_List * 788static Eina_List *
@@ -805,7 +815,7 @@ _batch_request_flush(Eina_List *requests,
805 // request included in current inflight request 815 // request included in current inflight request
806 if (rstart >= istart && rend <= iend) 816 if (rstart >= istart && rend <= iend)
807 { 817 {
808 _entity_inflight_request(obj, request, inflight); 818 if (!_entity_inflight_request(obj, request, inflight)) continue;
809 819
810 // In this case no need to start a request 820 // In this case no need to start a request
811 requests = eina_list_remove_list(requests, ll); 821 requests = eina_list_remove_list(requests, ll);
@@ -817,6 +827,8 @@ _batch_request_flush(Eina_List *requests,
817 // request overflow left and right 827 // request overflow left and right
818 if (rstart < istart && iend < rend) 828 if (rstart < istart && iend < rend)
819 { 829 {
830 if (!_entity_inflight_request(obj, request, inflight)) continue;
831
820 // Remove the center portion of the request by emitting a new one 832 // Remove the center portion of the request by emitting a new one
821 Efl_Ui_Collection_Request *rn; 833 Efl_Ui_Collection_Request *rn;
822 834
@@ -825,30 +837,29 @@ _batch_request_flush(Eina_List *requests,
825 837
826 rn->offset = iend; 838 rn->offset = iend;
827 rn->length = rend - iend; 839 rn->length = rend - iend;
828 rn->model_requested = request->model_requested;
829 rn->need_entity = request->need_entity; 840 rn->need_entity = request->need_entity;
841 rn->need_size = request->need_size;
830 842
831 requests = eina_list_append(requests, rn); 843 requests = eina_list_append(requests, rn);
832 844
833 request->length = istart - rstart; 845 request->length = istart - rstart;
834 _entity_inflight_request(obj, request, inflight);
835 continue; 846 continue;
836 } 847 }
837 848
838 // request overflow left 849 // request overflow left
839 if (rstart < istart && rend > istart && rend <= iend) 850 if (rstart < istart && rend > istart && rend <= iend)
840 { 851 {
852 if (!_entity_inflight_request(obj, request, inflight)) continue;
841 request->length = istart - rstart; 853 request->length = istart - rstart;
842 _entity_inflight_request(obj, request, inflight);
843 continue; 854 continue;
844 } 855 }
845 856
846 // request overflow right 857 // request overflow right
847 if (rstart >= istart && rstart < iend && iend <= rend) 858 if (rstart >= istart && rstart < iend && iend <= rend)
848 { 859 {
860 if (!_entity_inflight_request(obj, request, inflight)) continue;
849 request->offset = iend; 861 request->offset = iend;
850 request->length = rend - iend; 862 request->length = rend - iend;
851 _entity_inflight_request(obj, request, inflight);
852 continue; 863 continue;
853 } 864 }
854 } 865 }
@@ -878,12 +889,6 @@ _batch_request_flush(Eina_List *requests,
878 889
879 // We now have a request, time to trigger a fetch 890 // We now have a request, time to trigger a fetch
880 // We assume here that we are always fetching the model (model_requested must be true) 891 // We assume here that we are always fetching the model (model_requested must be true)
881 if (!request->model_requested)
882 {
883 CRI("Someone forgot to set model_requested for %" PRIu64 " to %" PRIu64 ".",
884 request->offset, request->offset + request->length);
885 request->model_requested = EINA_TRUE;
886 }
887 request->f = efl_model_children_slice_get(model, request->offset, request->length); 892 request->f = efl_model_children_slice_get(model, request->offset, request->length);
888 request->f = efl_future_then(obj, request->f, 893 request->f = efl_future_then(obj, request->f,
889 .success = _model_fetched_cb, 894 .success = _model_fetched_cb,
@@ -892,7 +897,7 @@ _batch_request_flush(Eina_List *requests,
892 897
893 eina_list_move_list(&pd->requests, &requests, ll); 898 eina_list_move_list(&pd->requests, &requests, ll);
894 } 899 }
895 return NULL; 900 return eina_list_free(requests);
896} 901}
897 902
898static Efl_Ui_Position_Manager_Size_Batch_Result 903static Efl_Ui_Position_Manager_Size_Batch_Result
@@ -1054,7 +1059,7 @@ _batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_R
1054 1059
1055 entities = memory.mem; 1060 entities = memory.mem;
1056 //count = efl_model_children_count_get(parent); 1061 //count = efl_model_children_count_get(parent);
1057 limit = range.end_id - range.start_id;; 1062 limit = range.end_id - range.start_id;
1058 1063
1059 // Look in the temporary cache now for the beginning of the buffer 1064 // Look in the temporary cache now for the beginning of the buffer
1060#ifdef VIEWPORT_ENABLE 1065#ifdef VIEWPORT_ENABLE
@@ -1111,7 +1116,6 @@ _batch_entity_cb(void *data, Efl_Ui_Position_Manager_Request_Range range, Eina_R
1111 1116
1112 requests = _cache_entity_fetch(requests, &request, pd, 1117 requests = _cache_entity_fetch(requests, &request, pd,
1113 search_index, &entities[idx]); 1118 search_index, &entities[idx]);
1114
1115 idx++; 1119 idx++;
1116 } 1120 }
1117 // Done, but flush request first 1121 // Done, but flush request first
@@ -1534,7 +1538,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1534 request->offset = lowerlimit_offset; 1538 request->offset = lowerlimit_offset;
1535 // This length work over multiple viewport as they are contiguous 1539 // This length work over multiple viewport as they are contiguous
1536 request->length = lowerlimit_offset - pd->viewport[0]->offset; 1540 request->length = lowerlimit_offset - pd->viewport[0]->offset;
1537 request->model_requested = EINA_TRUE; 1541 request->need_size = EINA_TRUE;
1538 request->need_entity = EINA_TRUE; 1542 request->need_entity = EINA_TRUE;
1539 1543
1540 requests = eina_list_append(requests, request); 1544 requests = eina_list_append(requests, request);
@@ -1551,7 +1555,7 @@ _manager_content_visible_range_changed_cb(void *data, const Efl_Event *ev)
1551 request->offset = upperlimit_offset; 1555 request->offset = upperlimit_offset;
1552 // This length work over multiple viewport as they are contiguous 1556 // This length work over multiple viewport as they are contiguous
1553 request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset; 1557 request->length = pd->viewport[2]->offset + pd->viewport[2]->count - upperlimit_offset;
1554 request->model_requested = EINA_TRUE; 1558 request->need_size = EINA_TRUE;
1555 request->need_entity = EINA_TRUE; 1559 request->need_entity = EINA_TRUE;
1556 1560
1557 requests = eina_list_append(requests, request); 1561 requests = eina_list_append(requests, request);
@@ -1644,6 +1648,7 @@ _efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Dat
1644 { 1648 {
1645 case 1: 1649 case 1:
1646 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, 1650 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager,
1651 efl_provider_find(obj, EFL_UI_WIN_CLASS),
1647 efl_ref(obj), _batch_entity_cb, _unref_cb, 1652 efl_ref(obj), _batch_entity_cb, _unref_cb,
1648 efl_ref(obj), _batch_size_cb, _unref_cb, 1653 efl_ref(obj), _batch_size_cb, _unref_cb,
1649 count); 1654 count);
@@ -1761,7 +1766,7 @@ _efl_model_child_added(void *data, const Efl_Event *event)
1761 if (!request) break; 1766 if (!request) break;
1762 request->offset = ev->index; 1767 request->offset = ev->index;
1763 request->length = 1; 1768 request->length = 1;
1764 request->model_requested = EINA_TRUE; 1769 request->need_size = EINA_TRUE;
1765 request->need_entity = EINA_TRUE; 1770 request->need_entity = EINA_TRUE;
1766 1771
1767 requests = eina_list_append(requests, request); 1772 requests = eina_list_append(requests, request);
@@ -1773,7 +1778,6 @@ _efl_model_child_added(void *data, const Efl_Event *event)
1773 1778
1774 notify_manager: 1779 notify_manager:
1775#endif 1780#endif
1776 // FIXME this function must be called with an entity
1777 efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL); 1781 efl_ui_position_manager_entity_item_added(pd->manager, ev->index, NULL);
1778} 1782}
1779 1783
@@ -1842,7 +1846,7 @@ _efl_model_child_removed(void *data, const Efl_Event *event)
1842 if (!request) break; 1846 if (!request) break;
1843 request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1; 1847 request->offset = pd->viewport[2]->offset + pd->viewport[i]->count - 1;
1844 request->length = 1; 1848 request->length = 1;
1845 request->model_requested = EINA_TRUE; 1849 request->need_size = EINA_TRUE;
1846 request->need_entity = EINA_TRUE; 1850 request->need_entity = EINA_TRUE;
1847 1851
1848 requests = eina_list_append(requests, request); 1852 requests = eina_list_append(requests, request);
@@ -1878,7 +1882,9 @@ static void
1878_efl_ui_collection_view_model_changed(void *data, const Efl_Event *event) 1882_efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1879{ 1883{
1880 Efl_Model_Changed_Event *ev = event->info; 1884 Efl_Model_Changed_Event *ev = event->info;
1885#ifdef VIEWPORT_ENABLE
1881 Eina_List *requests = NULL; 1886 Eina_List *requests = NULL;
1887#endif
1882 MY_DATA_GET(data, pd); 1888 MY_DATA_GET(data, pd);
1883 Eina_Iterator *it; 1889 Eina_Iterator *it;
1884 const char *property; 1890 const char *property;
@@ -1887,24 +1893,21 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1887 Efl_Model *mselect = NULL; 1893 Efl_Model *mselect = NULL;
1888 Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE; 1894 Eina_Bool selection = EINA_FALSE, sizing = EINA_FALSE;
1889 1895
1890 if (ev->previous) efl_event_callback_array_del(ev->previous, model_cbs(), data); 1896 // Cleanup all object, pending request to prepare refetching everything
1891 if (ev->current) efl_event_callback_array_add(ev->current, model_cbs(), data);
1892
1893 // Cleanup all object, pending request and refetch everything
1894 _all_cleanup(data, pd); 1897 _all_cleanup(data, pd);
1895 1898 if (pd->model) efl_event_callback_array_del(pd->model, model_cbs(), data);
1896 efl_replace(&pd->model, NULL); 1899 if (pd->multi_selectable_async_model)
1900 {
1901 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
1902 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1903 data);
1904 efl_composite_detach(data, pd->multi_selectable_async_model);
1905 }
1897 1906
1898 if (!ev->current) 1907 if (!ev->current)
1899 { 1908 {
1900 if (pd->multi_selectable_async_model) 1909 efl_replace(&pd->model, NULL);
1901 { 1910 efl_replace(&pd->multi_selectable_async_model, NULL);
1902 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
1903 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1904 data);
1905 efl_composite_detach(data, pd->multi_selectable_async_model);
1906 efl_replace(&pd->multi_selectable_async_model, NULL);
1907 }
1908 return ; 1911 return ;
1909 } 1912 }
1910 1913
@@ -1926,11 +1929,11 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1926 // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC 1929 // Search the composition of model for the one providing MULTI_SELECTABLE_ASYNC
1927 mselect = ev->current; 1930 mselect = ev->current;
1928 while (mselect && 1931 while (mselect &&
1929 !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE) && 1932 !efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE) &&
1930 efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS)) 1933 efl_isa(mselect, EFL_COMPOSITE_MODEL_CLASS))
1931 mselect = efl_ui_view_model_get(mselect); 1934 mselect = efl_ui_view_model_get(mselect);
1932 1935
1933 if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_ASYNC_INTERFACE)) 1936 if (!efl_isa(mselect, EFL_UI_MULTI_SELECTABLE_INDEX_RANGE_INTERFACE))
1934 { 1937 {
1935 mselect = NULL; 1938 mselect = NULL;
1936 selection = EINA_FALSE; 1939 selection = EINA_FALSE;
@@ -1943,15 +1946,9 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1943 // Build and connect the selection model properly 1946 // Build and connect the selection model properly
1944 if (!mselect) 1947 if (!mselect)
1945 { 1948 {
1946 mselect = model = efl_add(EFL_UI_SELECT_MODEL_CLASS, data, 1949 mselect = model = efl_add_ref(EFL_UI_SELECT_MODEL_CLASS, data,
1947 efl_ui_view_model_set(efl_added, model)); 1950 efl_ui_view_model_set(efl_added, model),
1948 } 1951 efl_loop_model_volatile_make(efl_added));
1949 if (pd->multi_selectable_async_model)
1950 {
1951 efl_event_callback_forwarder_del(pd->multi_selectable_async_model,
1952 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1953 data);
1954 efl_composite_detach(data, pd->multi_selectable_async_model);
1955 } 1952 }
1956 efl_replace(&pd->multi_selectable_async_model, mselect); 1953 efl_replace(&pd->multi_selectable_async_model, mselect);
1957 efl_composite_attach(data, pd->multi_selectable_async_model); 1954 efl_composite_attach(data, pd->multi_selectable_async_model);
@@ -1959,8 +1956,15 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1959 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED, 1956 EFL_UI_SELECTABLE_EVENT_SELECTION_CHANGED,
1960 data); 1957 data);
1961 1958
1962 if (!sizing) model = efl_add(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data, 1959 if (!sizing) model = efl_add_ref(EFL_UI_HOMOGENEOUS_MODEL_CLASS, data,
1963 efl_ui_view_model_set(efl_added, model)); 1960 efl_ui_view_model_set(efl_added, model),
1961 efl_loop_model_volatile_make(efl_added));
1962
1963 efl_replace(&pd->model, model);
1964 efl_event_callback_array_add(pd->model, model_cbs(), data);
1965
1966 if (mselect) efl_unref(mselect);
1967 if (!sizing) efl_unref(model);
1964 1968
1965 count = efl_model_children_count_get(model); 1969 count = efl_model_children_count_get(model);
1966 1970
@@ -1977,27 +1981,25 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1977 1981
1978 request->offset = pd->viewport[i]->offset; 1982 request->offset = pd->viewport[i]->offset;
1979 request->length = pd->viewport[i]->count; 1983 request->length = pd->viewport[i]->count;
1980 request->model_requested = EINA_TRUE; 1984 request->need_size = EINA_TRUE;
1981 request->need_entity = EINA_TRUE; 1985 request->need_entity = EINA_TRUE;
1982 1986
1983 requests = eina_list_append(requests, request); 1987 requests = eina_list_append(requests, request);
1984 } 1988 }
1985#endif
1986 requests = _batch_request_flush(requests, data, pd); 1989 requests = _batch_request_flush(requests, data, pd);
1990#endif
1987 1991
1988 pd->model = model;
1989 efl_ui_position_manager_entity_item_size_changed(pd->manager, 0, count - 1);
1990 switch(efl_ui_position_manager_entity_version(pd->manager, 1)) 1992 switch(efl_ui_position_manager_entity_version(pd->manager, 1))
1991 { 1993 {
1992 case 1: 1994 case 1:
1993 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager, 1995 efl_ui_position_manager_data_access_v1_data_access_set(pd->manager,
1996 efl_provider_find(data, EFL_UI_WIN_CLASS),
1994 efl_ref(data), _batch_entity_cb, _unref_cb, 1997 efl_ref(data), _batch_entity_cb, _unref_cb,
1995 efl_ref(data), _batch_size_cb, _unref_cb, 1998 efl_ref(data), _batch_size_cb, _unref_cb,
1996 count); 1999 count);
1997 break; 2000 break;
1998 } 2001 }
1999 2002 efl_ui_position_manager_entity_item_size_changed(pd->manager, 0, count - 1);
2000
2001} 2003}
2002 2004
2003static void 2005static void
@@ -2309,7 +2311,7 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj,
2309 new_id = efl_ui_position_manager_entity_relative_item(cpd->manager, 2311 new_id = efl_ui_position_manager_entity_relative_item(cpd->manager,
2310 item_id, 2312 item_id,
2311 direction); 2313 direction);
2312 if (new_id == -1) 2314 if (new_id < 0)
2313 { 2315 {
2314 new_item = NULL; 2316 new_item = NULL;
2315 } 2317 }
@@ -2333,7 +2335,7 @@ _efl_ui_collection_view_focus_manager_efl_ui_focus_manager_request_move(Eo *obj,
2333 _assert_item_available(new_item, new_id, cpd); 2335 _assert_item_available(new_item, new_id, cpd);
2334 } 2336 }
2335#else 2337#else
2336 uint64_t search_index = new_id; 2338 uint64_t search_index = (uint64_t)new_id;
2337 lookup = (void*) eina_rbtree_inline_lookup(cpd->cache, &search_index, 2339 lookup = (void*) eina_rbtree_inline_lookup(cpd->cache, &search_index,
2338 sizeof (new_id), _cache_tree_lookup, 2340 sizeof (new_id), _cache_tree_lookup,
2339 NULL); 2341 NULL);