summaryrefslogtreecommitdiff
path: root/src/lib/edje
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-01-16 15:02:43 -0500
committerCedric BAIL <cedric.bail@free.fr>2019-02-11 15:10:45 -0800
commit56dbd2bf86286dead989b4983886e923ca944d9c (patch)
treef3f7e0cccaeaddfe2682eb66c5eb5b9e9368f7c2 /src/lib/edje
parent4ff180ac6a9d2b5912cf64cb02270f88c81b738f (diff)
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
Diffstat (limited to 'src/lib/edje')
-rw-r--r--src/lib/edje/edje_calc.c27
-rw-r--r--src/lib/edje/edje_entry.c18
-rw-r--r--src/lib/edje/edje_private.h3
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,
3541static void 3541static void
3542_edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf, 3542_edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf,
3543 Edje_Part_Description_Common *chosen_desc, 3543 Edje_Part_Description_Common *chosen_desc,
3544 Edje_Real_Part *ep, Evas_Object *mo) 3544 Edje_Real_Part *ep, Evas_Object *mo, Evas_Object *populate_obj)
3545{ 3545{
3546 Edje_Map_Color *color, **colors; 3546 Edje_Map_Color *color, **colors;
3547 int colors_cnt, i; 3547 int colors_cnt, i;
@@ -3551,7 +3551,7 @@ _edje_map_prop_set(Evas_Map *map, const Edje_Calc_Params *pf,
3551 colors = pf->ext->map->colors; 3551 colors = pf->ext->map->colors;
3552 colors_cnt = pf->ext->map->colors_count; 3552 colors_cnt = pf->ext->map->colors_count;
3553 3553
3554 evas_map_util_points_populate_from_object(map, ep->object); 3554 evas_map_util_points_populate_from_object(map, populate_obj ?: ep->object);
3555 3555
3556 if (ep->part->type == EDJE_PART_TYPE_IMAGE || 3556 if (ep->part->type == EDJE_PART_TYPE_IMAGE ||
3557 ((ep->part->type == EDJE_PART_TYPE_SWALLOW) && 3557 ((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
5047 if (ep->part->type != EDJE_PART_TYPE_SPACER) 5047 if (ep->part->type != EDJE_PART_TYPE_SPACER)
5048 { 5048 {
5049 Evas_Object *map_obj; 5049 Evas_Object *map_obj;
5050 Evas_Object *cursor_objs[EDJE_ENTRY_NUM_CURSOR_OBJS];
5051 int c = 0, num_cursors = 0;
5050 5052
5051 /* Apply map to smart obj holding nested parts */ 5053 /* Apply map to smart obj holding nested parts */
5052 if (ep->nested_smart) map_obj = ep->nested_smart; 5054 if (ep->nested_smart) map_obj = ep->nested_smart;
5053 else map_obj = mo; 5055 else map_obj = mo;
5056 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
5057 num_cursors = _edje_entry_real_part_cursor_objs_get(ep, cursor_objs);
5054 5058
5055 if (chosen_desc->map.on) 5059 if (chosen_desc->map.on)
5056 { 5060 {
@@ -5060,12 +5064,21 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5060 // create map and populate with part geometry 5064 // create map and populate with part geometry
5061 if (!map) map = evas_map_new(4); 5065 if (!map) map = evas_map_new(4);
5062 5066
5063 _edje_map_prop_set(map, pf, chosen_desc, ep, mo); 5067 _edje_map_prop_set(map, pf, chosen_desc, ep, mo, NULL);
5064 5068
5065 if (map_obj) 5069 if (map_obj)
5066 { 5070 {
5067 evas_object_map_set(map_obj, map); 5071 evas_object_map_set(map_obj, map);
5068 evas_object_map_enable_set(map_obj, EINA_TRUE); 5072 evas_object_map_enable_set(map_obj, EINA_TRUE);
5073 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
5074 {
5075 for (c = 0; c < num_cursors; c++)
5076 {
5077 _edje_map_prop_set(map, pf, chosen_desc, ep, mo, cursor_objs[c]);
5078 evas_object_map_set(cursor_objs[c], map);
5079 evas_object_map_enable_set(cursor_objs[c], EINA_TRUE);
5080 }
5081 }
5069 } 5082 }
5070 } 5083 }
5071 else 5084 else
@@ -5079,6 +5092,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
5079#endif 5092#endif
5080 evas_object_map_enable_set(mo, EINA_FALSE); 5093 evas_object_map_enable_set(mo, EINA_FALSE);
5081 evas_object_map_set(mo, NULL); 5094 evas_object_map_set(mo, NULL);
5095 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
5096 {
5097 for (c = 0; c < num_cursors; c++)
5098 {
5099 evas_object_map_enable_set(cursor_objs[c], EINA_FALSE);
5100 evas_object_map_set(cursor_objs[c], NULL);
5101 }
5102 }
5082#ifdef HAVE_EPHYSICS 5103#ifdef HAVE_EPHYSICS
5083 } 5104 }
5084#endif 5105#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
27 Evas_Coord ox, oy; 27 Evas_Coord ox, oy;
28 Evas_Object *cursor_bg; 28 Evas_Object *cursor_bg;
29 Evas_Object *cursor_fg, *cursor_fg2; 29 Evas_Object *cursor_fg, *cursor_fg2;
30/* CHANGE EDJE_ENTRY_NUM_CURSOR_OBJS IF YOU ADD MORE OBJECTS HERE */
30 Evas_Textblock_Cursor *cursor; 31 Evas_Textblock_Cursor *cursor;
31 Evas_Textblock_Cursor *sel_start, *sel_end; 32 Evas_Textblock_Cursor *sel_start, *sel_end;
32 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra; 33 Evas_Textblock_Cursor *cursor_user, *cursor_user_extra;
@@ -2915,6 +2916,23 @@ _edje_entry_shutdown(Edje *ed)
2915 _evas_focus_out_cb, ed); 2916 _evas_focus_out_cb, ed);
2916} 2917}
2917 2918
2919int
2920_edje_entry_real_part_cursor_objs_get(Edje_Real_Part *rp, Evas_Object **cursor_objs)
2921{
2922 Entry *en;
2923 int ret = 0;
2924
2925 if ((rp->type != EDJE_RP_TYPE_TEXT) ||
2926 (!rp->typedata.text) || (!rp->typedata.text->entry_data)) return -1;
2927
2928 en = rp->typedata.text->entry_data;
2929
2930 if (en->cursor_bg) cursor_objs[ret++] = en->cursor_bg;
2931 if (en->cursor_fg) cursor_objs[ret++] = en->cursor_fg;
2932 if (en->cursor_fg2) cursor_objs[ret++] = en->cursor_fg2;
2933 return ret;
2934}
2935
2918void 2936void
2919_edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp) 2937_edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp)
2920{ 2938{
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 ;
189 189
190#endif 190#endif
191 191
192#define EDJE_ENTRY_NUM_CURSOR_OBJS 3
193
192/* Inheritable Edje Smart API. For now private so only Edje Edit makes 194/* Inheritable Edje Smart API. For now private so only Edje Edit makes
193 * use of this, but who knows what will be possible in the future */ 195 * use of this, but who knows what will be possible in the future */
194#define EDJE_SMART_API_VERSION 1 196#define EDJE_SMART_API_VERSION 1
@@ -2886,6 +2888,7 @@ void _edje_lua_script_only_message(Edje *ed, Edje_Message *em);
2886 2888
2887void _edje_entry_init(Edje *ed); 2889void _edje_entry_init(Edje *ed);
2888void _edje_entry_shutdown(Edje *ed); 2890void _edje_entry_shutdown(Edje *ed);
2891int _edje_entry_real_part_cursor_objs_get(Edje_Real_Part *rp, Evas_Object **objs);
2889void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp); 2892void _edje_entry_real_part_init(Edje *ed, Edje_Real_Part *rp);
2890void _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp); 2893void _edje_entry_real_part_shutdown(Edje *ed, Edje_Real_Part *rp);
2891void _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp); 2894void _edje_entry_real_part_configure(Edje *ed, Edje_Real_Part *rp);