jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=83ea35541ceea5583528b09daf397deecb354b97

commit 83ea35541ceea5583528b09daf397deecb354b97
Author: Jean-Philippe Andre <[email protected]>
Date:   Wed Sep 13 17:11:06 2017 +0900

    edje: Use Eina_Rectangle for parts_extends_calc (EO)
---
 src/lib/edje/edje_legacy.c             | 11 ++++++++++-
 src/lib/edje/edje_util.c               | 20 +++-----------------
 src/lib/edje/efl_canvas_layout_calc.eo | 11 +++--------
 src/lib/edje/efl_canvas_layout_part.eo |  2 +-
 4 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index f35b499b76..520f9f0730 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -1101,7 +1101,16 @@ edje_object_size_min_restricted_calc(Edje_Object *obj, 
int *minw, int *minh, int
 EAPI Eina_Bool
 edje_object_parts_extends_calc(Edje_Object *obj, int *x, int *y, int *w, int 
*h)
 {
-   return efl_canvas_layout_calc_parts_extends(obj, x, y, w, h);
+   Eina_Rectangle r = { 0, };
+   Edje *ed;
+
+   ed = _edje_fetch(obj);
+   if (ed) r = efl_canvas_layout_calc_parts_extends(obj);
+   if (x) *x = r.x;
+   if (y) *y = r.y;
+   if (w) *w = r.w;
+   if (h) *h = r.h;
+   return (ed != NULL);
 }
 
 EAPI int
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 6eb431ee59..9b3d622b2f 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -3171,22 +3171,13 @@ _edje_object_efl_canvas_layout_calc_calc_size_min(Eo 
*obj, Edje *_pd EINA_UNUSED
    edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0);
 }
 
-EOLIAN Eina_Bool
-_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, 
Edje *ed, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
+EOLIAN Eina_Rectangle
+_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, 
Edje *ed)
 {
    Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX;
    Evas_Coord xx2 = 0, yy2 = 0;
    unsigned short i;
 
-   if (!ed)
-     {
-        if (x) *x = 0;
-        if (y) *y = 0;
-        if (w) *w = 0;
-        if (h) *h = 0;
-        return EINA_FALSE;
-     }
-
    ed->calc_only = EINA_TRUE;
 
    /* Need to recalc before providing the object. */
@@ -3214,12 +3205,7 @@ 
_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
 
    ed->calc_only = EINA_FALSE;
 
-   if (x) *x = xx1;
-   if (y) *y = yy1;
-   if (w) *w = xx2 - xx1;
-   if (h) *h = yy2 - yy1;
-
-   return EINA_TRUE;
+   return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 };
 }
 
 EOLIAN void
diff --git a/src/lib/edje/efl_canvas_layout_calc.eo 
b/src/lib/edje/efl_canvas_layout_calc.eo
index 17cb5c1060..6e89d9fbeb 100644
--- a/src/lib/edje/efl_canvas_layout_calc.eo
+++ b/src/lib/edje/efl_canvas_layout_calc.eo
@@ -1,3 +1,5 @@
+import eina_types;
+
 interface Efl.Canvas.Layout_Calc
 {
    [[This interface defines a common set of APIs used to trigger calculations
@@ -86,14 +88,7 @@ interface Efl.Canvas.Layout_Calc
            Note: On failure, this function will make all non-$null geometry
            pointers' pointed variables be set to zero.
          ]]
-         return: bool; [[$true on success, $false otherwise]]
-         /* FIXME: Return a 2D size type (no @out values) */
-         params {
-            @out x: int; [[The parts region's X coordinate]]
-            @out y: int; [[The parts region's Y coordinate]]
-            @out w: int; [[The parts region's width]]
-            @out h: int; [[The parts region's height]]
-         }
+         return: Eina.Rectangle; [[The calculated region.]]
       }
       calc_freeze {
          [[Freezes the layout object.
diff --git a/src/lib/edje/efl_canvas_layout_part.eo 
b/src/lib/edje/efl_canvas_layout_part.eo
index d6dc45d59b..6417b795e0 100644
--- a/src/lib/edje/efl_canvas_layout_part.eo
+++ b/src/lib/edje/efl_canvas_layout_part.eo
@@ -6,7 +6,7 @@ class Efl.Canvas.Layout.Part (Efl.Object, Efl.Gfx, Efl.Ui.Drag)
      As an @Efl.Part implementation class, all objects of this class are meant
      to be used for one and only one function call. In pseudo-code, the use
      of object of this type looks like the following:
-       layout.part("somepart").geometry_get(&x, &y, &w, &h);
+       rect = layout.part("somepart").geometry_get();
 
      @since 1.20
    ]]

-- 


Reply via email to