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.
This commit is contained in:
ChunEon Park 2013-08-22 17:00:36 +09:00
parent 209bc2107b
commit 5fd81d8849
4 changed files with 20 additions and 2 deletions

View File

@ -1566,3 +1566,10 @@
2013-08-22 Thiep Ha 2013-08-22 Thiep Ha
* Add hide effect for notify. * Add hide effect for notify.
2013-08-22 ChunEon Park (Hermet)
* 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.

View File

@ -128,6 +128,7 @@ Improvements:
* Add support for URL in Elm_Image and Elm_Photocam. * Add support for URL in Elm_Image and Elm_Photocam.
* Popup: Support "language,changed" smart callback. * Popup: Support "language,changed" smart callback.
* Add hide effect for notify. * Add hide effect for notify.
* 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.
Fixes: Fixes:
* Now elm_datetime_field_limit_set() can set year limits wihtout problems. * Now elm_datetime_field_limit_set() can set year limits wihtout problems.

View File

@ -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); (sobj, EVAS_CALLBACK_DEL, _on_sub_obj_del, obj);
if (_elm_widget_is(sobj)) if (_elm_widget_is(sobj))
{ {
ELM_WIDGET_DATA_GET(sobj, sdc);
evas_object_event_callback_add evas_object_event_callback_add
(sobj, EVAS_CALLBACK_HIDE, _on_sub_obj_hide, NULL); (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); th = elm_widget_theme_get(sobj);
mirrored = elm_widget_mirrored_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); elm_widget_theme(sobj);
if (elm_widget_focus_get(sobj)) _parents_focus(obj); 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_Theme *th = va_arg(*list, Elm_Theme *);
Elm_Widget_Smart_Data *sd = _pd; Elm_Widget_Smart_Data *sd = _pd;
Eina_Bool apply = EINA_FALSE;
if (sd->theme != th) if (sd->theme != th)
{ {
if (elm_widget_theme_get(obj) != th) apply = EINA_TRUE;
if (sd->theme) elm_theme_free(sd->theme); if (sd->theme) elm_theme_free(sd->theme);
sd->theme = th; sd->theme = th;
if (th) th->ref++; 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 static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED) _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_super(obj, MY_CLASS, eo_constructor());
eo_do(obj, evas_obj_type_set(MY_CLASS_NAME)); eo_do(obj, evas_obj_type_set(MY_CLASS_NAME));
eo_do(obj, elm_wdg_parent_set(eo_parent_get(obj))); eo_do(obj, elm_wdg_parent_set(eo_parent_get(obj)));
sd->on_create = EINA_FALSE;
} }
static void static void

View File

@ -436,6 +436,7 @@ typedef struct _Elm_Widget_Smart_Data
Eina_Bool highlighted : 1; Eina_Bool highlighted : 1;
Eina_Bool highlight_root : 1; Eina_Bool highlight_root : 1;
Eina_Bool on_translate : 1; Eina_Bool on_translate : 1;
Eina_Bool on_create : 1;
} Elm_Widget_Smart_Data; } Elm_Widget_Smart_Data;
/** /**