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.
This commit is contained in:
Guilherme Iscaro 2016-11-21 15:11:08 -02:00 committed by Bruno Dilly
parent e64327bacc
commit 64986bccac
14 changed files with 42 additions and 1 deletions

View File

@ -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);
@ -2940,6 +2941,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
*

View File

@ -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)
{

View File

@ -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 *

View File

@ -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

View File

@ -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

View File

@ -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 *

View File

@ -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 *

View File

@ -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

View File

@ -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 *

View File

@ -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 *

View File

@ -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*

View File

@ -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"

View File

@ -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 */

View File

@ -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
};
/*