input: Move pointer props to Canvas
authorJean-Philippe Andre <jp.andre@samsung.com>
Mon, 25 Sep 2017 09:47:49 +0000 (18:47 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 26 Sep 2017 08:58:07 +0000 (17:58 +0900)
efl_input_pointer_position is defined by two classes... bad!

Fixes T6066

src/lib/efl/interfaces/efl_canvas.eo
src/lib/elementary/efl_ui_win.c
src/lib/elementary/efl_ui_win.eo
src/lib/evas/canvas/efl_input_interface.eo
src/tests/elementary/elm_test_win.c

index 10776b7..6655dab 100644 (file)
@@ -180,6 +180,65 @@ interface Efl.Canvas ()
             seat: Efl.Input.Device; [[The seat or $null if not found.]]
          }
       }
+      @property pointer_position {
+         get {
+            [[This function returns the current known pointer coordinates
+
+              This function returns the current position of the main input
+              pointer (mouse, pen, etc...).
+            ]]
+         }
+         /* FIXME: missing keys { seat } */
+         values {
+            pos: Eina.Position2D; [[The pointer position in pixels.]]
+         }
+      }
+      @property pointer_inside {
+         get {
+            [[Returns whether the mouse pointer is logically inside the
+              canvas.
+
+              When this function is called it will return a value of either
+              $false or $true, depending on whether a pointer,in or pointer,out
+              event has been called previously.
+
+              A return value of $true indicates the mouse is logically
+              inside the canvas, and $false implies it is logically
+              outside the canvas.
+
+              A canvas begins with the mouse being assumed outside ($false).
+            ]]
+         }
+         /* FIXME: missing keys { seat } */
+         values {
+            inside: bool; [[$true if the mouse pointer is inside the canvas,
+                            $false otherwise]]
+         }
+      }
+      /* FIXME: maybe not necessary if gesture supports this */
+      pointer_iterate @const {
+         [[Returns an iterator over the current known pointer positions.
+
+           This is used to iterate over the current known multi-touch positions,
+           including the first finger. Each pointer position is represented by
+           an object of type @Efl.Input.Pointer.
+
+           Each finger in a multi touch environment can then be identified
+           by the @Efl.Input.Pointer.tool property. The order of the pointers
+           in this iterator is not defined.
+
+           Note: If the input surface supports hovering input, some pointers
+           may not be in a "down" state. To retrieve the list of such pointers,
+           set the $hover value to $true. Remember though that most devices
+           currently don't support this.
+         ]]
+         params {
+            /* FIXME: missing seat. hover is not useful */
+            hover: bool @optional; [[$false by default, $true means to include
+                                     fingers that are currently hovering.]]
+         }
+         return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]]
+      }
    }
    events {
       focus,in: Efl.Input.Focus; [[Called when canvas got focus]]
index 06607a6..bdf94c1 100644 (file)
@@ -2423,7 +2423,7 @@ _efl_ui_win_efl_gfx_visible_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool vis)
 }
 
 EOLIAN static Eina_Position2D
-_efl_ui_win_efl_input_interface_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
+_efl_ui_win_efl_canvas_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
 {
    Eina_Position2D pos;
    evas_pointer_canvas_xy_get(sd->evas, &pos.x, &pos.y);
@@ -2431,7 +2431,7 @@ _efl_ui_win_efl_input_interface_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Ui
 }
 
 EOLIAN static Eina_Bool
-_efl_ui_win_efl_input_interface_pointer_inside_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
+_efl_ui_win_efl_canvas_pointer_inside_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
 {
    return evas_pointer_inside_get(sd->evas);
 }
@@ -2467,8 +2467,8 @@ _input_pointer_iterator_free(Input_Pointer_Iterator *it)
 }
 
 EOLIAN static Eina_Iterator *
