From fdddc4d2967e24f4bce5a7bc71604fa99c717d32 Mon Sep 17 00:00:00 2001 From: jaehwan Date: Tue, 22 Nov 2011 06:37:30 +0000 Subject: [PATCH] Bug fix about scrolling wrong location. 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. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@65509 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/elm_conform.c | 19 ++++++++++++++++++- src/lib/elm_widget.c | 2 ++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/lib/elm_conform.c b/src/lib/elm_conform.c index b44c7aa..78c8547 100644 --- a/src/lib/elm_conform.c +++ b/src/lib/elm_conform.c @@ -27,6 +27,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 */ @@ -67,6 +68,7 @@ static void _conformant_move_resize_event_cb(void *data, Evas_Object *obj, void *event_info); 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, @@ -89,6 +91,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); } @@ -446,7 +449,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); @@ -455,6 +457,19 @@ _content_resize_event_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj if (wd->vkb_state == ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF) 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) { @@ -467,6 +482,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 diff --git a/src/lib/elm_widget.c b/src/lib/elm_widget.c index 537bc69..2744bea 100644 --- a/src/lib/elm_widget.c +++ b/src/lib/elm_widget.c @@ -2098,6 +2098,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; -- 2.7.4