summaryrefslogtreecommitdiff
path: root/src/lib/elementary/efl_ui_position_manager_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/elementary/efl_ui_position_manager_list.c')
-rw-r--r--src/lib/elementary/efl_ui_position_manager_list.c60
1 files changed, 41 insertions, 19 deletions
diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c
index d22d42c..3980e12 100644
--- a/src/lib/elementary/efl_ui_position_manager_list.c
+++ b/src/lib/elementary/efl_ui_position_manager_list.c
@@ -14,18 +14,25 @@
14 Efl_Ui_Position_Manager_List_Data *pd = efl_data_scope_get(obj, MY_CLASS); 14 Efl_Ui_Position_Manager_List_Data *pd = efl_data_scope_get(obj, MY_CLASS);
15 15
16typedef struct { 16typedef struct {
17 unsigned int size; 17 Api_Callbacks callbacks;
18
18 Eina_Future *rebuild_absolut_size; 19 Eina_Future *rebuild_absolut_size;
20 int *size_cache;
21 Efl_Gfx_Entity *last_group;
22 Efl_Ui_Win *window;
23 Evas *canvas;
24
25 Vis_Segment prev_run;
26
19 Eina_Rect viewport; 27 Eina_Rect viewport;
20 Eina_Size2D abs_size; 28 Eina_Size2D abs_size;
21 Eina_Vector2 scroll_position; 29 Eina_Vector2 scroll_position;
30
22 Efl_Ui_Layout_Orientation dir; 31 Efl_Ui_Layout_Orientation dir;
23 int *size_cache; 32
33 unsigned int size;
24 int average_item_size; 34 int average_item_size;
25 int maximum_min_size; 35 int maximum_min_size;
26 Vis_Segment prev_run;
27 Efl_Gfx_Entity *last_group;
28 Api_Callbacks callbacks;
29} Efl_Ui_Position_Manager_List_Data; 36} Efl_Ui_Position_Manager_List_Data;
30 37
31/* 38/*
@@ -193,6 +200,8 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
193 else 200 else
194 geom.x -= (relevant_space_size - cache_access(obj, pd, new.start_id)); 201 geom.x -= (relevant_space_size - cache_access(obj, pd, new.start_id));
195 202
203 evas_event_freeze(pd->canvas);
204
196 for (i = new.start_id; i < new.end_id; ++i) 205 for (i = new.start_id; i < new.end_id; ++i)
197 { 206 {
198 Eina_Size2D size; 207 Eina_Size2D size;
@@ -291,6 +300,9 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
291 300
292 efl_gfx_entity_position_set(first_group, first_group_pos); 301 efl_gfx_entity_position_set(first_group, first_group_pos);
293 efl_gfx_entity_size_set(first_group, first_group_size); 302 efl_gfx_entity_size_set(first_group, first_group_size);
303
304 evas_event_thaw(pd->canvas);
305 evas_event_thaw_eval(pd->canvas);
294} 306}
295 307
296 308
@@ -339,18 +351,23 @@ position_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
339} 351}
340 352
341static Eina_Value 353static Eina_Value
342_rebuild_job_cb(void *data, Eina_Value v EINA_UNUSED, const Eina_Future *f EINA_UNUSED) 354_rebuild_job_cb(Eo *obj, void *data, const Eina_Value v)
343{ 355{
344 MY_DATA_GET(data, pd); 356 Efl_Ui_Position_Manager_List_Data *pd = data;
345 357
346 if (!efl_alive_get(data)) return EINA_VALUE_EMPTY; 358 cache_require(obj, pd);
359 recalc_absolut_size(obj, pd);
360 position_content(obj, pd);
347 361
348 cache_require(data, pd); 362 return v;
349 recalc_absolut_size(data, pd); 363}
350 position_content(data, pd); 364
351 pd->rebuild_absolut_size = NULL; 365static void
366_rebuild_job_free(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
367{
368 Efl_Ui_Position_Manager_List_Data *pd = data;
352 369
353 return EINA_VALUE_EMPTY; 370 pd->rebuild_absolut_size = NULL;
354} 371}
355 372
356static void 373static void
@@ -358,8 +375,10 @@ schedule_recalc_absolut_size(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd)
358{ 375{
359 if (pd->rebuild_absolut_size) return; 376 if (pd->rebuild_absolut_size) return;
360 377
361 pd->rebuild_absolut_size = efl_loop_job(efl_app_main_get()); 378 pd->rebuild_absolut_size = efl_future_then(obj, efl_loop_job(efl_app_main_get()),
362 eina_future_then(pd->rebuild_absolut_size, _rebuild_job_cb, obj); 379 .success = _rebuild_job_cb,
380 .data = pd,
381 .free = _rebuild_job_free);
363} 382}
364 383
365EOLIAN static void 384EOLIAN static void
@@ -386,7 +405,7 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_scroll_position_set
386} 405}
387 406
388EOLIAN static void 407EOLIAN static void
389_efl_ui_position_manager_list_efl_ui_position_manager_entity_item_added(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, int added_index EINA_UNUSED, Efl_Gfx_Entity *subobj) 408_efl_ui_position_manager_list_efl_ui_position_manager_entity_item_added(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, int added_index EINA_UNUSED, Efl_Gfx_Entity *subobj)
390{ 409{
391 if (pd->size == 0) 410 if (pd->size == 0)
392 { 411 {
@@ -403,7 +422,7 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_item_added(Eo *obj
403} 422}
404 423
405EOLIAN static void 424EOLIAN static void
406_efl_ui_position_manager_list_efl_ui_position_manager_entity_item_removed(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, int removed_index EINA_UNUSED, Efl_Gfx_Entity *subobj) 425_efl_ui_position_manager_list_efl_ui_position_manager_entity_item_removed(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, int removed_index EINA_UNUSED, Efl_Gfx_Entity *subobj)
407{ 426{
408 pd->size --; 427 pd->size --;
409 if (subobj) 428 if (subobj)
@@ -496,7 +515,7 @@ _efl_ui_position_manager_list_efl_object_invalidate(Eo *obj, Efl_Ui_Position_Man
496 if (pd->rebuild_absolut_size) 515 if (pd->rebuild_absolut_size)
497 eina_future_cancel(pd->rebuild_absolut_size); 516 eina_future_cancel(pd->rebuild_absolut_size);
498 517
499 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, 0); 518 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0);
500 519
501 efl_invalidate(efl_super(obj, MY_CLASS)); 520 efl_invalidate(efl_super(obj, MY_CLASS));
502} 521}
@@ -535,7 +554,7 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_version(Eo *obj EIN
535} 554}
536 555
537EOLIAN static void 556EOLIAN static void
538_efl_ui_position_manager_list_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size) 557_efl_ui_position_manager_list_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_List_Data *pd, Efl_Ui_Win *canvas, void *obj_access_data, Efl_Ui_Position_Manager_Object_Batch_Callback obj_access, Eina_Free_Cb obj_access_free_cb, void *size_access_data, Efl_Ui_Position_Manager_Size_Batch_Callback size_access, Eina_Free_Cb size_access_free_cb, int size)
539{ 558{
540 // Cleanup cache first 559 // Cleanup cache first
541 cache_invalidate(obj, pd); 560 cache_invalidate(obj, pd);
@@ -547,6 +566,9 @@ _efl_ui_position_manager_list_efl_ui_position_manager_data_access_v1_data_access
547 pd->callbacks.size.free_cb(pd->callbacks.size.data); 566 pd->callbacks.size.free_cb(pd->callbacks.size.data);
548 567
549 // Set them 568 // Set them
569 efl_replace(&pd->window, canvas);
570 efl_replace(&pd->canvas, canvas ? evas_object_evas_get(canvas) : NULL);
571
550 pd->callbacks.object.data = obj_access_data; 572 pd->callbacks.object.data = obj_access_data;
551 pd->callbacks.object.access = obj_access; 573 pd->callbacks.object.access = obj_access;
552 pd->callbacks.object.free_cb = obj_access_free_cb; 574 pd->callbacks.object.free_cb = obj_access_free_cb;