summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-02-14 15:21:15 -0500
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-21 20:24:34 +0100
commit99c3d42efdb614ae17dec7321e2f9c919c3b8213 (patch)
tree8c384581d569e257b4052685c5a05203d4b19033 /src
parent2df6e1103de30fa5c3a4e2ed7ebbc0f5bd5fbf77 (diff)
efl.canvas.scene: clean up pointer_position property
this needed to take a seat param (to handle multiseat) and also have a bool return to indicate whether a pointer device exists for the specified seat ref T7584 Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Reviewed-by: Marcel Hollerbach <marcel-hollerbach@t-online.de> Differential Revision: https://phab.enlightenment.org/D7957
Diffstat (limited to 'src')
-rw-r--r--src/lib/efl/interfaces/efl_canvas_scene.eo5
-rw-r--r--src/lib/elementary/efl_ui_win.c8
-rw-r--r--src/lib/evas/canvas/evas_canvas.eo1
-rw-r--r--src/lib/evas/canvas/evas_device.c25
-rw-r--r--src/tests/elementary/elm_test_win.c2
5 files changed, 34 insertions, 7 deletions
diff --git a/src/lib/efl/interfaces/efl_canvas_scene.eo b/src/lib/efl/interfaces/efl_canvas_scene.eo
index 77818f011a..f1d8d87a32 100644
--- a/src/lib/efl/interfaces/efl_canvas_scene.eo
+++ b/src/lib/efl/interfaces/efl_canvas_scene.eo
@@ -213,8 +213,11 @@ interface @beta Efl.Canvas.Scene
213 This function returns the current position of the main input 213 This function returns the current position of the main input
214 pointer (mouse, pen, etc...). 214 pointer (mouse, pen, etc...).
215 ]] 215 ]]
216 return: bool; [[$true if a pointer exists for the given seat, otherwise $false.]]
217 }
218 keys {
219 seat: Efl.Input.Device; [[The seat, or $null to use the default.]]
216 } 220 }
217 /* FIXME: missing keys { seat } */
218 values { 221 values {
219 pos: Eina.Position2D; [[The pointer position in pixels.]] 222 pos: Eina.Position2D; [[The pointer position in pixels.]]
220 } 223 }
diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c
index 186c22a752..eb628794fc 100644
--- a/src/lib/elementary/efl_ui_win.c
+++ b/src/lib/elementary/efl_ui_win.c
@@ -2458,12 +2458,10 @@ _efl_ui_win_efl_gfx_entity_visible_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool v
2458 else _efl_ui_win_hide(obj, sd); 2458 else _efl_ui_win_hide(obj, sd);
2459} 2459}
2460 2460
2461EOLIAN static Eina_Position2D 2461EOLIAN static Eina_Bool
2462_efl_ui_win_efl_canvas_scene_pointer_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) 2462_efl_ui_win_efl_canvas_scene_pointer_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eo *dev, Eina_Position2D *pos)
2463{ 2463{
2464 Eina_Position2D pos; 2464 return efl_canvas_scene_pointer_position_get(sd->evas, dev, pos);
2465 evas_pointer_canvas_xy_get(sd->evas, &pos.x, &pos.y);
2466 return pos;
2467} 2465}
2468 2466
2469EOLIAN static Eina_Bool 2467EOLIAN static Eina_Bool
diff --git a/src/lib/evas/canvas/evas_canvas.eo b/src/lib/evas/canvas/evas_canvas.eo
index 2ce9c47361..2e00988508 100644
--- a/src/lib/evas/canvas/evas_canvas.eo
+++ b/src/lib/evas/canvas/evas_canvas.eo
@@ -966,6 +966,7 @@ class Evas.Canvas extends Efl.Loop_Consumer implements Efl.Canvas.Scene, Efl.Ani
966 Efl.Canvas.Scene.device { get; } 966 Efl.Canvas.Scene.device { get; }
967 Efl.Canvas.Scene.seat { get; } 967 Efl.Canvas.Scene.seat { get; }
968 Efl.Canvas.Scene.seat_default { get; } 968 Efl.Canvas.Scene.seat_default { get; }
969 Efl.Canvas.Scene.pointer_position { get; }
969 Efl.Canvas.Scene.image_max_size { get; } 970 Efl.Canvas.Scene.image_max_size { get; }
970 Efl.Canvas.Scene.objects_at_xy_get; 971 Efl.Canvas.Scene.objects_at_xy_get;
971 Efl.Canvas.Scene.object_top_at_xy_get; 972 Efl.Canvas.Scene.object_top_at_xy_get;
diff --git a/src/lib/evas/canvas/evas_device.c b/src/lib/evas/canvas/evas_device.c
index a5a28fa27b..617e323be0 100644
--- a/src/lib/evas/canvas/evas_device.c
+++ b/src/lib/evas/canvas/evas_device.c
@@ -526,3 +526,28 @@ _evas_device_top_get(const Evas *eo_e)
526 if (num < 1) return NULL; 526 if (num < 1) return NULL;
527 return eina_array_data_get(e->cur_device, num - 1); 527 return eina_array_data_get(e->cur_device, num - 1);
528} 528}
529
530EOLIAN Eina_Bool
531_evas_canvas_efl_canvas_scene_pointer_position_get(const Eo *eo_e, Evas_Public_Data *e, Efl_Input_Device *seat, Eina_Position2D *pos)
532{
533 Eina_Iterator *it;
534 Eo *child;
535
536 if (pos) *pos = EINA_POSITION2D(0, 0);
537 if (!e->default_seat) return EINA_FALSE;
538 if (!seat)
539 {
540 evas_pointer_canvas_xy_get(eo_e, &pos->x, &pos->y);
541 return EINA_TRUE;
542 }
543 it = efl_input_device_children_iterate(seat);
544 EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE);
545
546 EINA_ITERATOR_FOREACH(it, child)
547 if (_is_pointer(efl_input_device_type_get(child)))
548 break;
549 if (child)
550 *pos = efl_input_pointer_position_get(child);
551 eina_iterator_free(it);
552 return !!child;
553}
diff --git a/src/tests/elementary/elm_test_win.c b/src/tests/elementary/elm_test_win.c
index 1b67eabb12..e08e0d3be5 100644
--- a/src/tests/elementary/elm_test_win.c
+++ b/src/tests/elementary/elm_test_win.c
@@ -409,7 +409,7 @@ _inputs_timer3_cb(void *data)
409 fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone) 409 fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone)
410 410
411 fail_if(!efl_canvas_pointer_inside_get(win, NULL)); 411 fail_if(!efl_canvas_pointer_inside_get(win, NULL));
412 pos = efl_canvas_scene_pointer_position_get(win); 412 efl_canvas_scene_pointer_position_get(win, NULL, &pos);
413 ck_assert_int_eq(pos.x, points[1][0].x); 413 ck_assert_int_eq(pos.x, points[1][0].x);
414 ck_assert_int_eq(pos.y, points[1][0].y); 414 ck_assert_int_eq(pos.y, points[1][0].y);
415 415