-_efl_ui_win_efl_input_interface_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *sd,
-                                                Eina_Bool hover EINA_UNUSED)
+_efl_ui_win_efl_canvas_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *sd,
+                                       Eina_Bool hover EINA_UNUSED)
 {
    Input_Pointer_Iterator *it;
    Eina_List *list = NULL;
index 9a640f0..f65f549 100644 (file)
@@ -849,9 +849,9 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Access.Window,
       Efl.Gfx.Size.Hint.hint_aspect { set; }
       Efl.Gfx.Size.Hint.hint_max { set; }
       Efl.Text.text { get; set; }
-      Efl.Input.Interface.pointer_position { get; }
-      Efl.Input.Interface.pointer_inside { get; }
-      Efl.Input.Interface.pointer_iterate;
+      Efl.Canvas.pointer_position { get; }
+      Efl.Canvas.pointer_inside { get; }
+      Efl.Canvas.pointer_iterate;
       Efl.Canvas.image_max_size { get; }
       Efl.Canvas.smart_objects_calculate;
       Efl.Canvas.objects_at_xy_get;
index 2db729c..68408a3 100644 (file)
@@ -26,58 +26,6 @@ interface Efl.Input.Interface ()
    eo_prefix: efl_input;
    event_prefix: efl;
    methods {
-      @property pointer_position {
-         get {
-            [[This function returns the current known pointer coordinates
-
-              This function returns the current position of the main input
-              pointer (mouse, pen, etc...).
-            ]]
-         }
-         values {
-            pos: Eina.Position2D; [[The pointer position in pixels.]]
-         }
-      }
-      @property pointer_inside {
-         get {
-            [[Returns whether the mouse pointer is logically inside the
-              canvas.
-
-              When this function is called it will return a value of either
-              $false or $true, depending on whether a pointer,in or pointer,out
-              event has been called previously.
-
-              A return value of $true indicates the mouse is logically
-              inside the canvas, and $false implies it is logically
-              outside the canvas.
-
-              A canvas begins with the mouse being assumed outside ($false).
-            ]]
-            return: bool; [[$true if the mouse pointer is inside the canvas, $false otherwise]]
-         }
-      }
-      pointer_iterate @const {
-         [[Returns an iterator over the current known pointer positions.
-
-           This is used to iterate over the current known multi-touch positions,
-           including the first finger. Each pointer position is represented by
-           an object of type @Efl.Input.Pointer.
-
-           Each finger in a multi touch environment can then be identified
-           by the @Efl.Input.Pointer.tool property. The order of the pointers
-           in this iterator is not defined.
-
-           Note: If the input surface supports hovering input, some pointers
-           may not be in a "down" state. To retrieve the list of such pointers,
-           set the $hover value to $true. Remember though that most devices
-           currently don't support this.
-         ]]
-         params {
-            hover: bool @optional; [[$false by default, $true means to include
-                                     fingers that are currently hovering.]]
-         }
-         return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]]
-      }
       @property seat_event_filter {
           set {
              [[Add or remove a given seat to the filter list. If the filter list is empty this object
index ea469e1..b8524b3 100644 (file)
@@ -256,7 +256,7 @@ _inputs_timer2_cb(void *data)
    size_t cnt = 0;
    int i = 0;
 
-   it = efl_input_pointer_iterate(win, 0);
+   it = efl_canvas_pointer_iterate(win, 0);
    EINA_ITERATOR_FOREACH(it, ptr)
      {
         double x, y;
@@ -313,12 +313,13 @@ static Eina_Bool
 _inputs_timer3_cb(void *data)
 {
    Efl_Input_Pointer *ptr;
+   Eina_Position2D pos;
    Eina_Iterator *it;
    Eo *win = data;
    size_t cnt = 0;
    int i = 0;
 
-   it = efl_input_pointer_iterate(win, 0);
+   it = efl_canvas_pointer_iterate(win, 0);
    EINA_ITERATOR_FOREACH(it, ptr)
      {
         int tool, ok = 0;
@@ -348,6 +349,11 @@ _inputs_timer3_cb(void *data)
    eina_iterator_free(it);
    fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone)
 
+   fail_if(!efl_canvas_pointer_inside_get(win));
+   pos = efl_canvas_pointer_position_get(win);
+   ck_assert_int_eq(pos.x, points[1][0].x);
+   ck_assert_int_eq(pos.y, points[1][0].y);
+
    elm_exit();
 
    return ECORE_CALLBACK_DONE;