bdilly pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=64986bccac5bdaddaa46dc1b9c411e00191f6590
commit 64986bccac5bdaddaa46dc1b9c411e00191f6590 Author: Guilherme Iscaro <isc...@profusion.mobi> Date: Mon Nov 21 15:11:08 2016 -0200 Ecore Evas: Add API to set/get the pointer position per device. Since Ecore Evas now support multiple mouse devices new APIs were added in order to fetch the mouse position. --- src/lib/ecore_evas/Ecore_Evas.h | 14 +++++++++++++- src/lib/ecore_evas/ecore_evas.c | 17 +++++++++++++++++ src/lib/ecore_evas/ecore_evas_buffer.c | 1 + src/lib/ecore_evas/ecore_evas_ews.c | 1 + src/lib/ecore_evas/ecore_evas_private.h | 1 + src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c | 1 + src/modules/ecore_evas/engines/drm/ecore_evas_drm.c | 1 + src/modules/ecore_evas/engines/extn/ecore_evas_extn.c | 1 + src/modules/ecore_evas/engines/fb/ecore_evas_fb.c | 1 + .../ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c | 1 + src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c | 1 + .../engines/wayland/ecore_evas_wayland_common.c | 1 + src/modules/ecore_evas/engines/win32/ecore_evas_win32.c | 1 + src/modules/ecore_evas/engines/x/ecore_evas_x.c | 1 + 14 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore_evas/Ecore_Evas.h b/src/lib/ecore_evas/Ecore_Evas.h index c2295f8..19493f8 100644 --- a/src/lib/ecore_evas/Ecore_Evas.h +++ b/src/lib/ecore_evas/Ecore_Evas.h @@ -2917,12 +2917,13 @@ EAPI Evas_Object *ecore_evas_extn_plug_new(Ecore_Evas *ee_target); EAPI Eina_Bool ecore_evas_extn_plug_connect(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys); /** - * @brief Retrieve the coordinates of the mouse pointer + * @brief Retrieve the coordinates of the default mouse pointer * * @param ee The Ecore_Evas containing the pointer * @param x Pointer to integer to store horizontal coordinate. May be @c NULL. * @param y Pointer to integer to store vertical coordinate. May be @c NULL. * + * @see ecore_evas_pointer_device_xy_get * @since 1.8 */ EAPI void ecore_evas_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y); @@ -2941,6 +2942,17 @@ EAPI void ecore_evas_pointer_xy_get(const Ecore_Evas *ee, Evas_Coord *x, Evas_Co EAPI Eina_Bool ecore_evas_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y); /** + * @brief Retrieve the coordinates of the mouse pointer + * + * @param ee The Ecore_Evas containing the pointer + * @param pointer The pointer device, use @c NULL for the default pointer. + * @param x Pointer to integer to store horizontal coordinate. May be @c NULL. + * @param y Pointer to integer to store vertical coordinate. May be @c NULL. + * @since 1.19 + */ +EAPI void ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y); + +/** * @brief Retrieve the Visual used for pixmap creation * * @param ee The Ecore_Evas containing the pixmap diff --git a/src/lib/ecore_evas/ecore_evas.c b/src/lib/ecore_evas/ecore_evas.c index ea4ce4b..43ec72a 100644 --- a/src/lib/ecore_evas/ecore_evas.c +++ b/src/lib/ecore_evas/ecore_evas.c @@ -2381,6 +2381,23 @@ ecore_evas_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y) return EINA_FALSE; } +EAPI void +ecore_evas_pointer_device_xy_get(const Ecore_Evas *ee, + const Efl_Input_Device *pointer, Evas_Coord *x, + Evas_Coord *y) +{ + if (!pointer || pointer == evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_CLASS_MOUSE)) + ecore_evas_pointer_xy_get(ee, x, y); + else + { + if (x) *x = 0; + if (y) *y = 0; + ECORE_EVAS_CHECK(ee); + if (ee->engine.func->fn_pointer_device_xy_get) + ee->engine.func->fn_pointer_device_xy_get(ee, pointer, x, y); + } +} + EAPI void * ecore_evas_pixmap_visual_get(const Ecore_Evas *ee) { diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c index 0d1643c..979f925 100644 --- a/src/lib/ecore_evas/ecore_evas_buffer.c +++ b/src/lib/ecore_evas/ecore_evas_buffer.c @@ -607,6 +607,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; static void * diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c index 693e9db..719d5ea 100644 --- a/src/lib/ecore_evas/ecore_evas_ews.c +++ b/src/lib/ecore_evas/ecore_evas_ews.c @@ -719,6 +719,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; void diff --git a/src/lib/ecore_evas/ecore_evas_private.h b/src/lib/ecore_evas/ecore_evas_private.h index f9c66fe..919d2da 100644 --- a/src/lib/ecore_evas/ecore_evas_private.h +++ b/src/lib/ecore_evas/ecore_evas_private.h @@ -165,6 +165,7 @@ struct _Ecore_Evas_Engine_Func void (*fn_callback_device_mouse_in_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func); void (*fn_callback_device_mouse_out_set) (Ecore_Evas *ee, Ecore_Evas_Mouse_IO_Cb func); + void (*fn_pointer_device_xy_get)(const Ecore_Evas *ee, const Efl_Input_Device *pointer, Evas_Coord *x, Evas_Coord *y); }; struct _Ecore_Evas_Interface diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c index a2afc3d..488ed67 100644 --- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c +++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c @@ -675,6 +675,7 @@ static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; static Ecore_Cocoa_Window * diff --git a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c index d8d4d6a..b1ab702 100644 --- a/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c +++ b/src/modules/ecore_evas/engines/drm/ecore_evas_drm.c @@ -796,6 +796,7 @@ static Ecore_Evas_Engine_Func _ecore_evas_drm_engine_func = NULL, //fn_focus_device_set NULL, //fn_callback_focus_device_in_set NULL, //fn_callback_focus_device_out_set + NULL, //fn_pointer_device_xy_get }; static Ecore_Evas * diff --git a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c index 3b364d8..24b230b 100644 --- a/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c +++ b/src/modules/ecore_evas/engines/extn/ecore_evas_extn.c @@ -925,6 +925,7 @@ static const Ecore_Evas_Engine_Func _ecore_extn_plug_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; static Eina_Bool diff --git a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c index f5d84bd..2e82862 100644 --- a/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c +++ b/src/modules/ecore_evas/engines/fb/ecore_evas_fb.c @@ -642,6 +642,7 @@ static Ecore_Evas_Engine_Func _ecore_fb_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; EAPI Ecore_Evas * diff --git a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c index fc8c6ce..a65a61a 100644 --- a/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c +++ b/src/modules/ecore_evas/engines/psl1ght/ecore_evas_psl1ght.c @@ -463,6 +463,7 @@ static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; EAPI Ecore_Evas * diff --git a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c index 440185e..782d065 100644 --- a/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c +++ b/src/modules/ecore_evas/engines/sdl/ecore_evas_sdl.c @@ -555,6 +555,7 @@ static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; static Ecore_Evas* diff --git a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c index 85a103f..565ff81 100644 --- a/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c +++ b/src/modules/ecore_evas/engines/wayland/ecore_evas_wayland_common.c @@ -90,6 +90,7 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; #define _smart_frame_type "ecore_evas_wl_frame" diff --git a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c index 27b4160..4469c66 100644 --- a/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c +++ b/src/modules/ecore_evas/engines/win32/ecore_evas_win32.c @@ -1207,6 +1207,7 @@ static Ecore_Evas_Engine_Func _ecore_win32_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; #endif /* BUILD_ECORE_EVAS_WIN32 */ diff --git a/src/modules/ecore_evas/engines/x/ecore_evas_x.c b/src/modules/ecore_evas/engines/x/ecore_evas_x.c index b6e4009..3c52034 100644 --- a/src/modules/ecore_evas/engines/x/ecore_evas_x.c +++ b/src/modules/ecore_evas/engines/x/ecore_evas_x.c @@ -3788,6 +3788,7 @@ static Ecore_Evas_Engine_Func _ecore_x_engine_func = NULL, //fn_callback_focus_device_out_set NULL, //fn_callback_device_mouse_in_set NULL, //fn_callback_device_mouse_out_set + NULL, //fn_pointer_device_xy_get }; /* --