summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-11-15 11:05:36 -0800
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-11 11:12:01 +0100
commit2b324779c996b38f9514c6e6f29c23b1ac6e2b28 (patch)
treeb70313c7bfc3fb7040fce9f3b5e7453513368811
parentd62e2585bb7f5661470bf694ee26eef9192ef06b (diff)
elementary: reduce events triggered by Efl.Ui.PositionManager.
Reviewed-by: SangHyeon Jade Lee <sh10233.lee@samsung.com> Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D10687
-rw-r--r--src/lib/elementary/efl_ui_collection.c1
-rw-r--r--src/lib/elementary/efl_ui_collection_view.c2
-rw-r--r--src/lib/elementary/efl_ui_position_manager_data_access_v1.eo1
-rw-r--r--src/lib/elementary/efl_ui_position_manager_grid.c9
-rw-r--r--src/lib/elementary/efl_ui_position_manager_list.c14
-rw-r--r--src/tests/elementary/efl_ui_test_position_manager_common.c1
6 files changed, 24 insertions, 4 deletions
diff --git a/src/lib/elementary/efl_ui_collection.c b/src/lib/elementary/efl_ui_collection.c
index 3e54f79..43b1b19 100644
--- a/src/lib/elementary/efl_ui_collection.c
+++ b/src/lib/elementary/efl_ui_collection.c
@@ -961,6 +961,7 @@ _efl_ui_collection_position_manager_set(Eo *obj, Efl_Ui_Collection_Data *pd, Efl
961 { 961 {
962 case 1: 962 case 1:
963 efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man, 963 efl_ui_position_manager_data_access_v1_data_access_set(pd->pos_man,
964 efl_provider_find(obj, EFL_UI_WIN_CLASS),
964 &pd->obj_accessor, _obj_accessor_get_at, NULL, 965 &pd->obj_accessor, _obj_accessor_get_at, NULL,
965 &pd->size_accessor, _size_accessor_get_at, NULL, 966 &pd->size_accessor, _size_accessor_get_at, NULL,
966 eina_list_count(pd->items)); 967 eina_list_count(pd->items));
diff --git a/src/lib/elementary/efl_ui_collection_view.c b/src/lib/elementary/efl_ui_collection_view.c
index 14122c5..dcf8f91 100644
--- a/src/lib/elementary/efl_ui_collection_view.c
+++ b/src/lib/elementary/efl_ui_collection_view.c
@@ -1648,6 +1648,7 @@ _efl_ui_collection_view_position_manager_set(Eo *obj, Efl_Ui_Collection_View_Dat
1648 { 1648 {
1649 case 1: 1649 case 1:
1650 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),
1651 efl_ref(obj), _batch_entity_cb, _unref_cb, 1652 efl_ref(obj), _batch_entity_cb, _unref_cb,
1652 efl_ref(obj), _batch_size_cb, _unref_cb, 1653 efl_ref(obj), _batch_size_cb, _unref_cb,
1653 count); 1654 count);
@@ -1992,6 +1993,7 @@ _efl_ui_collection_view_model_changed(void *data, const Efl_Event *event)
1992 { 1993 {
1993 case 1: 1994 case 1:
1994 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),
1995 efl_ref(data), _batch_entity_cb, _unref_cb, 1997 efl_ref(data), _batch_entity_cb, _unref_cb,
1996 efl_ref(data), _batch_size_cb, _unref_cb, 1998 efl_ref(data), _batch_size_cb, _unref_cb,
1997 count); 1999 count);
diff --git a/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo b/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo
index ab55c09..d7d42c4 100644
--- a/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo
+++ b/src/lib/elementary/efl_ui_position_manager_data_access_v1.eo
@@ -116,6 +116,7 @@ interface @beta Efl.Ui.Position_Manager.Data_Access_V1 {
116 set { 116 set {
117 } 117 }
118 values { 118 values {
119 canvas: Efl.Ui.Win; [[Will use this object to freeze/thaw canvas events.]]
119 obj_access : Efl.Ui.Position_Manager.Object_Batch_Callback; [[Function callback for canvas objects, even if 120 obj_access : Efl.Ui.Position_Manager.Object_Batch_Callback; [[Function callback for canvas objects, even if
120 the start_id is valid, the returned objects 121 the start_id is valid, the returned objects
121 may be $NULL.]] 122 may be $NULL.]]
diff --git a/src/lib/elementary/efl_ui_position_manager_grid.c b/src/lib/elementary/efl_ui_position_manager_grid.c
index 7b0ed30..949cd66 100644
--- a/src/lib/elementary/efl_ui_position_manager_grid.c
+++ b/src/lib/elementary/efl_ui_position_manager_grid.c
@@ -30,6 +30,8 @@ typedef struct {
30 Eina_Bool size_cache_dirty; 30 Eina_Bool size_cache_dirty;
31 Eo *last_group; 31 Eo *last_group;
32 Eina_Future *rebuild_absolut_size; 32 Eina_Future *rebuild_absolut_size;
33 Efl_Ui_Win *window;
34 Evas *canvas;
33 Api_Callbacks callbacks; 35 Api_Callbacks callbacks;
34} Efl_Ui_Position_Manager_Grid_Data; 36} Efl_Ui_Position_Manager_Grid_Data;
35 37
@@ -769,7 +771,7 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_entity_version(Eo *obj EIN
769} 771}
770 772
771EOLIAN static void 773EOLIAN static void
772_efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_Grid_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) 774_efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access_set(Eo *obj, Efl_Ui_Position_Manager_Grid_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)
773{ 775{
774 // Cleanup cache first 776 // Cleanup cache first
775 _group_cache_invalidate(obj, pd); 777 _group_cache_invalidate(obj, pd);
@@ -781,6 +783,9 @@ _efl_ui_position_manager_grid_efl_ui_position_manager_data_access_v1_data_access
781 pd->callbacks.size.free_cb(pd->callbacks.size.data); 783 pd->callbacks.size.free_cb(pd->callbacks.size.data);
782 784
783 // Set them 785 // Set them
786 efl_replace(&pd->window, canvas);
787 efl_replace(&pd->canvas, canvas ? evas_object_evas_get(canvas) : NULL);
788
784 pd->callbacks.object.data = obj_access_data; 789 pd->callbacks.object.data = obj_access_data;
785 pd->callbacks.object.access = obj_access; 790 pd->callbacks.object.access = obj_access;
786 pd->callbacks.object.free_cb = obj_access_free_cb; 791 pd->callbacks.object.free_cb = obj_access_free_cb;
@@ -797,7 +802,7 @@ EOLIAN static void
797_efl_ui_position_manager_grid_efl_object_invalidate(Eo *obj, 802_efl_ui_position_manager_grid_efl_object_invalidate(Eo *obj,
798 Efl_Ui_Position_Manager_Grid_Data *pd EINA_UNUSED) 803 Efl_Ui_Position_Manager_Grid_Data *pd EINA_UNUSED)
799{ 804{
800 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, 0); 805 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0);
801 806
802 efl_invalidate(efl_super(obj, EFL_UI_POSITION_MANAGER_GRID_CLASS)); 807 efl_invalidate(efl_super(obj, EFL_UI_POSITION_MANAGER_GRID_CLASS));
803} 808}
diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c
index 34d7e5f..bd9dd95 100644
--- a/src/lib/elementary/efl_ui_position_manager_list.c
+++ b/src/lib/elementary/efl_ui_position_manager_list.c
@@ -25,6 +25,8 @@ typedef struct {
25 int maximum_min_size; 25 int maximum_min_size;
26 Vis_Segment prev_run; 26 Vis_Segment prev_run;
27 Efl_Gfx_Entity *last_group; 27 Efl_Gfx_Entity *last_group;
28 Efl_Ui_Win *window;
29 Evas *canvas;
28 Api_Callbacks callbacks; 30 Api_Callbacks callbacks;
29} Efl_Ui_Position_Manager_List_Data; 31} Efl_Ui_Position_Manager_List_Data;
30 32
@@ -193,6 +195,8 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
193 else 195 else
194 geom.x -= (relevant_space_size - cache_access(obj, pd, new.start_id)); 196 geom.x -= (relevant_space_size - cache_access(obj, pd, new.start_id));
195 197
198 evas_event_freeze(pd->canvas);
199
196 for (i = new.start_id; i < new.end_id; ++i) 200 for (i = new.start_id; i < new.end_id; ++i)
197 { 201 {
198 Eina_Size2D size; 202 Eina_Size2D size;
@@ -291,6 +295,9 @@ _position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_
291 295
292 efl_gfx_entity_position_set(first_group, first_group_pos); 296 efl_gfx_entity_position_set(first_group, first_group_pos);
293 efl_gfx_entity_size_set(first_group, first_group_size); 297 efl_gfx_entity_size_set(first_group, first_group_size);
298
299 evas_event_thaw(pd->canvas);
300 evas_event_thaw_eval(pd->canvas);
294} 301}
295 302
296 303
@@ -503,7 +510,7 @@ _efl_ui_position_manager_list_efl_object_invalidate(Eo *obj, Efl_Ui_Position_Man
503 if (pd->rebuild_absolut_size) 510 if (pd->rebuild_absolut_size)
504 eina_future_cancel(pd->rebuild_absolut_size); 511 eina_future_cancel(pd->rebuild_absolut_size);
505 512
506 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, 0); 513 efl_ui_position_manager_data_access_v1_data_access_set(obj, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0);
507 514
508 efl_invalidate(efl_super(obj, MY_CLASS)); 515 efl_invalidate(efl_super(obj, MY_CLASS));
509} 516}
@@ -542,7 +549,7 @@ _efl_ui_position_manager_list_efl_ui_position_manager_entity_version(Eo *obj EIN
542} 549}
543 550
544EOLIAN static void 551EOLIAN static void
545_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) 552_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)
546{ 553{
547 // Cleanup cache first 554 // Cleanup cache first
548 cache_invalidate(obj, pd); 555 cache_invalidate(obj, pd);
@@ -554,6 +561,9 @@ _efl_ui_position_manager_list_efl_ui_position_manager_data_access_v1_data_access
554 pd->callbacks.size.free_cb(pd->callbacks.size.data); 561 pd->callbacks.size.free_cb(pd->callbacks.size.data);
555 562
556 // Set them 563 // Set them
564 efl_replace(&pd->window, canvas);
565 efl_replace(&pd->canvas, canvas ? evas_object_evas_get(canvas) : NULL);
566
557 pd->callbacks.object.data = obj_access_data; 567 pd->callbacks.object.data = obj_access_data;
558 pd->callbacks.object.access = obj_access; 568 pd->callbacks.object.access = obj_access;
559 pd->callbacks.object.free_cb = obj_access_free_cb; 569 pd->callbacks.object.free_cb = obj_access_free_cb;
diff --git a/src/tests/elementary/efl_ui_test_position_manager_common.c b/src/tests/elementary/efl_ui_test_position_manager_common.c
index 63e31d4..ea73d01 100644
--- a/src/tests/elementary/efl_ui_test_position_manager_common.c
+++ b/src/tests/elementary/efl_ui_test_position_manager_common.c
@@ -71,6 +71,7 @@ _initial_setup(void)
71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10); 71 arr_size = eina_inarray_new(sizeof(Eina_Size2D), 10);
72 72
73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager, 73 efl_ui_position_manager_data_access_v1_data_access_set(position_manager,
74 win,
74 NULL, _obj_accessor_get_at, NULL, 75 NULL, _obj_accessor_get_at, NULL,
75 NULL, _size_accessor_get_at, NULL, 76 NULL, _size_accessor_get_at, NULL,
76 0); 77 0);