hermet pushed a commit to branch master.
commit caaeffede028f3655a761f0aa4bbd2aa579f181d
Author: ChunEon Park <[email protected]>
Date: Thu Aug 22 17:00:36 2013 +0900
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.
---
ChangeLog | 7 +++++++
NEWS | 1 +
src/lib/elm_widget.c | 13 +++++++++++--
src/lib/elm_widget.h | 1 +
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index cef7b1a..b1986a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1566,3 +1566,10 @@
2013-08-22 Thiep Ha
* 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.
diff --git a/NEWS b/NEWS
index 2fac39e..92f42cf 100644
--- a/NEWS
+++ b/NEWS
@@ -128,6 +128,7 @@ Improvements:
* Add support for URL in Elm_Image and Elm_Photocam.
* Popup: Support "language,changed" smart callback.
* 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:
* Now elm_datetime_field_limit_set() can set year limits wihtout problems.
diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c
index 1b169ae..d8fd8f4 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 594580f..945ef9d 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;
/**
--
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk