summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-25 18:47:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-26 17:58:07 +0900
commit8557fe818f6ac033f582dc4865235aa3176d7447 (patch)
tree03dd802b65648a98c2bc2d9a9ff79e5ec2cf4455 /src
parentb3ffd78237282883c327082c841205f2f0643642 (diff)
input: Move pointer props to Canvas
efl_input_pointer_position is defined by two classes... bad! Fixes T6066
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl/interfaces/efl_canvas.eo59
-rw-r--r--src/lib/elementary/efl_ui_win.c8
-rw-r--r--src/lib/elementary/efl_ui_win.eo6
-rw-r--r--src/lib/evas/canvas/efl_input_interface.eo52
-rw-r--r--src/tests/elementary/elm_test_win.c10
5 files changed, 74 insertions, 61 deletions
diff --git a/src/lib/efl/interfaces/efl_canvas.eo b/src/lib/efl/interfaces/efl_canvas.eo
index 10776b7bd6..6655dabd4a 100644
--- a/src/lib/efl/interfaces/efl_canvas.eo
+++ b/src/lib/efl/interfaces/efl_canvas.eo
@@ -180,6 +180,65 @@ interface Efl.Canvas ()
180 seat: Efl.Input.Device; [[The seat or $null if not found.]] 180 seat: Efl.Input.Device; [[The seat or $null if not found.]]
181 } 181 }
182 } 182 }
183 @property pointer_position {
184 get {
185 [[This function returns the current known pointer coordinates
186
187 This function returns the current position of the main input
188 pointer (mouse, pen, etc...).
189 ]]
190 }
191 /* FIXME: missing keys { seat } */
192 values {
193 pos: Eina.Position2D; [[The pointer position in pixels.]]
194 }
195 }
196 @property pointer_inside {
197 get {
198 [[Returns whether the mouse pointer is logically inside the
199 canvas.
200
201 When this function is called it will return a value of either
202 $false or $true, depending on whether a pointer,in or pointer,out
203 event has been called previously.
204
205 A return value of $true indicates the mouse is logically
206 inside the canvas, and $false implies it is logically
207 outside the canvas.
208
209 A canvas begins with the mouse being assumed outside ($false).
210 ]]
211 }
212 /* FIXME: missing keys { seat } */
213 values {
214 inside: bool; [[$true if the mouse pointer is inside the canvas,
215 $false otherwise]]
216 }
217 }
218 /* FIXME: maybe not necessary if gesture supports this */
219 pointer_iterate @const {
220 [[Returns an iterator over the current known pointer positions.
221
222 This is used to iterate over the current known multi-touch positions,
223 including the first finger. Each pointer position is represented by
224 an object of type @Efl.Input.Pointer.
225
226 Each finger in a multi touch environment can then be identified
227 by the @Efl.Input.Pointer.tool property. The order of the pointers
228 in this iterator is not defined.
229
230 Note: If the input surface supports hovering input, some pointers
231 may not be in a "down" state. To retrieve the list of such pointers,
232 set the $hover value to $true. Remember though that most devices
233 currently don't support this.
234 ]]
235 params {
236 /* FIXME: missing seat. hover is not useful */
237 hover: bool @optional; [[$false by default, $true means to include
238 fingers that are currently hovering.]]
239 }
240 return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]]
241 }
183 } 242 }
184 events { 243 events {
185 focus,in: Efl.Input.Focus; [[Called when canvas got focus]] 244 focus,in: Efl.Input.Focus; [[Called when canvas got focus]]
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 06607a6ed6..bdf94c1e36 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -2423,7 +2423,7 @@ _efl_ui_win_efl_gfx_visible_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool vis)
2423} 2423}
2424 2424
2425EOLIAN static Eina_Position2D 2425EOLIAN static Eina_Position2D
2426_efl_ui_win_efl_input_interface_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) 2426_efl_ui_win_efl_canvas_pointer_position_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
2427{ 2427{
2428 Eina_Position2D pos; 2428 Eina_Position2D pos;
2429 evas_pointer_canvas_xy_get(sd->evas, &pos.x, &pos.y); 2429 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
2431} 2431}
2432 2432
2433EOLIAN static Eina_Bool 2433EOLIAN static Eina_Bool
2434_efl_ui_win_efl_input_interface_pointer_inside_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) 2434_efl_ui_win_efl_canvas_pointer_inside_get(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd)
2435{ 2435{
2436 return evas_pointer_inside_get(sd->evas); 2436 return evas_pointer_inside_get(sd->evas);
2437} 2437}
@@ -2467,8 +2467,8 @@ _input_pointer_iterator_free(Input_Pointer_Iterator *it)
2467} 2467}
2468 2468
2469EOLIAN static Eina_Iterator * 2469EOLIAN static Eina_Iterator *
2470_efl_ui_win_efl_input_interface_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *sd, 2470_efl_ui_win_efl_canvas_pointer_iterate(const Eo *obj, Efl_Ui_Win_Data *sd,
2471 Eina_Bool hover EINA_UNUSED) 2471 Eina_Bool hover EINA_UNUSED)
2472{ 2472{
2473 Input_Pointer_Iterator *it; 2473 Input_Pointer_Iterator *it;
2474 Eina_List *list = NULL; 2474 Eina_List *list = NULL;
diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo
index 9a640f088e..f65f549932 100644
--- a/src/lib/elementary/efl_ui_win.eo
+++ b/src/lib/elementary/efl_ui_win.eo
@@ -849,9 +849,9 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Access.Window,
849 Efl.Gfx.Size.Hint.hint_aspect { set; } 849 Efl.Gfx.Size.Hint.hint_aspect { set; }
850 Efl.Gfx.Size.Hint.hint_max { set; } 850 Efl.Gfx.Size.Hint.hint_max { set; }
851 Efl.Text.text { get; set; } 851 Efl.Text.text { get; set; }
852 Efl.Input.Interface.pointer_position { get; } 852 Efl.Canvas.pointer_position { get; }
853 Efl.Input.Interface.pointer_inside { get; } 853 Efl.Canvas.pointer_inside { get; }
854 Efl.Input.Interface.pointer_iterate; 854 Efl.Canvas.pointer_iterate;
855 Efl.Canvas.image_max_size { get; } 855 Efl.Canvas.image_max_size { get; }
856 Efl.Canvas.smart_objects_calculate; 856 Efl.Canvas.smart_objects_calculate;
857 Efl.Canvas.objects_at_xy_get; 857 Efl.Canvas.objects_at_xy_get;
diff --git a/src/lib/evas/canvas/efl_input_interface.eo b/src/lib/evas/canvas/efl_input_interface.eo
index 2db729c84b..68408a3281 100644
--- a/src/lib/evas/canvas/efl_input_interface.eo
+++ b/src/lib/evas/canvas/efl_input_interface.eo
@@ -26,58 +26,6 @@ interface Efl.Input.Interface ()
26 eo_prefix: efl_input; 26 eo_prefix: efl_input;
27 event_prefix: efl; 27 event_prefix: efl;
28 methods { 28 methods {
29 @property pointer_position {
30 get {
31 [[This function returns the current known pointer coordinates
32
33 This function returns the current position of the main input
34 pointer (mouse, pen, etc...).
35 ]]
36 }
37 values {
38 pos: Eina.Position2D; [[The pointer position in pixels.]]
39 }
40 }
41 @property pointer_inside {
42 get {
43 [[Returns whether the mouse pointer is logically inside the
44 canvas.
45
46 When this function is called it will return a value of either
47 $false or $true, depending on whether a pointer,in or pointer,out
48 event has been called previously.
49
50 A return value of $true indicates the mouse is logically
51 inside the canvas, and $false implies it is logically
52 outside the canvas.
53
54 A canvas begins with the mouse being assumed outside ($false).
55 ]]
56 return: bool; [[$true if the mouse pointer is inside the canvas, $false otherwise]]
57 }
58 }
59 pointer_iterate @const {
60 [[Returns an iterator over the current known pointer positions.
61
62 This is used to iterate over the current known multi-touch positions,
63 including the first finger. Each pointer position is represented by
64 an object of type @Efl.Input.Pointer.
65
66 Each finger in a multi touch environment can then be identified
67 by the @Efl.Input.Pointer.tool property. The order of the pointers
68 in this iterator is not defined.
69
70 Note: If the input surface supports hovering input, some pointers
71 may not be in a "down" state. To retrieve the list of such pointers,
72 set the $hover value to $true. Remember though that most devices
73 currently don't support this.
74 ]]
75 params {
76 hover: bool @optional; [[$false by default, $true means to include
77 fingers that are currently hovering.]]
78 }
79 return: iterator<const(Efl.Input.Pointer)>; [[Iterator to pointer positions]]
80 }
81 @property seat_event_filter { 29 @property seat_event_filter {
82 set { 30 set {
83 [[Add or remove a given seat to the filter list. If the filter list is empty this object 31 [[Add or remove a given seat to the filter list. If the filter list is empty this object
diff --git a/src/tests/elementary/elm_test_win.c b/src/tests/elementary/elm_test_win.c
index ea469e1107..b8524b323f 100644
--- a/src/tests/elementary/elm_test_win.c
+++ b/src/tests/elementary/elm_test_win.c
@@ -256,7 +256,7 @@ _inputs_timer2_cb(void *data)
256 size_t cnt = 0; 256 size_t cnt = 0;
257 int i = 0; 257 int i = 0;
258 258
259 it = efl_input_pointer_iterate(win, 0); 259 it = efl_canvas_pointer_iterate(win, 0);
260 EINA_ITERATOR_FOREACH(it, ptr) 260 EINA_ITERATOR_FOREACH(it, ptr)
261 { 261 {
262 double x, y; 262 double x, y;
@@ -313,12 +313,13 @@ static Eina_Bool
313_inputs_timer3_cb(void *data) 313_inputs_timer3_cb(void *data)
314{ 314{
315 Efl_Input_Pointer *ptr; 315 Efl_Input_Pointer *ptr;
316 Eina_Position2D pos;
316 Eina_Iterator *it; 317 Eina_Iterator *it;
317 Eo *win = data; 318 Eo *win = data;
318 size_t cnt = 0; 319 size_t cnt = 0;
319 int i = 0; 320 int i = 0;
320 321
321 it = efl_input_pointer_iterate(win, 0); 322 it = efl_canvas_pointer_iterate(win, 0);
322 EINA_ITERATOR_FOREACH(it, ptr) 323 EINA_ITERATOR_FOREACH(it, ptr)
323 { 324 {
324 int tool, ok = 0; 325 int tool, ok = 0;
@@ -348,6 +349,11 @@ _inputs_timer3_cb(void *data)
348 eina_iterator_free(it); 349 eina_iterator_free(it);
349 fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone) 350 fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone)
350 351
352 fail_if(!efl_canvas_pointer_inside_get(win));
353 pos = efl_canvas_pointer_position_get(win);
354 ck_assert_int_eq(pos.x, points[1][0].x);
355 ck_assert_int_eq(pos.y, points[1][0].y);
356
351 elm_exit(); 357 elm_exit();
352 358
353 return ECORE_CALLBACK_DONE; 359 return ECORE_CALLBACK_DONE;