efl_ui/layout: fix multiple emissions of theme,changed during construction

in the case where a layout object was created and had a theme manually set
with efl_ui_layout_theme_set() during construction, the layout would then
call theme_apply() a second time internally during finalize which, if the
theme has not changed (as can only be the case if this flag is unset),
results in a repeated theme_apply for the existing theme

@fix

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D10738
This commit is contained in:
Mike Blumenkrantz 2019-11-26 10:49:55 -05:00 committed by Marcel Hollerbach
parent e9281cf124
commit 3f7a63149a
2 changed files with 11 additions and 2 deletions

View File

@ -557,6 +557,8 @@ _efl_ui_layout_base_efl_ui_widget_theme_apply(Eo *obj, Efl_Ui_Layout_Data *sd)
char buf[64];
static unsigned int version = 0;
sd->needs_theme_apply = EINA_FALSE;
theme_apply_ret = efl_ui_widget_theme_apply(efl_super(obj, MY_CLASS));
if (theme_apply_ret == EFL_UI_THEME_APPLY_ERROR_GENERIC) return EFL_UI_THEME_APPLY_ERROR_GENERIC;
@ -2699,6 +2701,7 @@ EOLIAN static Eo *
_efl_ui_layout_base_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Data *sd)
{
sd->obj = obj;
sd->needs_theme_apply = EINA_TRUE;
sd->finger_size_multiplier_x = sd->finger_size_multiplier_y = 1;
obj = efl_constructor(efl_super(obj, MY_CLASS));
evas_object_smart_callbacks_descriptions_set(obj, _smart_callbacks);
@ -2708,12 +2711,17 @@ _efl_ui_layout_base_efl_object_constructor(Eo *obj, Efl_Ui_Layout_Data *sd)
}
EOLIAN static Efl_Object*
_efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UNUSED)
_efl_ui_layout_base_efl_object_finalize(Eo *obj, Efl_Ui_Layout_Data *pd)
{
Eo *eo, *win;
ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
eo = efl_finalize(efl_super(obj, MY_CLASS));
efl_ui_widget_theme_apply(eo);
if (pd->needs_theme_apply)
{
efl_ui_widget_theme_apply(eo);
/* handle case where subclass does not call into layout */
pd->needs_theme_apply = EINA_FALSE;
}
efl_canvas_group_change(obj);
Elm_Layout_Data *ld = efl_data_scope_safe_get(obj, ELM_LAYOUT_MIXIN);

View File

@ -75,6 +75,7 @@ typedef struct _Efl_Ui_Layout_Data
Eina_Bool model_watch : 1; /**< Set to true once we do watch for model change*/
Eina_Bool calc_subobjs : 1; /**< Set to true if group_calc should also handle subobjs during manual calc */
Eina_Bool cb_theme_changed : 1; /**< if theme,changed event subscriber has been added */
Eina_Bool needs_theme_apply : 1; /**< if theme has not been manually set during construction */
} Efl_Ui_Layout_Data;
typedef struct _Elm_Layout_Data