bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=99c3d42efdb614ae17dec7321e2f9c919c3b8213
commit 99c3d42efdb614ae17dec7321e2f9c919c3b8213 Author: Mike Blumenkrantz <zm...@samsung.com> Date: Thu Feb 14 15:21:15 2019 -0500 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.b...@free.fr> Reviewed-by: Marcel Hollerbach <marcel-hollerb...@t-online.de> Differential Revision: https://phab.enlightenment.org/D7957 --- src/lib/efl/interfaces/efl_canvas_scene.eo | 5 ++++- src/lib/elementary/efl_ui_win.c | 8 +++----- src/lib/evas/canvas/evas_canvas.eo | 1 + src/lib/evas/canvas/evas_device.c | 25 +++++++++++++++++++++++++ src/tests/elementary/elm_test_win.c | 2 +- 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 This function returns the current position of the main input pointer (mouse, pen, etc...). ]] + return: bool; [[$true if a pointer exists for the given seat, otherwise $false.]] + } + keys { + seat: Efl.Input.Device; [[The seat, or $null to use the default.]] } - /* FIXME: missing keys { seat } */ values { pos: Eina.Position2D; [[The pointer position in pixels.]] } 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 else _efl_ui_win_hide(obj, sd); } -EOLIAN static Eina_Position2D -_efl_ui_win_efl_canvas_scene_pointer_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd) +EOLIAN static Eina_Bool +_efl_ui_win_efl_canvas_scene_pointer_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eo *dev, Eina_Position2D *pos) { - Eina_Position2D pos; - evas_pointer_canvas_xy_get(sd->evas, &pos.x, &pos.y); - return pos; + return efl_canvas_scene_pointer_position_get(sd->evas, dev, pos); } EOLIAN 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 Efl.Canvas.Scene.device { get; } Efl.Canvas.Scene.seat { get; } Efl.Canvas.Scene.seat_default { get; } + Efl.Canvas.Scene.pointer_position { get; } Efl.Canvas.Scene.image_max_size { get; } Efl.Canvas.Scene.objects_at_xy_get; 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) if (num < 1) return NULL; return eina_array_data_get(e->cur_device, num - 1); } + +EOLIAN Eina_Bool +_evas_canvas_efl_canvas_scene_pointer_position_get(const Eo *eo_e, Evas_Public_Data *e, Efl_Input_Device *seat, Eina_Position2D *pos) +{ + Eina_Iterator *it; + Eo *child; + + if (pos) *pos = EINA_POSITION2D(0, 0); + if (!e->default_seat) return EINA_FALSE; + if (!seat) + { + evas_pointer_canvas_xy_get(eo_e, &pos->x, &pos->y); + return EINA_TRUE; + } + it = efl_input_device_children_iterate(seat); + EINA_SAFETY_ON_NULL_RETURN_VAL(it, EINA_FALSE); + + EINA_ITERATOR_FOREACH(it, child) + if (_is_pointer(efl_input_device_type_get(child))) + break; + if (child) + *pos = efl_input_pointer_position_get(child); + eina_iterator_free(it); + return !!child; +} 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) fail_if(cnt != 2); // 2 moves (in the list), 2 ups (gone) fail_if(!efl_canvas_pointer_inside_get(win, NULL)); - pos = efl_canvas_scene_pointer_position_get(win); + efl_canvas_scene_pointer_position_get(win, NULL, &pos); ck_assert_int_eq(pos.x, points[1][0].x); ck_assert_int_eq(pos.y, points[1][0].y); --