summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-11-26 10:49:55 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-04 16:47:40 +0100
commit3f7a63149a74abc26822e35530914654d7a60c4f (patch)
tree811617e45526243f02d9ca71da46b098bcc0b69c
parente9281cf124b2b973e1a0d97eef1c3d85ee684903 (diff)
downloadefl-3f7a63149a74abc26822e35530914654d7a60c4f.tar.gz
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
-rw-r--r--src/lib/elementary/efl_ui_layout.c12
-rw-r--r--src/lib/elementary/elm_widget_layout.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/elementary/efl_ui_layout.c b/src/lib/elementary/efl_ui_layout.c
index f4e3c0579f..e540f4201d 100644
--- a/src/lib/elementary/efl_ui_layout.c
+++ b/src/lib/elementary/efl_ui_layout.c
@@ -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);
diff --git a/src/lib/elementary/elm_widget_layout.h b/src/lib/elementary/elm_widget_layout.h
index 839bb06131..69565b6fd9 100644
--- a/src/lib/elementary/elm_widget_layout.h
+++ b/src/lib/elementary/elm_widget_layout.h
@@ -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