forked from enlightenment/efl
efl_ui/popup: optimize popup sizing calcs slightly
ensure that scroll-based popups don't accidentally trigger a full recalc and (wrong) size change during group_calc by hitting the base popup size_set() implementation and setting the needs_calc flag or by using the base popup calc code when it should not be used this resolves a corner case sizing issue in the text_alert 2 popup case in elm_test which seems to have been present for a long time Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D9538
This commit is contained in:
parent
219cb6fe9e
commit
3aee9a96c0
|
@ -75,11 +75,12 @@ _calc_align(Eo *obj)
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_ui_popup_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Popup_Data *pd EINA_UNUSED, Eina_Size2D size)
|
||||
_efl_ui_popup_efl_gfx_entity_size_set(Eo *obj, Efl_Ui_Popup_Data *pd, Eina_Size2D size)
|
||||
{
|
||||
efl_gfx_entity_size_set(efl_super(obj, MY_CLASS), size);
|
||||
|
||||
efl_canvas_group_change(obj);
|
||||
if (!pd->in_calc)
|
||||
efl_canvas_group_change(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -269,7 +270,6 @@ _sizing_eval(Eo *obj)
|
|||
new_size.w = (min.w > size.w ? min.w : size.w);
|
||||
new_size.h = (min.h > size.h ? min.h : size.h);
|
||||
efl_gfx_entity_size_set(obj, new_size);
|
||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -280,7 +280,12 @@ _efl_ui_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Popup_Data *pd)
|
|||
* The actual size calculation is done here when the object is rendered to
|
||||
* avoid duplicate size calculations. */
|
||||
efl_canvas_group_need_recalculate_set(obj, EINA_FALSE);
|
||||
_sizing_eval(obj);
|
||||
if (!pd->in_calc)
|
||||
{
|
||||
pd->in_calc = EINA_TRUE;
|
||||
_sizing_eval(obj);
|
||||
pd->in_calc = EINA_FALSE;
|
||||
}
|
||||
_calc_align(obj);
|
||||
|
||||
Eina_Rect p_geom = efl_gfx_entity_geometry_get(pd->win_parent);
|
||||
|
|
|
@ -9,6 +9,7 @@ struct _Efl_Ui_Popup_Data
|
|||
Efl_Ui_Popup_Align align;
|
||||
Ecore_Timer *timer;
|
||||
double timeout;
|
||||
Eina_Bool in_calc : 1;
|
||||
};
|
||||
|
||||
#define EFL_UI_POPUP_DATA_GET_OR_RETURN(o, ptr, ...) \
|
||||
|
|
|
@ -136,6 +136,8 @@ _sizing_eval(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
|
|||
EOLIAN static void
|
||||
_efl_ui_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scroll_Alert_Popup_Data *pd)
|
||||
{
|
||||
EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
|
||||
ppd->in_calc = EINA_TRUE;
|
||||
/* When efl_canvas_group_change() is called, just flag is set instead of size
|
||||
* calculation.
|
||||
* The actual size calculation is done here when the object is rendered to
|
||||
|
@ -146,6 +148,7 @@ _efl_ui_scroll_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Scro
|
|||
|
||||
//Not to calculate size by super class
|
||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
||||
ppd->in_calc = EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -158,6 +158,8 @@ _sizing_eval(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd)
|
|||
EOLIAN static void
|
||||
_efl_ui_text_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_Alert_Popup_Data *pd)
|
||||
{
|
||||
EFL_UI_POPUP_DATA_GET_OR_RETURN(obj, ppd);
|
||||
ppd->in_calc = EINA_TRUE;
|
||||
/* When efl_canvas_group_change() is called, just flag is set instead of size
|
||||
* calculation.
|
||||
* The actual size calculation is done here when the object is rendered to
|
||||
|
@ -167,6 +169,7 @@ _efl_ui_text_alert_popup_efl_canvas_group_group_calculate(Eo *obj, Efl_Ui_Text_A
|
|||
_sizing_eval(obj, pd);
|
||||
|
||||
efl_canvas_group_calculate(efl_super(obj, MY_CLASS));
|
||||
ppd->in_calc = EINA_FALSE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
Loading…
Reference in New Issue