summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2018-06-21 12:39:15 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-22 10:38:11 +0200
commit59c2f78d79dab5096300263c616cbd61fde00ab9 (patch)
treeb84ae7466a144d1aefd7e3724aa8aeef4a0d2247
parent91e146f108d12f1369f26f839b48be5901373df2 (diff)
efl_ui_focus_manager: track list presence
By keeping track of whether a node is on the dirty list or not we can save ourself list walks trying to remove items that aren't present. Differential Revision: https://phab.enlightenment.org/D6349 Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index e3c6af6008..65673bf96f 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -65,6 +65,8 @@ struct _Node{
65 struct _Graph_Node { 65 struct _Graph_Node {
66 Border directions[NODE_DIRECTIONS_COUNT]; 66 Border directions[NODE_DIRECTIONS_COUNT];
67 } graph; 67 } graph;
68
69 Eina_Bool on_list : 1;
68}; 70};
69 71
70#define T(n) (n->tree) 72#define T(n) (n->tree)
@@ -230,6 +232,7 @@ node_item_free(Node *item)
230 232
231 //remove from the dirty parts 233 //remove from the dirty parts
232 pd->dirty = eina_list_remove(pd->dirty, item); 234 pd->dirty = eina_list_remove(pd->dirty, item);
235 item->on_list = EINA_FALSE;
233 236
234 /*merge tree items*/ 237 /*merge tree items*/
235 238
@@ -369,11 +372,12 @@ dirty_flush_node(Efl_Ui_Focus_Manager *obj EINA_UNUSED, Efl_Ui_Focus_Manager_Cal
369static void 372static void
370dirty_flush(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *node) 373dirty_flush(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *node)
371{ 374{
372 if (!eina_list_data_find(pd->dirty, node)) return; 375 if (!node->on_list) return;
373 376
374 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, NULL); 377 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, NULL);
375 378
376 pd->dirty = eina_list_remove(pd->dirty, node); 379 pd->dirty = eina_list_remove(pd->dirty, node);
380 node->on_list = EINA_FALSE;
377 381
378 dirty_flush_node(obj, pd, node); 382 dirty_flush_node(obj, pd, node);
379} 383}
@@ -387,6 +391,7 @@ dirty_flush_all(Efl_Ui_Focus_Manager *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
387 391
388 EINA_LIST_FREE(pd->dirty, node) 392 EINA_LIST_FREE(pd->dirty, node)
389 { 393 {
394 node->on_list = EINA_FALSE;
390 dirty_flush_node(obj, pd, node); 395 dirty_flush_node(obj, pd, node);
391 } 396 }
392} 397}
@@ -399,10 +404,11 @@ dirty_add(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd, Node *dirty)
399 ERR("Only not only logical nodes can be marked dirty"); 404 ERR("Only not only logical nodes can be marked dirty");
400 return; 405 return;
401 } 406 }
407 if (dirty->on_list) return;
402 408
403 //if (eina_list_data_find(pd->dirty, dirty)) return; 409 //if (eina_list_data_find(pd->dirty, dirty)) return;
404 pd->dirty = eina_list_remove(pd->dirty, dirty);
405 pd->dirty = eina_list_append(pd->dirty, dirty); 410 pd->dirty = eina_list_append(pd->dirty, dirty);
411 dirty->on_list = EINA_TRUE;
406 412
407 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL); 413 efl_event_callback_call(obj, EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, NULL);
408} 414}
@@ -849,9 +855,13 @@ _efl_ui_focus_manager_calc_efl_object_provider_find(const Eo *obj, Efl_Ui_Focus_
849EOLIAN static void 855EOLIAN static void
850_efl_ui_focus_manager_calc_efl_object_destructor(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd) 856_efl_ui_focus_manager_calc_efl_object_destructor(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
851{ 857{
852 pd->focus_stack = eina_list_free(pd->focus_stack); 858 Node *n;
853 pd->dirty = eina_list_free(pd->dirty);
854 859
860 pd->focus_stack = eina_list_free(pd->focus_stack);
861 EINA_LIST_FREE(pd->dirty, n)
862 {
863 n->on_list = EINA_FALSE;
864 }
855 eina_hash_free(pd->node_hash); 865 eina_hash_free(pd->node_hash);
856 866
857 efl_ui_focus_manager_redirect_set(obj, NULL); 867 efl_ui_focus_manager_redirect_set(obj, NULL);