diff options
author | ChunEon Park <hermet@hermet.pe.kr> | 2013-08-22 17:00:36 +0900 |
---|---|---|
committer | ChunEon Park <hermet@hermet.pe.kr> | 2013-08-22 17:00:36 +0900 |
commit | caaeffede028f3655a761f0aa4bbd2aa579f181d (patch) | |
tree | ba79de7c25ed808dd9473323e0e4becf816512fa /src/lib | |
parent | bfc4cafc1d2bc1effee6e94baa5df32153aa9c0b (diff) | |
download | elementary-caaeffede028f3655a761f0aa4bbd2aa579f181d.tar.gz |
elementry/widget - Improve performance in applying widget theme.
It prevents applying themes more strictly if it tries to apply same theme.
This increases the performance hugely in case that user applies a specific theme to the window object.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/elm_widget.c | 13 | ||||
-rw-r--r-- | src/lib/elm_widget.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 1b169ae79..d8fd8f4df 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -1039,6 +1039,8 @@ _elm_widget_sub_object_add(Eo *obj, void *_pd, va_list *list) (sobj, EVAS_CALLBACK_DEL, _on_sub_obj_del, obj); if (_elm_widget_is(sobj)) { + ELM_WIDGET_DATA_GET(sobj, sdc); + evas_object_event_callback_add (sobj, EVAS_CALLBACK_HIDE, _on_sub_obj_hide, NULL); @@ -1046,7 +1048,8 @@ _elm_widget_sub_object_add(Eo *obj, void *_pd, va_list *list) th = elm_widget_theme_get(sobj); mirrored = elm_widget_mirrored_get(sobj); - if ((scale != pscale) || (th != pth) || (pmirrored != mirrored)) + if ((scale != pscale) || (!sdc->on_create && th != pth) || + (pmirrored != mirrored)) elm_widget_theme(sobj); if (elm_widget_focus_get(sobj)) _parents_focus(obj); @@ -3763,12 +3766,14 @@ _elm_widget_theme_set(Eo *obj, void *_pd, va_list *list) { Elm_Theme *th = va_arg(*list, Elm_Theme *); Elm_Widget_Smart_Data *sd = _pd; + Eina_Bool apply = EINA_FALSE; if (sd->theme != th) { + if (elm_widget_theme_get(obj) != th) apply = EINA_TRUE; if (sd->theme) elm_theme_free(sd->theme); sd->theme = th; if (th) th->ref++; - elm_widget_theme(obj); + if (apply) elm_widget_theme(obj); } } @@ -5875,9 +5880,13 @@ elm_widget_tree_dot_dump(const Evas_Object *top, static void _constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) { + ELM_WIDGET_DATA_GET(obj, sd); + + sd->on_create = EINA_TRUE; eo_do_super(obj, MY_CLASS, eo_constructor()); eo_do(obj, evas_obj_type_set(MY_CLASS_NAME)); eo_do(obj, elm_wdg_parent_set(eo_parent_get(obj))); + sd->on_create = EINA_FALSE; } static void diff --git a/src/lib/elm_widget.h b/src/lib/elm_widget.h index 594580f85..945ef9d90 100644 --- a/src/lib/elm_widget.h +++ b/src/lib/elm_widget.h @@ -436,6 +436,7 @@ typedef struct _Elm_Widget_Smart_Data Eina_Bool highlighted : 1; Eina_Bool highlight_root : 1; Eina_Bool on_translate : 1; + Eina_Bool on_create : 1; } Elm_Widget_Smart_Data; /** |