[Bug fix] fix CQ H0100134498 about the Conformant Scroll Issue.
authorJaehwan Kim <jae.hwan.kim@samsung.com>
Fri, 18 Nov 2011 12:12:51 +0000 (21:12 +0900)
committerKim Jaehwan <jae.hwan.kim@samsung.com>
Mon, 21 Nov 2011 09:51:35 +0000 (18:51 +0900)
[Reason]
Conformant widget used INVALID(out of date) geometry of a child evas object.

[Solution]
The main point is to use the UPDATED geometry of the child object, but the geometry has yet to be calculated and is queued for calculation later.
Firstly, for efficiency, we add a Job to calculate the whole canvas. Jobs implicitly coallate work per event loop.
Calcuation of object can be a reasonably intensive set of work.
In the job callback we calculate the whole canvas with evas_smart_objects_calculate() to ensure that all objects have the correct geometry at this point.
Reviewed by Raster.

[Change Summary]
<before>
-> Resize genlist in conformant
-> Call elm_widget_show_region_set()
-> Get the evas object's geometry inside the resize event
 (at resize the object does not calculate, instead it queues a calculation to be done at render time for efficiency.)

<After>
-> Resize genlist in conformant
-> Register elm_widget_show_region_set() as an ecore job
-> elm_widget_show_region_set() called by ecore job
-> Call evas_smart_objects_calculate() in order to update geometry before using the geometry in elm_widget_show_region_set()
-> Get the updated geometry

@Raster,
Please review my patch set for fixing this defect.

Change-Id: If56a65968b53af98d540aae6f6d6ef00fb9f4d81

src/lib/elm_conform.c
src/lib/elm_widget.c

index b6c8678..f70ea25 100644 (file)
@@ -29,6 +29,7 @@ struct _Widget_Data
       Evas_Coord auto_x, auto_y; // desired delta
       Evas_Coord x, y; // current delta
    } delta;
+   Ecore_Job *show_region_job;
 };
 
 /* Enum to identify conformant swallow parts */
@@ -72,6 +73,7 @@ static void _conformant_move_resize_event_cb(void *data,
                                              void *event_info);
 #endif
 static void _sizing_eval(Evas_Object *obj);
+static void _show_region_job(void *data);
 static Eina_Bool _prop_change(void *data, int type, void *event);
 static void _changed_size_hints(void *data, Evas *e,
                                 Evas_Object *obj,
@@ -94,6 +96,7 @@ _del_hook(Evas_Object *obj)
    Widget_Data *wd = elm_widget_data_get(obj);
 
    if (!wd) return;
+   if (wd->show_region_job) ecore_job_del(wd->show_region_job);
    free(wd);
 }
 
@@ -382,7 +385,6 @@ static void
 _content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj
                          __UNUSED__, void *event_info __UNUSED__)
 {
-   Evas_Object *focus_obj;
    Evas_Object *conformant = (Evas_Object *)data;
    Widget_Data *wd = elm_widget_data_get(conformant);
 
@@ -392,6 +394,19 @@ _content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj
             && (!wd->is_visible)) return;
 #endif
 
+   if (wd->show_region_job) ecore_job_del(wd->show_region_job);
+   wd->show_region_job = ecore_job_add(_show_region_job, conformant);
+}
+
+static void
+_show_region_job(void *data)
+{
+   Evas_Object *focus_obj;
+   Evas_Object *conformant = (Evas_Object *)data;
+   Widget_Data *wd = elm_widget_data_get(conformant);
+
+   if (!wd) return;
+
    focus_obj = elm_widget_focused_object_get(conformant);
    if (focus_obj)
      {
@@ -404,6 +419,8 @@ _content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj
 
         elm_widget_show_region_set(focus_obj, x, y, w, h, EINA_TRUE);
      }
+
+   wd->show_region_job = NULL;
 }
 
 #ifdef HAVE_ELEMENTARY_X
index dd42f49..bf2ff3c 100644 (file)
@@ -2034,6 +2034,8 @@ elm_widget_show_region_set(Evas_Object *obj,
    Evas_Object *parent_obj, *child_obj;
    Evas_Coord px, py, cx, cy;
 
+   evas_smart_objects_calculate(evas_object_evas_get(obj));
+
    API_ENTRY return;
    if (!forceshow && (x == sd->rx) && (y == sd->ry)
             && (w == sd->rw) && (h == sd->rh)) return;