summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2017-07-12 18:37:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-07-12 18:37:50 +0900
commite81be3a664737dd5743552578e832656e9c5b87e (patch)
treedceec36d350f398f19949133834ddfdd59506d47 /src/lib/edje
parent9513fed85ea00637745362a5a34083da3d230f22 (diff)
edje: give proper width to entry's cursor according to its theme
Summary: evas_object_textblock_cursor_geometry_get() always return 0 as cursor's width for BEFORE type cursor. It casued different cursor width when cursor_fg2 was shown. The cursor_fg and cursor_fg2 must have same width according to its min width. Also, the patch will enclose code for cursor_fg2 by cursor_fg code. It is used when only there is cursor_fg. @fix Test Plan: 1. Give bigger width to entry's cursor by changing its theme. 2. See the width cursor_fg, cursor_fg2 when there is [LTR text + RTL text]. Reviewers: raster, herdsman, cedric, jpeg Subscribers: stefan_schmidt Differential Revision: https://phab.enlightenment.org/D4798
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_entry.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index 8dcc2af1ec..2b3d6449fb 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -2966,18 +2966,18 @@ _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
2966 evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object)); 2966 evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object));
2967 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); 2967 evas_object_pass_events_set(en->cursor_fg, EINA_TRUE);
2968 _edje_subobj_register(ed, en->cursor_fg); 2968 _edje_subobj_register(ed, en->cursor_fg);
2969 } 2969
2970 /* A proxy to the main cursor. */ 2970 /* A proxy to the main cursor. */
2971 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) 2971 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
2972 { 2972 {
2973 en->cursor_fg2 = evas_object_image_add(ed->base->evas); 2973 en->cursor_fg2 = edje_object_add(ed->base->evas);
2974 evas_object_image_source_set(en->cursor_fg2, en->cursor_fg); 2974 edje_object_file_set(en->cursor_fg2, ed->path, rp->part->source4);
2975 evas_object_image_fill_set(en->cursor_fg2, 0, 0, 1, 1); 2975 evas_object_smart_member_add(en->cursor_fg2, ed->obj);
2976 evas_object_smart_member_add(en->cursor_fg2, ed->obj); 2976 evas_object_stack_above(en->cursor_fg2, rp->object);
2977 evas_object_stack_above(en->cursor_fg2, rp->object); 2977 evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object));
2978 evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object)); 2978 evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE);
2979 evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE); 2979 _edje_subobj_register(ed, en->cursor_fg2);
2980 _edje_subobj_register(en->ed, en->cursor_fg2); 2980 }
2981 } 2981 }
2982 2982
2983 evas_object_textblock_legacy_newline_set(rp->object, EINA_TRUE); 2983 evas_object_textblock_legacy_newline_set(rp->object, EINA_TRUE);
@@ -3152,27 +3152,38 @@ _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp)
3152 if (hh < 1) hh = 1; 3152 if (hh < 1) hh = 1;
3153 if (en->cursor_bg) 3153 if (en->cursor_bg)
3154 { 3154 {
3155 int bg_w = ww;
3156
3157 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
3158 edje_object_size_min_restricted_calc(en->cursor_bg, &bg_w, NULL, ww, 0);
3159
3155 evas_object_move(en->cursor_bg, x + xx, y + yy); 3160 evas_object_move(en->cursor_bg, x + xx, y + yy);
3156 evas_object_resize(en->cursor_bg, ww, hh); 3161 evas_object_resize(en->cursor_bg, bg_w, hh);
3157 } 3162 }
3158 if (en->cursor_fg) 3163 if (en->cursor_fg)
3159 { 3164 {
3165 int fg_w = ww;
3166
3167 if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE)
3168 edje_object_size_min_restricted_calc(en->cursor_fg, &fg_w, NULL, ww, 0);
3169
3160 evas_object_move(en->cursor_fg, x + xx, y + yy); 3170 evas_object_move(en->cursor_fg, x + xx, y + yy);
3161 evas_object_resize(en->cursor_fg, ww, hh); 3171
3162 }
3163 if (en->cursor_fg2)
3164 {
3165 if (bidi_cursor) 3172 if (bidi_cursor)
3166 { 3173 {
3167 evas_object_image_fill_set(en->cursor_fg2, 0, 0, ww, hh / 2); 3174 if (en->cursor_fg2)
3168 evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2)); 3175 {
3169 evas_object_resize(en->cursor_fg, ww, hh / 2); 3176 evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2));
3170 evas_object_resize(en->cursor_fg2, ww, hh / 2); 3177 evas_object_resize(en->cursor_fg, fg_w, hh / 2);
3171 evas_object_show(en->cursor_fg2); 3178 evas_object_resize(en->cursor_fg2, fg_w, hh / 2);
3179 evas_object_show(en->cursor_fg2);
3180 }
3172 } 3181 }
3173 else 3182 else
3174 { 3183 {
3175 evas_object_hide(en->cursor_fg2); 3184 evas_object_resize(en->cursor_fg, fg_w, hh);
3185 if (en->cursor_fg2)
3186 evas_object_hide(en->cursor_fg2);
3176 } 3187 }
3177 } 3188 }
3178 } 3189 }