edje: Use Eina_Rectangle for parts_extends_calc (EO)
authorJean-Philippe Andre <jp.andre@samsung.com>
Wed, 13 Sep 2017 08:11:06 +0000 (17:11 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Wed, 13 Sep 2017 09:03:34 +0000 (18:03 +0900)
src/lib/edje/edje_legacy.c
src/lib/edje/edje_util.c
src/lib/edje/efl_canvas_layout_calc.eo
src/lib/edje/efl_canvas_layout_part.eo

index f35b499b76a0d7c46a36e951a4b736e5b19cd4b6..520f9f0730b0069ea3a7660a7d2c69582b6baede 100644 (file)
@@ -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
index 6eb431ee59f16ae3ba30939933abe433e6cf9479..9b3d622b2fec55b340237b88bc47510962f63eba 100644 (file)
@@ -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
index 17cb5c1060442b8f46a6e2fcd7b8e8b10000b20c..6e89d9fbeba4a7db9cb00a033078653d359b3573 100644 (file)
@@ -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.
index d6dc45d59b240e224b6f7aa54519ae8c6b1bd285..6417b795e01cb9733e91c33f196f6eb5f955aada 100644 (file)
@@ -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
    ]]