bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=acee09f5851903a7e16e1507766718ea22a266c8

commit acee09f5851903a7e16e1507766718ea22a266c8
Author: Marcel Hollerbach <[email protected]>
Date:   Thu Nov 22 15:50:04 2018 +0100

    efl_ui_focus_manager_sub: freeze manager when parent manager is frozen
    
    a efl_ui_focus_manager_sub object is a manager object by itself. It
    registeres the border elements of itself in the parent focus manager.
    However, all elements that are registered in this manager object, are
    also automatically children of the parent root object, which means, when
    the root object of the parent manager object is moved, then those
    children will also be moved. Which means, when the parent manager can
    ignore those changes, we can also ignore them.
    This improves the overall performance of the "Scroller 2" test case by
    26%.
    
    The change to the test is required in order to redirect the events so
    the self_dirty bit is setted correctly
    
    Differential Revision: https://phab.enlightenment.org/D7350
---
 src/lib/elementary/efl_ui_focus_manager_sub.c | 23 +++++++++++++++++++++--
 src/tests/elementary/elm_test_focus_sub.c     |  6 ++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/src/lib/elementary/efl_ui_focus_manager_sub.c 
b/src/lib/elementary/efl_ui_focus_manager_sub.c
index 57997afd41..90ac4f7387 100644
--- a/src/lib/elementary/efl_ui_focus_manager_sub.c
+++ b/src/lib/elementary/efl_ui_focus_manager_sub.c
@@ -84,6 +84,7 @@ _border_flush(Eo *obj, Efl_Ui_Focus_Manager_Sub_Data *pd)
 
    eina_list_free(pd->current_border);
    pd->current_border = selection;
+   pd->self_dirty = EINA_FALSE;
 }
 
 static void
@@ -105,7 +106,7 @@ _parent_manager_pre_flush(void *data, const Efl_Event *ev 
EINA_UNUSED)
 {
     MY_DATA(data, pd);
 
-    //if (!pd->self_dirty) return; //we are not interested
+    if (!pd->self_dirty) return; //we are not interested
 
     _border_flush(data, pd);
 }
@@ -116,12 +117,27 @@ _redirect_changed_cb(void *data, const Efl_Event *ev 
EINA_UNUSED)
    //if (efl_ui_focus_manager_redirect_get(ev->object) != data) return;
 
    MY_DATA(data, pd);
+
    _border_flush(data, pd);
 }
 
+static void
+_freeze_changed_cb(void *data, const Efl_Event *ev EINA_UNUSED)
+{
+   if (ev->info)
+     {
+        efl_ui_focus_manager_dirty_logic_freeze(data);
+     }
+   else
+     {
+        efl_ui_focus_manager_dirty_logic_unfreeze(data);
+     }
+}
+
 EFL_CALLBACKS_ARRAY_DEFINE(parent_manager,
     {EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, _parent_manager_pre_flush},
-    {EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, _redirect_changed_cb}
+    {EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, _redirect_changed_cb},
+    {EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, _freeze_changed_cb}
 );
 
 static void
@@ -198,6 +214,9 @@ _efl_ui_focus_manager_sub_efl_object_constructor(Eo *obj, 
Efl_Ui_Focus_Manager_S
 {
    obj = efl_constructor(efl_super(obj, MY_CLASS));
    efl_event_callback_array_add(obj, self_manager(), obj);
+
+   pd->self_dirty = EINA_TRUE;
+
    return obj;
 }
 
diff --git a/src/tests/elementary/elm_test_focus_sub.c 
b/src/tests/elementary/elm_test_focus_sub.c
index 3f100dfae2..5454ecd414 100644
--- a/src/tests/elementary/elm_test_focus_sub.c
+++ b/src/tests/elementary/elm_test_focus_sub.c
@@ -93,6 +93,12 @@ _setup(Efl_Ui_Focus_Manager **m, Efl_Ui_Focus_Manager_Sub 
**sub, Efl_Ui_Focus_Ob
    Efl_Ui_Focus_Manager_Calc *subm = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, 
focus_main,
     efl_ui_focus_manager_root_set(efl_added, root)
    );
+   efl_event_callback_forwarder_add(subm, 
EFL_UI_FOCUS_MANAGER_EVENT_FLUSH_PRE, focus_main);
+   efl_event_callback_forwarder_add(subm, 
EFL_UI_FOCUS_MANAGER_EVENT_REDIRECT_CHANGED, focus_main);
+   efl_event_callback_forwarder_add(subm, 
EFL_UI_FOCUS_MANAGER_EVENT_FOCUS_CHANGED , focus_main);
+   efl_event_callback_forwarder_add(subm, 
EFL_UI_FOCUS_MANAGER_EVENT_COORDS_DIRTY, focus_main);
+   efl_event_callback_forwarder_add(subm, 
EFL_UI_FOCUS_MANAGER_EVENT_DIRTY_LOGIC_FREEZE_CHANGED, focus_main);
+
 
    efl_composite_attach(focus_main, subm);
 

-- 


Reply via email to