summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorRyuan Choi <ryuan.choi@gmail.com>2014-03-05 23:52:53 +0900
committerRyuan Choi <ryuan.choi@gmail.com>2014-03-06 00:23:37 +0900
commitea9a029ca3bba2c3bcadfaaa98ff6a36fdeb0ec1 (patch)
treefe1d020e137548fdbac2cb329bceb18ce273b540 /src/lib
parent8e20785b6b3a52e4654d8de98dbb46141a857ff3 (diff)
datetime : Enhance launching time more by reducing calls of sizing_eval()
elm_layout_content_set() calls elm_layout_sizing_eval() internally. So, there are many calls in _field_list_arrange() and it takes long time.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elm_datetime.c10
-rw-r--r--src/lib/elm_widget_datetime.h2
2 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/elm_datetime.c b/src/lib/elm_datetime.c
index f5df6bd21..38a68aea0 100644
--- a/src/lib/elm_datetime.c
+++ b/src/lib/elm_datetime.c
@@ -217,9 +217,12 @@ _field_list_arrange(Evas_Object *obj)
217 Datetime_Field *field; 217 Datetime_Field *field;
218 char buf[BUFFER_SIZE]; 218 char buf[BUFFER_SIZE];
219 int idx; 219 int idx;
220 Eina_Bool freeze;
220 221
221 ELM_DATETIME_DATA_GET(obj, sd); 222 ELM_DATETIME_DATA_GET(obj, sd);
222 223
224 freeze = sd->freeze_sizing;
225 sd->freeze_sizing = EINA_TRUE;
223 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++) 226 for (idx = 0; idx < ELM_DATETIME_TYPE_COUNT; idx++)
224 { 227 {
225 field = sd->field_list + idx; 228 field = sd->field_list + idx;
@@ -233,6 +236,7 @@ _field_list_arrange(Evas_Object *obj)
233 else 236 else
234 evas_object_hide(elm_layout_content_unset(obj, buf)); 237 evas_object_hide(elm_layout_content_unset(obj, buf));
235 } 238 }
239 sd->freeze_sizing = freeze;
236 240
237 elm_layout_sizing_eval(obj); 241 elm_layout_sizing_eval(obj);
238 _field_list_display(obj); 242 _field_list_display(obj);
@@ -502,6 +506,8 @@ _elm_datetime_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
502 Evas_Coord minw = -1, minh = -1; 506 Evas_Coord minw = -1, minh = -1;
503 507
504 Elm_Datetime_Smart_Data *sd = _pd; 508 Elm_Datetime_Smart_Data *sd = _pd;
509 if (sd->freeze_sizing) return;
510
505 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd); 511 ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
506 512
507 if (sd->enabled_field_count) 513 if (sd->enabled_field_count)
@@ -829,6 +835,7 @@ _elm_datetime_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
829 } 835 }
830 } 836 }
831 837
838 priv->freeze_sizing = EINA_TRUE;
832 if (!elm_layout_theme_set(obj, "datetime", "base", 839 if (!elm_layout_theme_set(obj, "datetime", "base",
833 elm_widget_style_get(obj))) 840 elm_widget_style_get(obj)))
834 CRI("Failed to set layout!"); 841 CRI("Failed to set layout!");
@@ -838,6 +845,7 @@ _elm_datetime_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
838 845
839 elm_widget_can_focus_set(obj, EINA_TRUE); 846 elm_widget_can_focus_set(obj, EINA_TRUE);
840 847
848 priv->freeze_sizing = EINA_FALSE;
841 elm_layout_sizing_eval(obj); 849 elm_layout_sizing_eval(obj);
842 850
843 // ACCESS 851 // ACCESS
@@ -992,6 +1000,7 @@ _field_visible_set(Eo *obj, void *_pd, va_list *list)
992 1000
993 field->visible = visible; 1001 field->visible = visible;
994 1002
1003 sd->freeze_sizing = EINA_TRUE;
995 if (visible) 1004 if (visible)
996 { 1005 {
997 sd->enabled_field_count++; 1006 sd->enabled_field_count++;
@@ -1025,6 +1034,7 @@ _field_visible_set(Eo *obj, void *_pd, va_list *list)
1025 snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location); 1034 snprintf(buf, sizeof(buf), EDC_PART_FIELD_STR, field->location);
1026 evas_object_hide(elm_layout_content_unset(obj, buf)); 1035 evas_object_hide(elm_layout_content_unset(obj, buf));
1027 } 1036 }
1037 sd->freeze_sizing = EINA_FALSE;
1028 1038
1029 elm_layout_sizing_eval(obj); 1039 elm_layout_sizing_eval(obj);
1030 1040
diff --git a/src/lib/elm_widget_datetime.h b/src/lib/elm_widget_datetime.h
index 58e25ff67..12bdd6d65 100644
--- a/src/lib/elm_widget_datetime.h
+++ b/src/lib/elm_widget_datetime.h
@@ -65,6 +65,8 @@ struct _Elm_Datetime_Smart_Data
65 Eina_Bool user_format : 1; /* whether user set 65 Eina_Bool user_format : 1; /* whether user set
66 * format or default 66 * format or default
67 * format. */ 67 * format. */
68 Eina_Bool freeze_sizing : 1; /* freeze sizing_eval to
69 * reduce unnecessary sizing */
68}; 70};
69 71
70struct _Format_Map 72struct _Format_Map