evas: Remove evas touch_point from EO
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 15 May 2017 06:17:38 +0000 (15:17 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Mon, 15 May 2017 07:21:20 +0000 (16:21 +0900)
Note: it seems the EAPI evas_touch_point_list_xy_get() was
lst at some point, as it doesn't appear in the headers anymore.
It looks like we fail to catch an ABI break! abi_checker didn't
catch this!?

Ref T5312

src/lib/elementary/efl_ui_win.c
src/lib/evas/Evas_Common.h
src/lib/evas/Evas_Legacy.h
src/lib/evas/canvas/evas_canvas.eo
src/lib/evas/canvas/evas_touch_point.c
src/lib/evas/canvas/evas_types.eot

index 0feb119..30d4240 100644 (file)
@@ -2404,7 +2404,7 @@ _efl_ui_win_efl_input_interface_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *
 
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, NULL);
 
-   cnt = evas_canvas_touch_point_list_count(sd->evas);
+   cnt = evas_touch_point_list_count(sd->evas);
    if (!cnt) return NULL;
 
    it = calloc(1, sizeof(*it));
@@ -2422,11 +2422,11 @@ _efl_ui_win_efl_input_interface_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *
         ptr = efl_input_instance_get(EFL_INPUT_POINTER_CLASS, (Eo *) obj, (void **) &ptrdata);
         if (!ptrdata) break;
 
-        ptrdata->tool = evas_canvas_touch_point_list_nth_id_get(sd->evas, i);
+        ptrdata->tool = evas_touch_point_list_nth_id_get(sd->evas, i);
         _efl_input_value_mark(ptrdata, EFL_INPUT_VALUE_TOOL);
 
         // Note that "still" maps to "down" here.
