From b5622690da3d65b22c4a84356d32679435e842f2 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 30 May 2013 02:34:54 +0900 Subject: [PATCH] elementary/mapbuf - fix the mapbuf to be enabled before it's content is entirely rendered. This will fix the bad-cases that content is not updated properly if they are changed outside of the viewport commit 1850e735698f926cad8303cfe96610b5c58410d1 Author: ChunEon Park @hermet.pe.kr> Date: Thu May 30 02:31:38 2013 +0900 Change-Id: I380ebbc7ac9ecd738c2978b1ce2843ae7c0e542b --- src/lib/elm_mapbuf.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- src/lib/elm_widget_mapbuf.h | 1 + 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/lib/elm_mapbuf.c b/src/lib/elm_mapbuf.c index a7b31e9..865c717 100644 --- a/src/lib/elm_mapbuf.c +++ b/src/lib/elm_mapbuf.c @@ -103,16 +103,41 @@ _configure(Evas_Object *obj, Eina_Bool update_force) ELM_MAPBUF_DATA_GET(obj, sd); if (!sd->content) return; - Evas_Coord x, y, w, h, x2, y2, w2, h2; + Eina_Bool inside_all = EINA_FALSE; + Evas_Coord x, y, w, h, x2, y2, w2, h2, vx, vy, vw, vh; evas_object_geometry_get(ELM_WIDGET_DATA(sd)->resize_obj, &x, &y, &w, &h); evas_object_geometry_get(sd->content, &x2, &y2, &w2, &h2); + if ((update_force) || ((x != x2) || (y != y2) || (w != w2) || (h != h2))) { - if (!sd->enabled) + Evas *e = evas_object_evas_get(obj); + evas_output_viewport_get(e, &vx, &vy, &vw, &vh); + + /* Apply no changes once the content is rendered fully one time. We + aren't sure that the content is updated correctly if the content was + outside of the viewport, especially it has many child members. Some + type of children will do the lazy updated (ie, textblock) on right + before the rendering. It means they lose the update time cause + of the mapbuf since the mapbuf tries nochange forcefully. */ + if (!sd->inside_view[0] && ((x >= vx) && (x <= (vx + vw)))) + sd->inside_view[0] = EINA_TRUE; + if (!sd->inside_view[1] && ((y >= vy) && (y <= (vy + vh)))) + sd->inside_view[1] = EINA_TRUE; + + if (!sd->inside_view[2] && (((x + w) >= vx) && ((x + w) <= (vx + vw)))) + sd->inside_view[2] = EINA_TRUE; + + if (!sd->inside_view[3] && (((y + h) >= vy) && ((y + h) <= (vy + vh)))) + sd->inside_view[3] = EINA_TRUE; + + if (sd->inside_view[0] && sd->inside_view[1] && sd->inside_view[2] && + sd->inside_view[3]) + inside_all = EINA_TRUE; + + if (!sd->enabled || !inside_all) evas_object_move(sd->content, x, y); else { - Evas *e = evas_object_evas_get(obj); evas_smart_objects_calculate(e); ELM_WIDGET_CHECK_OR_RETURN(obj); evas_nochange_push(e); @@ -145,6 +170,17 @@ _elm_mapbuf_smart_resize(Evas_Object *obj, _configure(obj, EINA_FALSE); } +static void +_elm_mapbuf_inside_view_reset(Evas_Object *obj) +{ + ELM_MAPBUF_DATA_GET(obj, sd); + + sd->inside_view[0] = EINA_FALSE; + sd->inside_view[1] = EINA_FALSE; + sd->inside_view[2] = EINA_FALSE; + sd->inside_view[3] = EINA_FALSE; +} + static Eina_Bool _elm_mapbuf_smart_content_set(Evas_Object *obj, const char *part, @@ -173,6 +209,8 @@ _elm_mapbuf_smart_content_set(Evas_Object *obj, else evas_object_color_set(ELM_WIDGET_DATA(sd)->resize_obj, 0, 0, 0, 0); + _elm_mapbuf_inside_view_reset(obj); + _sizing_eval(obj); _configure(obj, EINA_TRUE); @@ -317,6 +355,7 @@ elm_mapbuf_enabled_set(Evas_Object *obj, if (sd->enabled == enabled) return; sd->enabled = enabled; + _elm_mapbuf_inside_view_reset(obj); if (sd->content) evas_object_static_clip_set(sd->content, sd->enabled); _configure(obj, EINA_TRUE); } diff --git a/src/lib/elm_widget_mapbuf.h b/src/lib/elm_widget_mapbuf.h index 7d4d8e6..aa527a9 100644 --- a/src/lib/elm_widget_mapbuf.h +++ b/src/lib/elm_widget_mapbuf.h @@ -125,6 +125,7 @@ struct _Elm_Mapbuf_Smart_Data Evas_Object *content; + Eina_Bool inside_view[4]; Eina_Bool enabled : 1; Eina_Bool smooth : 1; Eina_Bool alpha : 1; -- 2.7.4