jaehyun pushed a commit to branch feature/eo_theme. http://git.enlightenment.org/core/efl.git/commit/?id=05007e59aaf7c2a54a50074c52bc38e38811d8ee
commit 05007e59aaf7c2a54a50074c52bc38e38811d8ee Author: Jaehyun Cho <jae_hyun....@samsung.com> Date: Fri Dec 8 18:11:09 2017 +0900 efl_ui_popup: Update size calculation logic Instead of doing size calculation whenever elm_layout_sizing_eval() is called, do size calculation when the object is rendered like efl_ui_layout. --- src/lib/elementary/efl_ui_popup.c | 27 +++++++++++++++++++++++++-- src/lib/elementary/efl_ui_popup.eo | 1 + src/lib/elementary/efl_ui_popup_private.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/efl_ui_popup.c b/src/lib/elementary/efl_ui_popup.c index a270ea3740..7a43362320 100644 --- a/src/lib/elementary/efl_ui_popup.c +++ b/src/lib/elementary/efl_ui_popup.c @@ -239,8 +239,8 @@ _efl_ui_popup_efl_object_destructor(Eo *obj, Efl_Ui_Popup_Data *pd) efl_destructor(efl_super(obj, MY_CLASS)); } -EOLIAN static void -_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) +static void +_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) { ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); Evas_Coord minw = -1, minh = -1; @@ -260,6 +260,29 @@ _efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED) _calc_align(obj); } +EOLIAN static void +_efl_ui_popup_elm_layout_sizing_eval(Eo *obj, Efl_Ui_Popup_Data *pd) +{ + if (pd->needs_size_calc) return; + pd->needs_size_calc = EINA_TRUE; + + evas_object_smart_changed(obj); +} + +EOLIAN static void +_efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd) +{ + /* When elm_layout_sizing_eval() is called, just flag is set instead of size + * calculation. + * The actual size calculation is done here when the object is rendered to + * avoid duplicate size calculations. */ + if (pd->needs_size_calc) + { + _sizing_eval(obj, pd); + pd->needs_size_calc = EINA_FALSE; + } +} + /* Standard widget overrides */ ELM_PART_CONTENT_DEFAULT_SET(efl_ui_popup, "elm.swallow.content") diff --git a/src/lib/elementary/efl_ui_popup.eo b/src/lib/elementary/efl_ui_popup.eo index dd5032a2e3..8de3202db6 100644 --- a/src/lib/elementary/efl_ui_popup.eo +++ b/src/lib/elementary/efl_ui_popup.eo @@ -52,6 +52,7 @@ class Efl.Ui.Popup(Efl.Ui.Layout, Efl.Content) implements { Efl.Object.constructor; Efl.Object.destructor; + Efl.Canvas.Group.group_calculate; Efl.Gfx.position { set; } Efl.Gfx.size { set;} Efl.Gfx.visible { set; } diff --git a/src/lib/elementary/efl_ui_popup_private.h b/src/lib/elementary/efl_ui_popup_private.h index a62a654046..f018812389 100644 --- a/src/lib/elementary/efl_ui_popup_private.h +++ b/src/lib/elementary/efl_ui_popup_private.h @@ -9,6 +9,7 @@ struct _Efl_Ui_Popup_Data Efl_Ui_Popup_Align align; Ecore_Timer *timer; double timeout; + Eina_Bool needs_size_calc : 1; }; #endif --