-        state = evas_canvas_touch_point_list_nth_state_get(sd->evas, i);
+        state = evas_touch_point_list_nth_state_get(sd->evas, i);
         switch (state)
           {
            case EVAS_TOUCH_POINT_DOWN:   ptrdata->action = EFL_POINTER_ACTION_DOWN; break;
index 4e7d7a7..0711c75 100644 (file)
@@ -3603,19 +3603,6 @@ EAPI Eina_Bool            evas_seat_key_lock_is_set(const Evas_Lock *l, const ch
  */
 
 /**
- * @defgroup Evas_Touch_Point_List Touch Point List Functions
- *
- * Functions to get information of touched points in the Evas.
- *
- * Evas maintains list of touched points on the canvas. Each point has
- * its co-ordinates, id and state. You can get the number of touched
- * points and information of each point using evas_touch_point_list
- * functions.
- *
- * @ingroup Evas_Canvas
- */
-
-/**
  * @ingroup Evas_Font_Group
  *
  * @{
index 004e594..559055a 100644 (file)
@@ -596,6 +596,86 @@ EAPI void             evas_event_refeed_event(Evas *obj, void *event_copy, Evas_
  */
 
 /**
+ * @defgroup Evas_Touch_Point_List Touch Point List Functions
+ *
+ * Functions to get information of touched points in the Evas.
+ *
+ * Evas maintains list of touched points on the canvas. Each point has
+ * its co-ordinates, id and state. You can get the number of touched
+ * points and information of each point using evas_touch_point_list
+ * functions.
+ *
+ * @ingroup Evas_Canvas
+ *
+ * @{
+ */
+
+/**
+ * State of Evas_Coord_Touch_Point
+ */
+typedef enum
+{
+  EVAS_TOUCH_POINT_DOWN = 0, /**< Touch point is pressed down */
+  EVAS_TOUCH_POINT_UP, /**< Touch point is released */
+  EVAS_TOUCH_POINT_MOVE, /**< Touch point is moved */
+  EVAS_TOUCH_POINT_STILL, /**< Touch point is not moved after pressed */
+  EVAS_TOUCH_POINT_CANCEL /**< Touch point is cancelled */
+} Evas_Touch_Point_State;
+
+/**
+ * @brief Get the number of touched point in the evas.
+ *
+ * New touched point is added to the list whenever touching the evas and point
+ * is removed whenever removing touched point from the evas.
+ *
+ * @return The number of touched point on the evas.
+ */
+EAPI unsigned int evas_touch_point_list_count(Evas *obj);
+
+/**
+ * @brief This function returns the @c id of nth touch point.
+ *
+ * The point which comes from Mouse Event has @c id 0 and The point which comes
+ * from Multi Event has @c id that is same as Multi Event's device id.
+ *
+ * @param[in] n The number of the touched point (0 being the first).
+ *
+ * @return id of nth touch point, if the call succeeded, -1 otherwise.
+ */
+EAPI int evas_touch_point_list_nth_id_get(Evas *obj, unsigned int n);
+
+/**
+ * @brief This function returns the @c state of nth touch point.
+ *
+ * The point's @c state is EVAS_TOUCH_POINT_DOWN when pressed,
+ * EVAS_TOUCH_POINT_STILL when the point is not moved after pressed,
+ * EVAS_TOUCH_POINT_MOVE when moved at least once after pressed and
+ * EVAS_TOUCH_POINT_UP when released.
+ *
+ * @param[in] n The number of the touched point (0 being the first).
+ *
+ * @return @c state of nth touch point, if the call succeeded,
+ * EVAS_TOUCH_POINT_CANCEL otherwise.
+ */
+EAPI Evas_Touch_Point_State evas_touch_point_list_nth_state_get(Evas *obj, unsigned int n);
+
+/**
+ * @brief This function returns the nth touch point's coordinates.
+ *
+ * Touch point's coordinates is updated whenever moving that point on the
+ * canvas.
+ *
+ * @param[in] n The number of the touched point (0 being the first).
+ * @param[out] x The pointer to a Evas_Coord to be filled in.
+ * @param[out] y The pointer to a Evas_Coord to be filled in.
+ */
+EAPI void evas_touch_point_list_nth_xy_get(Evas *eo_e, unsigned int n, Evas_Coord *x, Evas_Coord *y);
+
+/**
+ * @}
+ */
+
+/**
  * @ingroup Evas_Font_Group
  *
  * @{
index 3e6298b..af7e915 100644 (file)
@@ -661,15 +661,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
            should be used.
          ]]
       }
-      touch_point_list_count {
-         [[Get the number of touched point in the evas.
-
-           New touched point is added to the list whenever touching the
-           evas and point is removed whenever removing touched point from
-           the evas.
-         ]]
-         return: uint; [[The number of touched point on the evas.]]
-      }
       nochange_pop {
          [[Pop the nochange flag down 1.
 
@@ -839,18 +830,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
             @in path: string @nonull; [[The new font path.]]
          }
       }
-      touch_point_list_nth_id_get {
-         [[This function returns the $id of nth touch point.
-
-           The point which comes from Mouse Event has $id 0 and The point
-           which comes from Multi Event has $id that is same as Multi
-           Event's device id.
-         ]]
-         return: int; [[id of nth touch point, if the call succeeded, -1 otherwise.]]
-         params {
-            @in n: uint; [[The number of the touched point (0 being the first).]]
-         }
-      }
       font_path_clear {
          [[Removes all font paths loaded into memory for the given evas.]]
       }
@@ -860,6 +839,7 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
            all smart objects in the canvas.
          ]]
       }
+      /* FIXME: The below function is only for efl.ui.win */
       touch_point_list_nth_xy_get {
          [[This function returns the nth touch point's coordinates.
 
@@ -1007,22 +987,6 @@ class Evas.Canvas (Efl.Object, Efl.Canvas, Efl.Animator, Efl.Input.Interface,
             @in keyname: string @nonull; [[The name of the key to remove from the modifiers list.]]
          }
       }
-      touch_point_list_nth_state_get {
-         [[This function returns the $state of nth touch point.
-
-           The point's $state is EVAS_TOUCH_POINT_DOWN when pressed,
-           EVAS_TOUCH_POINT_STILL when the point is not moved after pressed,
-           EVAS_TOUCH_POINT_MOVE when moved at least once after pressed and
-           EVAS_TOUCH_POINT_UP when released.
-         ]]
-         return: Evas.Touch_Point_State; [[
-            $state of nth touch point, if the call succeeded,
-            EVAS_TOUCH_POINT_CANCEL otherwise.
-         ]]
-         params {
-            @in n: uint; [[The number of the touched point (0 being the first).]]
-         }
-      }
       focus_in {
          [[Inform to the evas that it got the focus from the default seat.]]
       }
index 8d05753..db7d4c2 100644 (file)
@@ -1,6 +1,11 @@
 #include "evas_common_private.h"
 #include "evas_private.h"
 
+#define EVAS_LEGACY_API(_obj, _e, ...) \
+   Evas_Public_Data *_e = (_obj && efl_isa(_obj, EVAS_CANVAS_CLASS)) ? \
+     efl_data_scope_get(_obj, EVAS_CANVAS_CLASS) : NULL; \
+   if (!_e) return __VA_ARGS__
+
 void
 _evas_touch_point_append(Evas *eo_e, int id, Evas_Coord x, Evas_Coord y)
 {
@@ -53,19 +58,22 @@ _evas_touch_point_remove(Evas *eo_e, int id)
      }
 }
 
-EOLIAN unsigned int
-_evas_canvas_touch_point_list_count(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e)
+EAPI unsigned int
+evas_touch_point_list_count(Eo *eo_e)
 {
+   EVAS_LEGACY_API(eo_e, e, 0);
    return eina_list_count(e->touch_points);
 }
 
+/* For Efl.Ui.Win only */
 EOLIAN void
-_evas_canvas_touch_point_list_nth_xy_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e,
-                                         unsigned int n, double *x, double *y)
+_evas_canvas_touch_point_list_nth_xy_get(Evas_Canvas *eo_e EINA_UNUSED,
+                                         Evas_Public_Data *e, unsigned int n,
+                                         double *x, double *y)
 {
-   Evas_Coord_Touch_Point *point = NULL;
+   Evas_Coord_Touch_Point *point;
 
-   point = (Evas_Coord_Touch_Point *)eina_list_nth(e->touch_points, n);
+   point = eina_list_nth(e->touch_points, n);
    if (!point)
      {
         if (x) *x = 0;
@@ -77,31 +85,35 @@ _evas_canvas_touch_point_list_nth_xy_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data
 }
 
 EAPI void
-evas_touch_point_list_nth_xy_get(Evas_Canvas *obj, unsigned int n, Evas_Coord *x, Evas_Coord *y)
+evas_touch_point_list_nth_xy_get(Evas *eo_e, unsigned int n,
+                                 Evas_Coord *x, Evas_Coord *y)
 {
-   double X = 0, Y = 0;
+   double X, Y;
 
-   evas_canvas_touch_point_list_nth_xy_get(obj, n, &X, &Y);
+   EVAS_LEGACY_API(eo_e, e);
+   _evas_canvas_touch_point_list_nth_xy_get(eo_e, e, n, &X, &Y);
    if (x) *x = X;
    if (y) *y = Y;
 }
 
-EOLIAN int
-_evas_canvas_touch_point_list_nth_id_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, unsigned int n)
+EAPI int
+evas_touch_point_list_nth_id_get(Evas *eo_e, unsigned int n)
 {
-   Evas_Coord_Touch_Point *point = NULL;
+   Evas_Coord_Touch_Point *point;
 
-   point = (Evas_Coord_Touch_Point *)eina_list_nth(e->touch_points, n);
+   EVAS_LEGACY_API(eo_e, e, -1);
+   point = eina_list_nth(e->touch_points, n);
    if (!point) return -1;
    else return point->id;
 }
 
-EOLIAN Evas_Touch_Point_State
-_evas_canvas_touch_point_list_nth_state_get(Eo *eo_e EINA_UNUSED, Evas_Public_Data *e, unsigned int n)
+EAPI Evas_Touch_Point_State
+evas_touch_point_list_nth_state_get(Evas *eo_e, unsigned int n)
 {
-   Evas_Coord_Touch_Point *point = NULL;
+   Evas_Coord_Touch_Point *point;
 
-   point = (Evas_Coord_Touch_Point *)eina_list_nth(e->touch_points, n);
+   EVAS_LEGACY_API(eo_e, e, EVAS_TOUCH_POINT_CANCEL);
+   point = eina_list_nth(e->touch_points, n);
    if (!point) return EVAS_TOUCH_POINT_CANCEL;
    else return point->state;
 }
index 277de4a..38aab6e 100644 (file)
@@ -12,17 +12,6 @@ enum Evas.Font.Hinting_Flags {
    bytecode [[Bytecode font hinting]]
 }
 
-enum Evas.Touch_Point_State {
-   [[State of Evas_Coord_Touch_Point]]
-   legacy: Evas_Touch_Point;
-
-   down, [[Touch point is pressed down]]
-   up, [[Touch point is released]]
-   move, [[Touch point is moved]]
-   still, [[Touch point is not moved after pressed]]
-   cancel [[Touch point is cancelled]]
-}
-
 struct Evas.Modifier; [[An opaque type containing information on which modifier keys are registered in an Evas canvas]]
 struct Evas.Lock; [[An opaque type containing information on which lock keys are registered in an Evas canvas]]