jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e81be3a664737dd5743552578e832656e9c5b87e
commit e81be3a664737dd5743552578e832656e9c5b87e Author: Youngbok Shin <youngb.s...@samsung.com> Date: Wed Jul 12 18:37:50 2017 +0900 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 --- src/lib/edje/edje_entry.c | 57 ++++++++++++++++++++++++++++------------------- 1 file 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) evas_object_clip_set(en->cursor_fg, evas_object_clip_get(rp->object)); evas_object_pass_events_set(en->cursor_fg, EINA_TRUE); _edje_subobj_register(ed, en->cursor_fg); - } - /* A proxy to the main cursor. */ - if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) - { - en->cursor_fg2 = evas_object_image_add(ed->base->evas); - evas_object_image_source_set(en->cursor_fg2, en->cursor_fg); - evas_object_image_fill_set(en->cursor_fg2, 0, 0, 1, 1); - evas_object_smart_member_add(en->cursor_fg2, ed->obj); - evas_object_stack_above(en->cursor_fg2, rp->object); - evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object)); - evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE); - _edje_subobj_register(en->ed, en->cursor_fg2); + + /* A proxy to the main cursor. */ + if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) + { + en->cursor_fg2 = edje_object_add(ed->base->evas); + edje_object_file_set(en->cursor_fg2, ed->path, rp->part->source4); + evas_object_smart_member_add(en->cursor_fg2, ed->obj); + evas_object_stack_above(en->cursor_fg2, rp->object); + evas_object_clip_set(en->cursor_fg2, evas_object_clip_get(rp->object)); + evas_object_pass_events_set(en->cursor_fg2, EINA_TRUE); + _edje_subobj_register(ed, en->cursor_fg2); + } } 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) if (hh < 1) hh = 1; if (en->cursor_bg) { + int bg_w = ww; + + if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) + edje_object_size_min_restricted_calc(en->cursor_bg, &bg_w, NULL, ww, 0); + evas_object_move(en->cursor_bg, x + xx, y + yy); - evas_object_resize(en->cursor_bg, ww, hh); + evas_object_resize(en->cursor_bg, bg_w, hh); } if (en->cursor_fg) { + int fg_w = ww; + + if (rp->part->cursor_mode == EDJE_ENTRY_CURSOR_MODE_BEFORE) + edje_object_size_min_restricted_calc(en->cursor_fg, &fg_w, NULL, ww, 0); + evas_object_move(en->cursor_fg, x + xx, y + yy); - evas_object_resize(en->cursor_fg, ww, hh); - } - if (en->cursor_fg2) - { + if (bidi_cursor) { - evas_object_image_fill_set(en->cursor_fg2, 0, 0, ww, hh / 2); - evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2)); - evas_object_resize(en->cursor_fg, ww, hh / 2); - evas_object_resize(en->cursor_fg2, ww, hh / 2); - evas_object_show(en->cursor_fg2); + if (en->cursor_fg2) + { + evas_object_move(en->cursor_fg2, x + xx2, y + yy2 + (hh / 2)); + evas_object_resize(en->cursor_fg, fg_w, hh / 2); + evas_object_resize(en->cursor_fg2, fg_w, hh / 2); + evas_object_show(en->cursor_fg2); + } } else { - evas_object_hide(en->cursor_fg2); + evas_object_resize(en->cursor_fg, fg_w, hh); + if (en->cursor_fg2) + evas_object_hide(en->cursor_fg2); } } } --