From: Myungjae Lee <mjae.lee@samsung.com>
authorMyungjae Lee <mjae.lee@samsung.com>
Thu, 16 Dec 2010 09:53:25 +0000 (09:53 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 16 Dec 2010 09:53:25 +0000 (09:53 +0000)
Subject: Re: [E-devel] [PATCH] elm widget: make show_region_set
function call all region show functions set by parents

I'm trying to send several patches that I've changed.
This is just the beginning of my patch rushes..

'elm_widget_show_region_set' function works fine in the simple case (any
widget inside one scroller) however, in the complex parent-child case
(such
as entry in the box in the horizontal scroller in the layout in the
vertical
scroller) it doesn't work correctly because all show region functions
set by
scrollers are not called.

So I changed it to call all show region functions set by its parents
widgets
if exist.

Please review the attached patch file and feel free to give me any
kind of
feedback.

SVN revision: 55592

src/lib/elm_widget.c

index 403ca3f..c2b5f45 100644 (file)
@@ -1562,6 +1562,9 @@ elm_widget_disabled_get(const Evas_Object *obj)
 EAPI void
 elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
 {
+   Evas_Object *parent_obj, *child_obj;
+   Evas_Coord px, py, cx, cy;
+
    API_ENTRY return;
    if ((x == sd->rx) && (y == sd->ry) && (w == sd->rw) && (h == sd->rh)) return;
    sd->rx = x;
@@ -1570,22 +1573,31 @@ elm_widget_show_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Co
    sd->rh = h;
    if (sd->on_show_region_func)
       sd->on_show_region_func(sd->on_show_region_data, obj);
-   else
+
+   do
      {
-        Evas_Object *parent_obj;
-        do
+        parent_obj = sd->parent_obj; 
+        child_obj = sd->obj;
+        sd = evas_object_smart_data_get(parent_obj);
+
+        if ((!parent_obj) || (!sd) || (!_elm_widget_is(parent_obj))) break;
+
+        evas_object_geometry_get(parent_obj, &px, &py, NULL, NULL);
+        evas_object_geometry_get(child_obj, &cx, &cy, NULL, NULL);
+
+        x += (cx - px);
+        y += (cy - py);
+        sd->rx = x;
+        sd->ry = y;
+        sd->rw = w;
+        sd->rh = h;
+
+        if (sd->on_show_region_func)
           {
-             parent_obj = sd->parent_obj;
-             sd = evas_object_smart_data_get(parent_obj);
-             if ((!parent_obj) || (!sd) || (!_elm_widget_is(parent_obj))) break;
-             if (sd->on_show_region_func)
-               {
-                  sd->on_show_region_func(sd->on_show_region_data, obj);
-                  break;
-               }
+             sd->on_show_region_func(sd->on_show_region_data, parent_obj);
           }
-        while (parent_obj);
      }
+   while (parent_obj);
 }
 
 EAPI void