cedric pushed a commit to branch master.

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

commit aa2d94f901f4a50ebe0a566e1bda8ebaa5dd1283
Author: Marcel Hollerbach <m...@marcel-hollerbach.de>
Date:   Tue Aug 20 08:58:52 2019 +0200

    efl_ui_widget: add a place to share data
    
    this introduces a shared place to all widgets. The shared pointer is
    allocated in the window, as the window outlifes every widget that is
    part of it.
    
    This struct will be later used for further optimizations like:
    
    1. There are really heavy focus operations which are only needed for
    gengrid/genlst, there is no point in executing them if there is no
    gen**** added to the window object. So we can skip the custom
    parent_provider logic that is only introduced for gengrid / genlist.
    
    2. Legacy focus APIs must do list walks, which means, on every focus
    operation we always have to walk the full list up to the parent, which
    is annoying and slow, as we *most of the time* do not use legacy focus
    API.
    
    This list can be continued, the above two cases are fixed in the next
    revisions.
    
    Reviewed-by: Cedric BAIL <cedric.b...@free.fr>
    Differential Revision: https://phab.enlightenment.org/D9642
---
 src/lib/elementary/efl_ui_widget.c | 21 +++++++++++++++------
 src/lib/elementary/efl_ui_win.c    | 10 ++++++++++
 src/lib/elementary/elm_priv.h      |  7 +++++++
 src/lib/elementary/elm_widget.h    |  1 +
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/lib/elementary/efl_ui_widget.c 
b/src/lib/elementary/efl_ui_widget.c
index 37331e4bfd..1e3ea74737 100644
--- a/src/lib/elementary/efl_ui_widget.c
+++ b/src/lib/elementary/efl_ui_widget.c
@@ -4768,12 +4768,8 @@ EOLIAN static Eo *
 _efl_ui_widget_efl_object_constructor(Eo *obj, Elm_Widget_Smart_Data *sd 
EINA_UNUSED)
 {
    sd->on_create = EINA_TRUE;
+
    sd->window = efl_provider_find(efl_parent_get(obj), EFL_UI_WIN_CLASS);
-   _efl_ui_focus_event_redirector(obj, obj);
-   efl_canvas_group_clipped_set(obj, EINA_FALSE);
-   obj = efl_constructor(efl_super(obj, MY_CLASS));
-   efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
-   evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
    if (!efl_isa(obj, EFL_UI_WIN_CLASS))
      {
         Eo *parent = efl_parent_get(obj);
@@ -4783,14 +4779,27 @@ _efl_ui_widget_efl_object_constructor(Eo *obj, 
Elm_Widget_Smart_Data *sd EINA_UN
                  "Elementary widget's parent should be an elementary widget.",
                  parent, evas_object_type_get(parent));
           }
-
+        ELM_WIDGET_DATA_GET(parent, parent_sd);
+        sd->shared_win_data = parent_sd->shared_win_data;
         efl_ui_widget_sub_object_add(parent, obj);
      }
+   else
+     {
+        sd->shared_win_data = efl_ui_win_shared_data_get(obj);
+     }
+
+   _efl_ui_focus_event_redirector(obj, obj);
+   efl_canvas_group_clipped_set(obj, EINA_FALSE);
+   obj = efl_constructor(efl_super(obj, MY_CLASS));
+   efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
+   evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
 
    sd->on_create = EINA_FALSE;
 
    efl_access_object_role_set(obj, EFL_ACCESS_ROLE_UNKNOWN);
 
+   EINA_SAFETY_ON_NULL_RETURN_VAL(sd->shared_win_data, NULL);
+
    return obj;
 }
 
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index c50ec79fa7..ffd806998c 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -269,6 +269,7 @@ struct _Efl_Ui_Win_Data
       Eina_Bool    bg_must_swallow_init : 1;
       Eina_Bool    ctor : 1; /**< legacy constructor: elm_win~add */
    } legacy;
+   Efl_Ui_Shared_Win_Data spd;
 
    Eina_Value exit_on_close;
 
@@ -9441,3 +9442,12 @@ elm_win_focus_highlight_style_get(const Efl_Ui_Win *obj)
 {
    return efl_ui_win_focus_highlight_style_get(obj);
 }
+
+EAPI Efl_Ui_Shared_Win_Data*
+efl_ui_win_shared_data_get(Efl_Ui_Win *obj)
+{
+   Efl_Ui_Win_Data *pd = efl_data_scope_safe_get(obj, MY_CLASS);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(pd, NULL);
+
+   return &pd->spd;
+}
diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h
index ab82a12f0d..543854c9ef 100644
--- a/src/lib/elementary/elm_priv.h
+++ b/src/lib/elementary/elm_priv.h
@@ -1041,4 +1041,11 @@ void efl_ui_scroll_connector_bind(Eo *obj, Eo *manager);
  */
 void efl_ui_scroll_connector_unbind(Eo *obj);
 
+typedef struct
+{
+
+} Efl_Ui_Shared_Win_Data;
+
+Efl_Ui_Shared_Win_Data* efl_ui_win_shared_data_get(Efl_Ui_Win *win);
+
 #endif
diff --git a/src/lib/elementary/elm_widget.h b/src/lib/elementary/elm_widget.h
index dfdfdb83f7..5ca84752e8 100644
--- a/src/lib/elementary/elm_widget.h
+++ b/src/lib/elementary/elm_widget.h
@@ -391,6 +391,7 @@ typedef struct _Elm_Widget_Smart_Data
       Eina_Hash *view_lookup;
       Eina_Bool  registered : 1;
    } properties;
+   void                          *shared_win_data;
    Eina_Bool                     scroll_x_locked : 1;
    Eina_Bool                     scroll_y_locked : 1;
 

-- 


Reply via email to