Evas: Add API to access private function

We need a function in DnD for the overlapping feature to retrieve all
the objects at a specific position.
A private function exists in Evas (evas_event_objects_event_list) for
that purpose.
We need an access to this function for Elementary but we don't
want the is_frozen flag to be checked.
This commit is contained in:
Daniel Zaoui 2013-10-13 06:55:28 +03:00
parent 203c3e7c15
commit 208c424238
5 changed files with 73 additions and 3 deletions

View File

@ -257,6 +257,7 @@ enum
EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE,
EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE_COUNT_GET,
EVAS_CANVAS_SUB_ID_RENDER_ASYNC,
EVAS_CANVAS_SUB_ID_TREE_OBJECTS_AT_XY_GET,
EVAS_CANVAS_SUB_ID_LAST
};
@ -1158,6 +1159,23 @@ enum
* @see evas_event_refeed_event
*/
#define evas_canvas_event_refeed_event(event_copy, event_type) EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_EVENT_REFEED_EVENT), EO_TYPECHECK(void *, event_copy), EO_TYPECHECK(Evas_Callback_Type, event_type)
/**
* @def evas_canvas_tree_objects_at_xy_get
* @since 1.8
*
* Retrieve a list of Evas objects lying over a given position in
* a canvas.
*
* @param[in] stop An Evas Object where to stop searching.
* @param[in] x The horizontal coordinate of the position.
* @param[in] y The vertical coordinate of the position.
* @param[out] list of Evas Objects.
*
* @see evas_tree_objects_at_xy_get
*/
#define evas_canvas_tree_objects_at_xy_get(stop, x, y, ret) EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_TREE_OBJECTS_AT_XY_GET), EO_TYPECHECK(Evas_Object *, stop), EO_TYPECHECK(int, x), EO_TYPECHECK(int, y), EO_TYPECHECK(Eina_List **, ret)
/**
* @}
*/

View File

@ -1271,6 +1271,24 @@ EAPI void evas_event_feed_hold(Evas *e, int hold, unsigned int timestamp, const
*/
EAPI void evas_event_refeed_event(Evas *e, void *event_copy, Evas_Callback_Type event_type) EINA_ARG_NONNULL(1);
/**
* Retrieve a list of Evas objects lying over a given position in
* a canvas.
*
* @param e A handle to the canvas.
* @param stop An Evas Object where to stop searching.
* @param x The horizontal coordinate of the position.
* @param y The vertical coordinate of the position.
*
* This function will traverse all the layers of the given canvas,
* from top to bottom, querying for objects with areas covering the
* given position. It will enter the smart objects.
* It will not append to the list pass events as hidden objects.
* Call eina_list_free on the returned list after usage.
*
*/
EAPI Eina_List *evas_tree_objects_at_xy_get(Evas *eo_e, Evas_Object *stop, int x, int y) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
/**
* @}
*/

View File

@ -861,14 +861,14 @@ _evas_event_object_list_in_get(Evas *eo_e, Eina_List *in,
no_rep, source);
}
Eina_List *
evas_event_objects_event_list(Evas *eo_e, Evas_Object *stop, int x, int y)
static Eina_List *
_evas_event_objects_event_list_no_frozen_check(Evas *eo_e, Evas_Object *stop, int x, int y)
{
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS);
Evas_Layer *lay;
Eina_List *in = NULL;
if ((!e->layers) || (e->is_frozen)) return NULL;
if (!e->layers) return NULL;
EINA_INLIST_REVERSE_FOREACH((EINA_INLIST_GET(e->layers)), lay)
{
@ -881,6 +881,37 @@ evas_event_objects_event_list(Evas *eo_e, Evas_Object *stop, int x, int y)
return in;
}
EAPI Eina_List *
evas_tree_objects_at_xy_get(Evas *eo_e, Evas_Object *stop, int x, int y)
{
MAGIC_CHECK(eo_e, Evas, MAGIC_EVAS);
return NULL;
MAGIC_CHECK_END();
Eina_List *list = NULL;
eo_do(eo_e, evas_canvas_tree_objects_at_xy_get(stop, x, y, &list));
return list;
}
void
_canvas_tree_objects_at_xy_get(Eo *eo_e, void *_pd EINA_UNUSED, va_list *list)
{
Evas_Object *stop = va_arg(*list, Evas_Object *);
int x = va_arg(*list, int);
int y = va_arg(*list, int);
Eina_List **in = va_arg(*list, Eina_List **);
*in = _evas_event_objects_event_list_no_frozen_check(eo_e, stop, x, y);
}
Eina_List *
evas_event_objects_event_list(Evas *eo_e, Evas_Object *stop, int x, int y)
{
Evas_Public_Data *e = eo_data_scope_get(eo_e, EVAS_CLASS);
if ((!e->layers) || (e->is_frozen)) return NULL;
return _evas_event_objects_event_list_no_frozen_check(eo_e, stop, x, y);
}
static Eina_List *
evas_event_list_copy(Eina_List *list)
{

View File

@ -1103,6 +1103,7 @@ _class_constructor(Eo_Class *klass)
EO_OP_FUNC(EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE), _canvas_smart_objects_calculate),
EO_OP_FUNC(EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE_COUNT_GET), _canvas_smart_objects_calculate_count_get),
EO_OP_FUNC(EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_RENDER_ASYNC), _canvas_render_async),
EO_OP_FUNC(EVAS_CANVAS_ID(EVAS_CANVAS_SUB_ID_TREE_OBJECTS_AT_XY_GET), _canvas_tree_objects_at_xy_get),
EO_OP_FUNC_SENTINEL
};
@ -1207,6 +1208,7 @@ static const Eo_Op_Description op_desc[] = {
EO_OP_DESCRIPTION(EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE, "Call user-provided calculate() smart functions."),
EO_OP_DESCRIPTION(EVAS_CANVAS_SUB_ID_SMART_OBJECTS_CALCULATE_COUNT_GET, "Get the internal counter that counts the number of smart calculations."),
EO_OP_DESCRIPTION(EVAS_CANVAS_SUB_ID_RENDER_ASYNC, "Renders the canvas asynchronously."),
EO_OP_DESCRIPTION(EVAS_CANVAS_SUB_ID_TREE_OBJECTS_AT_XY_GET, "Retrieve a list of Evas objects lying over a given position in a canvas."),
EO_OP_DESCRIPTION_SENTINEL
};

View File

@ -1144,6 +1144,7 @@ void _canvas_event_feed_key_up(Eo *e, void *_pd, va_list *list);
void _canvas_event_feed_hold(Eo *e, void *_pd, va_list *list);
void _canvas_event_refeed_event(Eo *e, void *_pd, va_list *list);
void _canvas_event_down_count_get(Eo *e, void *_pd, va_list *list);
void _canvas_tree_objects_at_xy_get(Eo *e, void *_pd, va_list *list);
void _canvas_focus_get(Eo *e, void *_pd, va_list *list);
void _canvas_font_path_clear(Eo *e, void *_pd, va_list *list);
void _canvas_font_path_append(Eo *e, void *_pd, va_list *list);