summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-18 18:27:37 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-08-20 10:09:57 +0200
commit013ab4d528480682e9d709da77af433a5e3a4e61 (patch)
tree97d8441ebcacdecc4f150d3c8fb2a0e5664d60bb
parent272d8f50673c69dcc508c666e95a5b4afc70d37e (diff)
efl_ui_position_manager_common: generalize codedevs/bu5hm4n/arm-test
move the same code to a common header file. Differential Revision: https://phab.enlightenment.org/D9630
-rw-r--r--src/lib/elementary/efl_ui_position_manager_common.h21
-rw-r--r--src/lib/elementary/efl_ui_position_manager_grid.c17
-rw-r--r--src/lib/elementary/efl_ui_position_manager_list.c24
3 files changed, 23 insertions, 39 deletions
diff --git a/src/lib/elementary/efl_ui_position_manager_common.h b/src/lib/elementary/efl_ui_position_manager_common.h
index e74e6d48f2..0c6a847bae 100644
--- a/src/lib/elementary/efl_ui_position_manager_common.h
+++ b/src/lib/elementary/efl_ui_position_manager_common.h
@@ -11,6 +11,10 @@ typedef struct {
11 Eina_Free_Cb free_cb; 11 Eina_Free_Cb free_cb;
12} Api_Callback; 12} Api_Callback;
13 13
14typedef struct {
15 unsigned int start_id, end_id;
16} Vis_Segment;
17
14static inline int 18static inline int
15_fill_buffer(Api_Callback *cb , int start_id, int len, int *group_id, void *data) 19_fill_buffer(Api_Callback *cb , int start_id, int len, int *group_id, void *data)
16{ 20{
@@ -57,3 +61,20 @@ vis_change_segment(Api_Callback *cb, int a, int b, Eina_Bool flag)
57 } 61 }
58} 62}
59#endif 63#endif
64
65static inline void
66vis_segment_swap(Api_Callback *cb, Vis_Segment new, Vis_Segment old)
67{
68 if (new.end_id <= old.start_id || new.start_id >= old.end_id)
69 {
70 //it is important to first make the segment visible here, and then hide the rest
71 //otherwise we get a state where item_container has 0 subchildren, which triggers a lot of focus logic.
72 vis_change_segment(cb, new.start_id, new.end_id, EINA_TRUE);
73 vis_change_segment(cb, old.start_id, old.end_id, EINA_FALSE);
74 }
75 else
76 {
77 vis_change_segment(cb, old.start_id, new.start_id, (old.start_id > new.start_id));
78 vis_change_segment(cb, old.end_id, new.end_id, (old.end_id < new.end_id));
79 }
80}
diff --git a/src/lib/elementary/efl_ui_position_manager_grid.c b/src/lib/elementary/efl_ui_position_manager_grid.c
index db84dd7fe2..3968884442 100644
--- a/src/lib/elementary/efl_ui_position_manager_grid.c
+++ b/src/lib/elementary/efl_ui_position_manager_grid.c
@@ -13,10 +13,6 @@
13 Efl_Ui_Position_Manager_Grid_Data *pd = efl_data_scope_get(obj, MY_CLASS); 13 Efl_Ui_Position_Manager_Grid_Data *pd = efl_data_scope_get(obj, MY_CLASS);
14 14
15typedef struct { 15typedef struct {
16 unsigned int start_id, end_id;
17} Vis_Segment;
18
19typedef struct {
20 Api_Callback min_size, object; 16 Api_Callback min_size, object;
21 unsigned int size; 17 unsigned int size;
22 unsigned int groups; 18 unsigned int groups;
@@ -460,18 +456,7 @@ _reposition_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_Grid_Data *pd)
460 456
461 //to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false 457 //to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false
462 //The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible 458 //The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible
463 if (cur.end_id < pd->prev_run.start_id || cur.start_id > pd->prev_run.end_id) 459 vis_segment_swap(&pd->object, cur, pd->prev_run);
464 {
465 //it is important to first make the segment visible here, and then hide the rest
466 //otherwise we get a state where item_container has 0 subchildren, which triggers a lot of focus logic.
467 vis_change_segment(&pd->object, cur.start_id, cur.end_id, EINA_TRUE);
468 vis_change_segment(&pd->object, pd->prev_run.start_id, pd->prev_run.end_id, EINA_FALSE);
469 }
470 else
471 {
472 vis_change_segment(&pd->object, pd->prev_run.start_id, cur.start_id, (pd->prev_run.start_id > cur.start_id));
473 vis_change_segment(&pd->object, pd->prev_run.end_id, cur.end_id, (pd->prev_run.end_id < cur.end_id));
474 }
475 460
476 ctx.new = cur; 461 ctx.new = cur;
477 ctx.consumed_space = consumed_space; 462 ctx.consumed_space = consumed_space;
diff --git a/src/lib/elementary/efl_ui_position_manager_list.c b/src/lib/elementary/efl_ui_position_manager_list.c
index a3bd452522..3200caad8b 100644
--- a/src/lib/elementary/efl_ui_position_manager_list.c
+++ b/src/lib/elementary/efl_ui_position_manager_list.c
@@ -13,11 +13,6 @@
13#define MY_DATA_GET(obj, pd) \ 13#define MY_DATA_GET(obj, pd) \
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
16
17typedef struct {
18 unsigned int start_id, end_id;
19} Vis_Segment;
20
21typedef struct { 16typedef struct {
22 Api_Callback min_size, object; 17 Api_Callback min_size, object;
23 unsigned int size; 18 unsigned int size;
@@ -169,23 +164,6 @@ err:
169} 164}
170 165
171static inline void 166static inline void
172_visual_segment_swap(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_Segment new, Vis_Segment old)
173{
174 if (new.end_id <= old.start_id || new.start_id >= old.end_id)
175 {
176 //it is important to first make the segment visible here, and then hide the rest
177 //otherwise we get a state where item_container has 0 subchildren, which triggers a lot of focus logic.
178 vis_change_segment(&pd->object, new.start_id, new.end_id, EINA_TRUE);
179 vis_change_segment(&pd->object, old.start_id, old.end_id, EINA_FALSE);
180 }
181 else
182 {
183 vis_change_segment(&pd->object, old.start_id, new.start_id, (old.start_id > new.start_id));
184 vis_change_segment(&pd->object, old.end_id, new.end_id, (old.end_id < new.end_id));
185 }
186}
187
188static inline void
189_position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_Segment new, int relevant_space_size) 167_position_items(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd, Vis_Segment new, int relevant_space_size)
190{ 168{
191 int group_id = -1; 169 int group_id = -1;
@@ -327,7 +305,7 @@ position_content(Eo *obj EINA_UNUSED, Efl_Ui_Position_Manager_List_Data *pd)
327 cur = _search_visual_segment(obj, pd, relevant_space_size, relevant_viewport); 305 cur = _search_visual_segment(obj, pd, relevant_space_size, relevant_viewport);
328 //to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false 306 //to performance optimize the whole widget, we are setting the objects that are outside the viewport to visibility false
329 //The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible 307 //The code below ensures that things outside the viewport are always hidden, and things inside the viewport are visible
330 _visual_segment_swap(obj, pd, cur, pd->prev_run); 308 vis_segment_swap(&pd->object, cur, pd->prev_run);
331 309
332 _position_items(obj, pd, cur, relevant_space_size); 310 _position_items(obj, pd, cur, relevant_space_size);
333 311