summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2016-03-16 22:36:27 +0900
committerYoungbok Shin <youngb.shin@samsung.com>2016-03-17 15:27:46 +0900
commite0f4718982ec25d01dffdde25c694aa7af4f4304 (patch)
tree6a77881ce6a43790b07eb203c88074c8c05a87e7
parenta73f121a5d1b9c5bae1612e9587094bcb873653c (diff)
Entry: Remove deferred_recalc_job
It could break consistency of size calculation.
-rw-r--r--src/lib/elm_entry.c118
-rw-r--r--src/lib/elm_widget_entry.h2
2 files changed, 28 insertions, 92 deletions
diff --git a/src/lib/elm_entry.c b/src/lib/elm_entry.c
index 6bb2df166..6cba723ae 100644
--- a/src/lib/elm_entry.c
+++ b/src/lib/elm_entry.c
@@ -924,95 +924,18 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
924static void 924static void
925_cursor_geometry_recalc(Evas_Object *obj) 925_cursor_geometry_recalc(Evas_Object *obj)
926{ 926{
927 Evas_Coord cx, cy, cw, ch;
928
927 ELM_ENTRY_DATA_GET(obj, sd); 929 ELM_ENTRY_DATA_GET(obj, sd);
928 930
929 eo_event_callback_call(obj, ELM_ENTRY_EVENT_CURSOR_CHANGED, NULL); 931 eo_event_callback_call(obj, ELM_ENTRY_EVENT_CURSOR_CHANGED, NULL);
930 932
931 if (!sd->deferred_recalc_job) 933 edje_object_part_text_cursor_geometry_get
932 { 934 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
933 Evas_Coord cx, cy, cw, ch; 935 if (sd->cur_changed)
934
935 edje_object_part_text_cursor_geometry_get
936 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
937 if (sd->cur_changed)
938 {
939 sd->cur_changed = EINA_FALSE;
940 elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
941 }
942 }
943 else
944 sd->deferred_cur = EINA_TRUE;
945}
946
947static void
948_deferred_recalc_job(void *data)
949{
950 Evas_Coord minh = -1, resw = -1, minw = -1, fw = 0, fh = 0;
951
952 ELM_ENTRY_DATA_GET(data, sd);
953
954 sd->deferred_recalc_job = NULL;
955
956 evas_object_geometry_get(sd->entry_edje, NULL, NULL, &resw, NULL);
957 edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
958 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
959
960 /* This is a hack to workaround the way min size hints are treated.
961 * If the minimum width is smaller than the restricted width, it
962 * means the minimum doesn't matter. */
963 if (minw <= resw)
964 {
965 Evas_Coord ominw = -1;
966
967 evas_object_size_hint_min_get(data, &ominw, NULL);
968 minw = ominw;
969 }
970
971 sd->ent_mw = minw;
972 sd->ent_mh = minh;
973
974 elm_coords_finger_size_adjust(1, &fw, 1, &fh);
975 if (sd->scroll)
976 {
977 Evas_Coord vmw = 0, vmh = 0;
978
979 edje_object_size_min_calc(sd->scr_edje, &vmw, &vmh);
980 if (sd->single_line)
981 {
982 evas_object_size_hint_min_set(data, vmw, minh + vmh);
983 evas_object_size_hint_max_set(data, -1, minh + vmh);
984 }
985 else
986 {
987 evas_object_size_hint_min_set(data, vmw, vmh);
988 evas_object_size_hint_max_set(data, -1, -1);
989 }
990 }
991 else
992 {
993 if (sd->single_line)
994 {
995 evas_object_size_hint_min_set(data, minw, minh);
996 evas_object_size_hint_max_set(data, -1, minh);
997 }
998 else
999 {
1000 evas_object_size_hint_min_set(data, fw, minh);
1001 evas_object_size_hint_max_set(data, -1, -1);
1002 }
1003 }
1004
1005 if (sd->deferred_cur)
1006 { 936 {
1007 Evas_Coord cx, cy, cw, ch; 937 sd->cur_changed = EINA_FALSE;
1008 938 elm_widget_show_region_set(obj, cx, cy, cw, ch, EINA_FALSE);
1009 edje_object_part_text_cursor_geometry_get
1010 (sd->entry_edje, "elm.text", &cx, &cy, &cw, &ch);
1011 if (sd->cur_changed)
1012 {
1013 sd->cur_changed = EINA_FALSE;
1014 elm_widget_show_region_set(data, cx, cy, cw, ch, EINA_FALSE);
1015 }
1016 } 939 }
1017} 940}
1018 941
@@ -1090,10 +1013,28 @@ _elm_entry_elm_layout_sizing_eval(Eo *obj, Elm_Entry_Data *sd)
1090 else 1013 else
1091 evas_object_size_hint_max_set(obj, -1, -1); 1014 evas_object_size_hint_max_set(obj, -1, -1);
1092 } 1015 }
1093 else if (!sd->deferred_recalc_job) 1016 else if (resw > 0)
1094 { 1017 {
1095 sd->deferred_recalc_job = 1018 Evas_Coord fw = 0;
1096 ecore_job_add(_deferred_recalc_job, obj); 1019
1020 edje_object_size_min_restricted_calc(sd->entry_edje, &minw, &minh, resw, 0);
1021 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
1022 evas_object_resize(sd->entry_edje, minw, minh);
1023
1024 if (minw <= resw)
1025 {
1026 Evas_Coord ominw = -1;
1027
1028 evas_object_size_hint_min_get(obj, &ominw, NULL);
1029 minw = ominw;
1030 }
1031
1032 sd->ent_mw = minw;
1033 sd->ent_mh = minh;
1034
1035 elm_coords_finger_size_adjust(1, &fw, 1, &minh);
1036 evas_object_size_hint_min_set(obj, fw, minh);
1037 evas_object_size_hint_max_set(obj, -1, -1);
1097 } 1038 }
1098 1039
1099 evas_event_thaw(evas_object_evas_get(obj)); 1040 evas_event_thaw(evas_object_evas_get(obj));
@@ -3759,7 +3700,6 @@ _elm_entry_evas_object_smart_del(Eo *obj, Elm_Entry_Data *sd)
3759 entries = eina_list_remove(entries, obj); 3700 entries = eina_list_remove(entries, obj);
3760 eina_stringshare_del(sd->cut_sel); 3701 eina_stringshare_del(sd->cut_sel);
3761 eina_stringshare_del(sd->text); 3702 eina_stringshare_del(sd->text);
3762 ecore_job_del(sd->deferred_recalc_job);
3763 if (sd->append_text_idler) 3703 if (sd->append_text_idler)
3764 { 3704 {
3765 ecore_idler_del(sd->append_text_idler); 3705 ecore_idler_del(sd->append_text_idler);
@@ -4103,8 +4043,6 @@ _elm_entry_line_wrap_set(Eo *obj, Elm_Entry_Data *sd, Elm_Wrap_Type wrap)
4103 if (sd->line_wrap == wrap) return; 4043 if (sd->line_wrap == wrap) return;
4104 sd->last_w = -1; 4044 sd->last_w = -1;
4105 sd->line_wrap = wrap; 4045 sd->line_wrap = wrap;
4106 if (wrap == ELM_WRAP_NONE)
4107 ELM_SAFE_FREE(sd->deferred_recalc_job, ecore_job_del);
4108 elm_obj_widget_theme_apply(obj); 4046 elm_obj_widget_theme_apply(obj);
4109} 4047}
4110 4048
diff --git a/src/lib/elm_widget_entry.h b/src/lib/elm_widget_entry.h
index e2c21eb20..9bf3452c8 100644
--- a/src/lib/elm_widget_entry.h
+++ b/src/lib/elm_widget_entry.h
@@ -37,7 +37,6 @@ struct _Elm_Entry_Data
37 Evas_Object *mgf_proxy; 37 Evas_Object *mgf_proxy;
38 Evas_Object *start_handler; 38 Evas_Object *start_handler;
39 Evas_Object *end_handler; 39 Evas_Object *end_handler;
40 Ecore_Job *deferred_recalc_job;
41 Ecore_Timer *longpress_timer; 40 Ecore_Timer *longpress_timer;
42 Ecore_Timer *delay_write; 41 Ecore_Timer *delay_write;
43 /* for deferred appending */ 42 /* for deferred appending */
@@ -94,7 +93,6 @@ struct _Elm_Entry_Data
94 Eina_Bool selection_asked : 1; 93 Eina_Bool selection_asked : 1;
95 Eina_Bool auto_return_key : 1; 94 Eina_Bool auto_return_key : 1;
96 Eina_Bool have_selection : 1; 95 Eina_Bool have_selection : 1;
97 Eina_Bool deferred_cur : 1;
98 Eina_Bool context_menu : 1; 96 Eina_Bool context_menu : 1;
99 Eina_Bool long_pressed : 1; 97 Eina_Bool long_pressed : 1;
100 Eina_Bool cur_changed : 1; 98 Eina_Bool cur_changed : 1;