From fe7118ec677efe2f0d504a44e7846a731c2ccbc3 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Thu, 30 May 2013 02:31:38 +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 --- legacy/elementary/ChangeLog | 4 ++ legacy/elementary/NEWS | 1 + legacy/elementary/src/lib/elm_mapbuf.c | 46 +++++++++++++++++-- legacy/elementary/src/lib/elm_widget_mapbuf.h | 1 + 4 files changed, 48 insertions(+), 4 deletions(-) diff --git a/legacy/elementary/ChangeLog b/legacy/elementary/ChangeLog index 4a84c0ffaa..d898765654 100644 --- a/legacy/elementary/ChangeLog +++ b/legacy/elementary/ChangeLog @@ -1376,3 +1376,7 @@ 2013-05-27 Seunggyun Kim * Add elm_config_glayer_long_tap_start_timeout_set/get, elm_config_glayer_double_tap_timeout_set/get + +2013-05-30 ChunEon Park + * Fix the mapbuf to be enabled before it's content is entirely rendered + once. diff --git a/legacy/elementary/NEWS b/legacy/elementary/NEWS index 4b96479eb6..a41f745dda 100644 --- a/legacy/elementary/NEWS +++ b/legacy/elementary/NEWS @@ -235,6 +235,7 @@ Fixes: * Fix ctxpopup can't be called again in the mobile mode entry. * Fix colorselector color change but when palette item is selected. * Fix elm_colorselector does not emit "changed" when clicked color palatte. + * Fix elm_mapbuf to be enabled before it's content is entirely rendered once. this will reduce the cases that content is not updated in the screen. Removals: diff --git a/legacy/elementary/src/lib/elm_mapbuf.c b/legacy/elementary/src/lib/elm_mapbuf.c index eb301c43e4..d35adc1b9d 100644 --- a/legacy/elementary/src/lib/elm_mapbuf.c +++ b/legacy/elementary/src/lib/elm_mapbuf.c @@ -118,16 +118,40 @@ _configure(Evas_Object *obj, Eina_Bool update_force) Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS); 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(wd->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); evas_nochange_push(e); evas_object_move(sd->content, x, y); @@ -215,6 +239,17 @@ _elm_mapbuf_smart_hide(Eo *obj, void *_pd, va_list *list EINA_UNUSED) _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 void _elm_mapbuf_smart_content_set(Eo *obj, void *_pd, va_list *list) { @@ -250,6 +285,7 @@ _elm_mapbuf_smart_content_set(Eo *obj, void *_pd, va_list *list) else evas_object_color_set(wd->resize_obj, 0, 0, 0, 0); + _elm_mapbuf_inside_view_reset(obj); _sizing_eval(obj); _configure(obj, EINA_TRUE); @@ -358,8 +394,10 @@ _internal_enable_set(Eo *obj, Elm_Mapbuf_Smart_Data *sd, Eina_Bool enabled) 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); + _configure(obj, EINA_TRUE); } static void diff --git a/legacy/elementary/src/lib/elm_widget_mapbuf.h b/legacy/elementary/src/lib/elm_widget_mapbuf.h index c9ca063559..8bb79cad76 100644 --- a/legacy/elementary/src/lib/elm_widget_mapbuf.h +++ b/legacy/elementary/src/lib/elm_widget_mapbuf.h @@ -25,6 +25,7 @@ struct _Elm_Mapbuf_Smart_Data Ecore_Idler *idler; + Eina_Bool inside_view[4]; Eina_Bool enabled : 1; Eina_Bool smooth_saved : 1; Eina_Bool smooth : 1;