diff options
author | Mike Blumenkrantz <zmike@samsung.com> | 2019-01-16 15:02:43 -0500 |
---|---|---|
committer | Cedric BAIL <cedric.bail@free.fr> | 2019-02-11 15:10:45 -0800 |
commit | 56dbd2bf86286dead989b4983886e923ca944d9c (patch) | |
tree | f3f7e0cccaeaddfe2682eb66c5eb5b9e9368f7c2 | |
parent | 4ff180ac6a9d2b5912cf64cb02270f88c81b738f (diff) | |
download | efl-56dbd2bf86286dead989b4983886e923ca944d9c.tar.gz |
edje: apply maps to textblock cursors and backgrounds
when a map is applied to an edje part, it is expected that all components of
the part respect the map attributes. this requires that, in the case of
textblock parts, all the sub-parts which are internal to the textblock
(entry) object also go through the map populate and apply codepaths
fix T4977
@fix
Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D7648
-rw-r--r-- | src/lib/edje/edje_calc.c | 27 | ||||
-rw-r--r-- | src/lib/edje/edje_entry.c | 18 | ||||
-rw-r--r-- | src/lib/edje/edje_private.h | 3 |
3 files changed, 45 insertions, 3 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index a050edcdca..cdfcc81732 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3541,7 +3541,7 @@ _map_colors_interp(Edje_Calc_Params *p1, Edje_Calc_Params *p2, static void _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, Edje_Part_Description_Common *chosen_desc, - Edje_Real_Part *ep, Evas_Object *mo) + Edje_Real_Part *ep, Evas_Object *mo, Evas_Object *populate_obj) { Edje_Map_Color *color, **colors; int colors_cnt, i; @@ -3551,7 +3551,7 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, colors = pf->ext->map->colors; colors_cnt = pf->ext->map->colors_count; - evas_map_util_points_populate_from_object(map, ep->object); + evas_map_util_points_populate_from_object(map, populate_obj ?: ep->object); if (ep->part->type == EDJE_PART_TYPE_IMAGE || ((ep->part->type == EDJE_PART_TYPE_SWALLOW) && @@ -5047,10 +5047,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta if (ep->part->type != EDJE_PART_TYPE_SPACER) { Evas_Object *map_obj; + Evas_Object *cursor_objs[EDJE_ENTRY_NUM_CURSOR_OBJS]; + int c = 0, num_cursors = 0; /* Apply map to smart obj holding nested parts */ if (ep->nested_smart) map_obj = ep->nested_smart; else map_obj = mo; + if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) + num_cursors = _edje_entry_real_part_cursor_objs_get(ep, cursor_objs); if (chosen_desc->map.on) { @@ -5060,12 +5064,21 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta // create map and populate with part geometry if (!map) map = evas_map_new(4); - _edje_map_prop_set(map, pf, chosen_desc, ep, mo); + _edje_map_prop_set(map, pf, chosen_desc, ep, mo, NULL); if (map_obj) { evas_object_map_set(map_obj, map); evas_object_map_enable_set(map_obj, EINA_TRUE); + if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) + { + for (c = 0; c < num_cursors; c++) + { + _edje_map_prop_set(map, pf, chosen_desc, ep, mo, cursor_objs[c]); + evas_object_map_set(cursor_objs[c], map); + evas_object_map_enable_set(cursor_objs[c], EINA_TRUE); + } + } } } else @@ -5079,6 +5092,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta #endif evas_object_map_enable_set(mo, EINA_FALSE); evas_object_map_set(mo, NULL); + if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) + { + for (c = 0; c < num_cursors; c++) + { + evas_object_map_enable_set(cursor_objs[c], EINA_FALSE); + evas_object_map_set(cursor_objs[c], NULL); + } + } #ifdef HAVE_EPHYSICS } #endif diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c index da0bc81674..5783fabbc7 100644 --- a/src/lib/edje/edje_entry.c +++ b/src/lib/edje/edje_entry.c @@ -27,6 +27,7 @@ struct _Entry Evas_Coord ox, oy; Evas_Object *cursor_bg; Evas_Object *cursor_fg, *cursor_fg2; +/* CHANGE EDJE_ENTRY_NUM_CURSOR_OBJS IF YOU ADD MORE OBJECTS HERE */ Evas_Textblock_Cursor *cursor; Evas_Textblock_Cursor *sel_start, *sel_end; Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; @@ -2915,6 +2916,23 @@ _edje_entry_shutdown(Edje *ed) _evas_focus_out_cb, ed); } +int +_edje_entry_real_part_cursor_objs_get(Edje_Real_Part *rp, Evas_Object **cursor_objs) +{ + Entry *en; + int ret = 0; + + if ((rp->type != EDJE_RP_TYPE_TEXT) || + (!rp->typedata.text) || (!rp->typedata.text->entry_data)) return -1; + + en = rp->typedata.text->entry_data; + + if (en->cursor_bg) cursor_objs[ret++] = en->cursor_bg; + if (en->cursor_fg) cursor_objs[ret++] = en->cursor_fg; + if (en->cursor_fg2) cursor_objs[ret++] = en->cursor_fg2; + return ret; +} + void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 3721d28bdf..98311b8525 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -189,6 +189,8 @@ EAPI extern int _edje_default_log_dom ; #endif +#define EDJE_ENTRY_NUM_CURSOR_OBJS 3 + /* Inheritable Edje Smart API. For now private so only Edje Edit makes * use of this, but who knows what will be possible in the future */ #define EDJE_SMART_API_VERSION 1 @@ -2886,6 +2888,7 @@ void _edje_lua_script_only_message(Edje *ed, Edje_Message *em); void _edje_entry_init(Edje *ed); void _edje_entry_shutdown(Edje *ed); +int _edje_entry_real_part_cursor_objs_get(Edje_Real_Part *rp, Evas_Object **objs); void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp); void _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp); void _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp); |