2016-06-13 22:04:34 -07:00
|
|
|
|
2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h"
|
2002-11-08 00:02:15 -08:00
|
|
|
#include "evas_private.h"
|
|
|
|
|
2010-11-26 02:01:18 -08:00
|
|
|
EVAS_MEMPOOL(_mp_pc);
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
extern Eina_Hash* signals_hash_table;
|
|
|
|
|
2016-08-18 23:42:44 -07:00
|
|
|
/* Legacy events, do not use anywhere */
|
2019-10-14 06:29:37 -07:00
|
|
|
void _evas_object_smart_callback_call_internal(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc);
|
2016-08-18 23:42:44 -07:00
|
|
|
static const Efl_Event_Description _EVAS_OBJECT_EVENT_FREE = EFL_EVENT_DESCRIPTION("free");
|
|
|
|
static const Efl_Event_Description _EVAS_OBJECT_EVENT_DEL = EFL_EVENT_DESCRIPTION("del");
|
|
|
|
#define EVAS_OBJECT_EVENT_FREE (&(_EVAS_OBJECT_EVENT_FREE))
|
|
|
|
#define EVAS_OBJECT_EVENT_DEL (&(_EVAS_OBJECT_EVENT_DEL))
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
/**
|
|
|
|
* Evas events descriptions for Eo.
|
|
|
|
*/
|
2016-08-10 02:59:36 -07:00
|
|
|
#define DEFINE_EVAS_CALLBACKS(FUNC, LAST, ...) \
|
2016-08-10 19:58:42 -07:00
|
|
|
static const Efl_Event_Description *FUNC(unsigned int index) \
|
2016-06-15 11:41:09 -07:00
|
|
|
{ \
|
2016-08-10 19:58:42 -07:00
|
|
|
static const Efl_Event_Description *internals[LAST] = { NULL }; \
|
2016-06-15 11:41:09 -07:00
|
|
|
\
|
2016-08-10 02:59:36 -07:00
|
|
|
if (index >= LAST) return NULL; \
|
2016-06-15 11:41:09 -07:00
|
|
|
if (internals[0] == NULL) \
|
|
|
|
{ \
|
|
|
|
memcpy(internals, \
|
2016-08-10 19:58:42 -07:00
|
|
|
((const Efl_Event_Description*[]) { __VA_ARGS__ }), \
|
|
|
|
sizeof ((const Efl_Event_Description *[]) { __VA_ARGS__ })); \
|
2016-06-15 11:41:09 -07:00
|
|
|
} \
|
|
|
|
return internals[index]; \
|
|
|
|
}
|
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
DEFINE_EVAS_CALLBACKS(_legacy_evas_callback_table, EVAS_CALLBACK_LAST,
|
|
|
|
EFL_EVENT_POINTER_IN,
|
|
|
|
EFL_EVENT_POINTER_OUT,
|
|
|
|
EFL_EVENT_POINTER_DOWN,
|
|
|
|
EFL_EVENT_POINTER_UP,
|
|
|
|
EFL_EVENT_POINTER_MOVE,
|
|
|
|
EFL_EVENT_POINTER_WHEEL,
|
2016-08-30 19:33:20 -07:00
|
|
|
EFL_EVENT_FINGER_DOWN,
|
|
|
|
EFL_EVENT_FINGER_UP,
|
|
|
|
EFL_EVENT_FINGER_MOVE,
|
2016-08-18 23:42:44 -07:00
|
|
|
EVAS_OBJECT_EVENT_FREE,
|
2016-08-10 02:59:36 -07:00
|
|
|
EFL_EVENT_KEY_DOWN,
|
|
|
|
EFL_EVENT_KEY_UP,
|
2016-11-18 08:56:20 -08:00
|
|
|
EFL_EVENT_FOCUS_IN,
|
|
|
|
EFL_EVENT_FOCUS_OUT,
|
2018-04-05 01:47:26 -07:00
|
|
|
EFL_GFX_ENTITY_EVENT_SHOW,
|
|
|
|
EFL_GFX_ENTITY_EVENT_HIDE,
|
2019-02-21 10:01:56 -08:00
|
|
|
EFL_GFX_ENTITY_EVENT_POSITION_CHANGED,
|
|
|
|
EFL_GFX_ENTITY_EVENT_SIZE_CHANGED,
|
2019-02-21 11:09:41 -08:00
|
|
|
EFL_GFX_ENTITY_EVENT_STACKING_CHANGED,
|
2016-08-18 23:42:44 -07:00
|
|
|
EVAS_OBJECT_EVENT_DEL,
|
2016-08-10 02:59:36 -07:00
|
|
|
EFL_EVENT_HOLD,
|
2019-02-21 09:46:36 -08:00
|
|
|
EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
|
2019-03-08 07:54:52 -08:00
|
|
|
EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD,
|
efl_canvas_scene: rename event from focus,* to scene_focus,*
Summary:
This event can just be renamed, no need to handle legacy. The reason for
this, that this event is used to map to EVAS_CALLBACK_ enum fields,
which means, the legacy names of the event does not matter.
ref T7476
Reviewers: cedric, segfaultxavi, zmike, stefan_schmidt
Reviewed By: zmike
Subscribers: #reviewers, #committers
Tags: #efl
Maniphest Tasks: T7476
Differential Revision: https://phab.enlightenment.org/D8242
2019-03-08 06:02:30 -08:00
|
|
|
EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_IN,
|
|
|
|
EFL_CANVAS_SCENE_EVENT_SCENE_FOCUS_OUT,
|
2016-06-15 11:41:09 -07:00
|
|
|
EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE,
|
|
|
|
EVAS_CANVAS_EVENT_RENDER_FLUSH_POST,
|
2018-03-26 06:21:21 -07:00
|
|
|
EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN,
|
|
|
|
EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT,
|
2019-03-08 07:54:52 -08:00
|
|
|
EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD,
|
2018-03-26 06:21:21 -07:00
|
|
|
EFL_CANVAS_SCENE_EVENT_RENDER_PRE,
|
|
|
|
EFL_CANVAS_SCENE_EVENT_RENDER_POST,
|
2019-09-16 01:58:24 -07:00
|
|
|
EFL_GFX_IMAGE_EVENT_IMAGE_RESIZED,
|
2018-03-26 06:21:21 -07:00
|
|
|
EFL_CANVAS_SCENE_EVENT_DEVICE_CHANGED,
|
2016-08-23 04:23:48 -07:00
|
|
|
EFL_EVENT_POINTER_AXIS,
|
2016-06-15 11:41:09 -07:00
|
|
|
EVAS_CANVAS_EVENT_VIEWPORT_RESIZE );
|
2013-04-11 12:08:24 -07:00
|
|
|
|
2016-08-19 00:40:57 -07:00
|
|
|
static inline Evas_Callback_Type
|
|
|
|
_legacy_evas_callback_type(const Efl_Event_Description *desc)
|
|
|
|
{
|
|
|
|
Evas_Callback_Type type;
|
|
|
|
|
|
|
|
for (type = 0; type < EVAS_CALLBACK_LAST; type++)
|
|
|
|
{
|
|
|
|
if (_legacy_evas_callback_table(type) == desc)
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EVAS_CALLBACK_LAST;
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:03:45 -07:00
|
|
|
typedef enum {
|
|
|
|
EFL_EVENT_TYPE_NULL,
|
|
|
|
EFL_EVENT_TYPE_OBJECT,
|
|
|
|
EFL_EVENT_TYPE_STRUCT,
|
|
|
|
EFL_EVENT_TYPE_POINTER,
|
|
|
|
EFL_EVENT_TYPE_KEY,
|
2016-11-18 08:56:20 -08:00
|
|
|
EFL_EVENT_TYPE_HOLD,
|
|
|
|
EFL_EVENT_TYPE_FOCUS
|
2016-08-25 00:03:45 -07:00
|
|
|
} Efl_Event_Info_Type;
|
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
EINA_INLIST;
|
2017-03-13 23:30:40 -07:00
|
|
|
union {
|
|
|
|
Evas_Event_Cb evas_cb;
|
|
|
|
Evas_Object_Event_Cb object_cb;
|
|
|
|
} func;
|
|
|
|
void *data;
|
|
|
|
Evas_Callback_Type type;
|
|
|
|
Efl_Event_Info_Type efl_event_type;
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
Evas_Callback_Priority priority;
|
2017-03-13 23:30:40 -07:00
|
|
|
} Evas_Event_Cb_Wrapper_Info;
|
2016-05-30 22:39:10 -07:00
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
static int
|
2016-08-25 00:03:45 -07:00
|
|
|
_evas_event_efl_event_info_type(Evas_Callback_Type type)
|
2016-08-10 02:59:36 -07:00
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case EVAS_CALLBACK_MOUSE_IN:
|
|
|
|
case EVAS_CALLBACK_MOUSE_OUT:
|
|
|
|
case EVAS_CALLBACK_MOUSE_DOWN:
|
|
|
|
case EVAS_CALLBACK_MOUSE_UP:
|
|
|
|
case EVAS_CALLBACK_MOUSE_MOVE:
|
|
|
|
case EVAS_CALLBACK_MOUSE_WHEEL:
|
|
|
|
case EVAS_CALLBACK_MULTI_DOWN:
|
|
|
|
case EVAS_CALLBACK_MULTI_UP:
|
|
|
|
case EVAS_CALLBACK_MULTI_MOVE:
|
2016-08-23 04:23:48 -07:00
|
|
|
case EVAS_CALLBACK_AXIS_UPDATE:
|
2016-08-10 02:59:36 -07:00
|
|
|
return EFL_EVENT_TYPE_POINTER;
|
2016-08-25 00:03:45 -07:00
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
case EVAS_CALLBACK_KEY_DOWN:
|
|
|
|
case EVAS_CALLBACK_KEY_UP:
|
|
|
|
return EFL_EVENT_TYPE_KEY;
|
2016-08-25 00:03:45 -07:00
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
case EVAS_CALLBACK_HOLD:
|
|
|
|
return EFL_EVENT_TYPE_HOLD;
|
2016-08-25 00:03:45 -07:00
|
|
|
|
|
|
|
case EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN:
|
|
|
|
case EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT: /* Efl.Canvas.Object */
|
|
|
|
return EFL_EVENT_TYPE_OBJECT;
|
|
|
|
|
|
|
|
case EVAS_CALLBACK_RENDER_POST: /* Efl_Gfx_Event_Render_Post */
|
|
|
|
return EFL_EVENT_TYPE_STRUCT;
|
|
|
|
|
|
|
|
case EVAS_CALLBACK_DEVICE_CHANGED: /* Efl.Input.Device */
|
|
|
|
return EFL_EVENT_TYPE_OBJECT;
|
|
|
|
|
2016-11-18 08:56:20 -08:00
|
|
|
case EVAS_CALLBACK_FOCUS_IN:
|
|
|
|
case EVAS_CALLBACK_FOCUS_OUT:
|
|
|
|
return EFL_EVENT_TYPE_FOCUS;
|
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
default:
|
2016-08-25 00:03:45 -07:00
|
|
|
return EFL_EVENT_TYPE_NULL;
|
2016-08-10 02:59:36 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_eo_evas_object_cb(void *data, const Efl_Event *event)
|
2013-04-11 12:08:24 -07:00
|
|
|
{
|
2016-08-10 02:59:36 -07:00
|
|
|
Evas_Event_Flags *event_flags = NULL, evflags = EVAS_EVENT_FLAG_NONE;
|
2016-08-25 03:20:10 -07:00
|
|
|
Efl_Input_Event *efl_event_info = event->info;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info = data;
|
2016-08-10 02:59:36 -07:00
|
|
|
void *event_info;
|
|
|
|
Evas *evas;
|
|
|
|
|
2017-03-13 23:30:40 -07:00
|
|
|
if (!info->func.object_cb) return;
|
2016-08-10 02:59:36 -07:00
|
|
|
evas = evas_object_evas_get(event->object);
|
|
|
|
|
2016-11-18 08:56:20 -08:00
|
|
|
event_info = event->info;
|
2016-08-25 00:03:45 -07:00
|
|
|
switch (info->efl_event_type)
|
2016-08-10 02:59:36 -07:00
|
|
|
{
|
|
|
|
case EFL_EVENT_TYPE_POINTER:
|
2016-10-16 19:34:05 -07:00
|
|
|
event_info = efl_input_pointer_legacy_info_fill(evas, efl_event_info, info->type, &event_flags);
|
2016-08-10 02:59:36 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_KEY:
|
2016-08-25 03:20:10 -07:00
|
|
|
event_info = efl_input_key_legacy_info_fill(efl_event_info, &event_flags);
|
2016-08-10 02:59:36 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_HOLD:
|
2016-08-25 03:20:10 -07:00
|
|
|
event_info = efl_input_hold_legacy_info_fill(efl_event_info, &event_flags);
|
2016-08-10 02:59:36 -07:00
|
|
|
break;
|
|
|
|
|
2016-11-18 08:56:20 -08:00
|
|
|
case EFL_EVENT_TYPE_FOCUS:
|
2016-08-25 00:03:45 -07:00
|
|
|
case EFL_EVENT_TYPE_NULL:
|
2017-03-13 23:30:40 -07:00
|
|
|
info->func.object_cb(info->data, evas, event->object, NULL);
|
|
|
|
return;
|
|
|
|
|
2016-08-25 00:03:45 -07:00
|
|
|
case EFL_EVENT_TYPE_STRUCT:
|
|
|
|
case EFL_EVENT_TYPE_OBJECT:
|
2017-03-13 23:30:40 -07:00
|
|
|
info->func.object_cb(info->data, evas, event->object, event_info);
|
2016-08-10 02:59:36 -07:00
|
|
|
return;
|
2017-03-13 23:30:40 -07:00
|
|
|
|
2016-08-10 02:59:36 -07:00
|
|
|
default: return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!event_info) return;
|
|
|
|
if (event_flags) evflags = *event_flags;
|
2017-03-13 23:30:40 -07:00
|
|
|
info->func.object_cb(info->data, evas, event->object, event_info);
|
2016-08-10 02:59:36 -07:00
|
|
|
if (event_flags && (evflags != *event_flags))
|
2016-08-25 03:20:10 -07:00
|
|
|
efl_input_event_flags_set(efl_event_info, *event_flags);
|
2013-04-11 12:08:24 -07:00
|
|
|
}
|
|
|
|
|
2016-06-20 07:31:31 -07:00
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_eo_evas_cb(void *data, const Efl_Event *event)
|
2013-04-11 12:08:24 -07:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info = data;
|
|
|
|
Efl_Input_Event *efl_event_info = event->info;
|
|
|
|
Evas *evas = event->object;
|
2016-11-17 12:22:50 -08:00
|
|
|
void *event_info;
|
2017-03-13 23:30:40 -07:00
|
|
|
|
|
|
|
if (!info->func.evas_cb) return;
|
|
|
|
|
2018-03-26 06:21:21 -07:00
|
|
|
if (event->desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_IN ||
|
|
|
|
event->desc == EFL_CANVAS_SCENE_EVENT_OBJECT_FOCUS_OUT)
|
2017-03-13 23:30:40 -07:00
|
|
|
{
|
|
|
|
event_info = efl_input_focus_object_get(efl_event_info);
|
|
|
|
goto emit;
|
|
|
|
}
|
|
|
|
|
|
|
|
event_info = event->info;
|
|
|
|
switch (info->efl_event_type)
|
|
|
|
{
|
|
|
|
case EFL_EVENT_TYPE_POINTER:
|
|
|
|
event_info = efl_input_pointer_legacy_info_fill(evas, efl_event_info, info->type, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_KEY:
|
|
|
|
event_info = efl_input_key_legacy_info_fill(efl_event_info, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_HOLD:
|
|
|
|
event_info = efl_input_hold_legacy_info_fill(efl_event_info, NULL);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_FOCUS:
|
|
|
|
case EFL_EVENT_TYPE_NULL:
|
|
|
|
event_info = NULL;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EFL_EVENT_TYPE_STRUCT:
|
|
|
|
case EFL_EVENT_TYPE_OBJECT:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
emit:
|
|
|
|
info->func.evas_cb(info->data, event->object, event_info);
|
2013-04-11 12:08:24 -07:00
|
|
|
}
|
|
|
|
|
2010-05-04 08:58:10 -07:00
|
|
|
void
|
2017-02-17 01:06:10 -08:00
|
|
|
_evas_post_event_callback_call_real(Evas *eo_e, Evas_Public_Data *e, int min_event_id)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
|
|
|
Evas_Post_Callback *pc;
|
2017-02-13 21:42:33 -08:00
|
|
|
Eina_List *l, *l_next;
|
2010-05-04 08:58:10 -07:00
|
|
|
int skip = 0;
|
|
|
|
|
2017-02-16 02:34:08 -08:00
|
|
|
if (e->delete_me) return;
|
evas: Strengthen post-event callbacks
See T3144 that I marked as Wontfix.
Bryce in E manually feeds events from a post-event callback
resulting in Evas going insane and leading to frequent crashes.
The ideal solution (for E) would be to ensure that everything works
smoothly, the input event data is valid up until the post-event cb
is called, etc... Unfortunately, with recursive events the exact
order of operations may be messed up: the post-event
I don't want to add yet more complexity to Evas events here (it's
already spaghetti all over the place) so I'm simply blocking any
new event feed when running the post-event callback list.
It's not possible to just freeze the events (I tried, it failed).
**********************
Some more explanation:
post-event callbacks are used to implement reverse-order logic
where the on-hold flag of an input event may be set by an event
listener that does not come first.
Here's a situation to illustrate: scroller A inside scroller B.
As events are propagated from children to parents (assuming the
propagate flag is set), we'd assume the events to go first to A
and then to B, which means a mouse wheel event would make the
inner-most scroller (A) scroll, and the outer-most scroller (B)
wouldn't budge.
But as things are designed, A and B are not simple evas objects,
and the actual event-catching object is a top-most transparent
rectangle (top-most in Z stack order). Since A is inside B, B's
rectangle BR is over A's rectangle AR, thus catches the wheel
event first. But in terms of UX we still want A to scroll, not B.
The solution then is to reverse the event processing order and
post-event callbacks are the way to do that. This comes with the
consequence that the event_info needs to remain valid until the
post-event is called, and stay the same (so that the on-hold flag
set by A can be read by B).
Recursive events (by explicit feed or modifying the canvas so
that mouse,in or mouse,out are triggered) mess with this logic,
and trigger the post-events too early (event is not fully
processed) or too late (event_info is not valid anymore... and
crash!).
Thanks @raster for explaining the goal of post-event callbacks!
2017-02-15 23:47:57 -08:00
|
|
|
|
2010-05-04 08:58:10 -07:00
|
|
|
_evas_walk(e);
|
2017-02-16 02:34:08 -08:00
|
|
|
e->running_post_events++;
|
2017-02-13 21:42:33 -08:00
|
|
|
EINA_LIST_FOREACH_SAFE(e->post_events, l, l_next, pc)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
2017-02-16 02:34:08 -08:00
|
|
|
if ((unsigned int) pc->event_id < (unsigned int) min_event_id) break;
|
2017-02-13 21:42:33 -08:00
|
|
|
e->post_events = eina_list_remove_list(e->post_events, l);
|
2010-05-04 08:58:10 -07:00
|
|
|
if ((!skip) && (!e->delete_me) && (!pc->delete_me))
|
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
if (!pc->func((void*)pc->data, eo_e)) skip = 1;
|
2010-05-04 08:58:10 -07:00
|
|
|
}
|
2011-12-14 21:56:19 -08:00
|
|
|
EVAS_MEMPOOL_FREE(_mp_pc, pc);
|
2010-05-04 08:58:10 -07:00
|
|
|
}
|
2017-02-16 02:34:08 -08:00
|
|
|
e->running_post_events--;
|
2010-05-04 08:58:10 -07:00
|
|
|
_evas_unwalk(e);
|
2017-02-16 02:34:08 -08:00
|
|
|
|
2017-02-16 03:17:12 -08:00
|
|
|
if (!e->running_post_events && e->post_events
|
|
|
|
&& (e->current_event == EVAS_CALLBACK_LAST))
|
2017-02-16 02:34:08 -08:00
|
|
|
{
|
2017-02-16 03:17:12 -08:00
|
|
|
WRN("Not all post-event callbacks have been processed!");
|
2017-02-17 01:06:10 -08:00
|
|
|
_evas_post_event_callback_call_real(eo_e, e, 0);
|
2017-02-16 02:34:08 -08:00
|
|
|
}
|
2010-05-04 08:58:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
_evas_post_event_callback_free(Evas *eo_e)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2010-05-04 08:58:10 -07:00
|
|
|
Evas_Post_Callback *pc;
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2017-02-15 23:26:42 -08:00
|
|
|
if (EINA_LIKELY(!e->post_events)) return;
|
|
|
|
|
2010-05-04 08:58:10 -07:00
|
|
|
EINA_LIST_FREE(e->post_events, pc)
|
|
|
|
{
|
2011-12-14 21:56:19 -08:00
|
|
|
EVAS_MEMPOOL_FREE(_mp_pc, pc);
|
2010-05-04 08:58:10 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-31 20:26:55 -08:00
|
|
|
void
|
2013-04-11 12:08:24 -07:00
|
|
|
evas_object_event_callback_all_del(Evas_Object *eo_obj)
|
2003-01-19 19:54:00 -08:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2013-04-11 12:08:24 -07:00
|
|
|
Eina_Inlist *itr;
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
2003-01-19 19:54:00 -08:00
|
|
|
|
2012-11-11 18:22:39 -08:00
|
|
|
if (!obj) return;
|
2003-02-08 20:22:45 -08:00
|
|
|
if (!obj->callbacks) return;
|
2013-04-11 12:08:24 -07:00
|
|
|
EINA_INLIST_FOREACH_SAFE(obj->callbacks, itr, info)
|
2007-01-22 04:44:57 -08:00
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_obj, _legacy_evas_callback_table(info->type), _eo_evas_object_cb, info);
|
2003-01-19 19:54:00 -08:00
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
obj->callbacks =
|
|
|
|
eina_inlist_remove(obj->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
2010-03-21 22:33:46 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-12-14 16:33:57 -08:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_cleanup(Evas_Object *eo_obj)
|
2002-12-14 16:33:57 -08:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
evas_object_event_callback_all_del(eo_obj);
|
2002-12-14 16:33:57 -08:00
|
|
|
}
|
|
|
|
|
2010-03-28 22:03:25 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_all_del(Evas *eo_e)
|
2010-03-28 22:03:25 -07:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2013-04-11 12:08:24 -07:00
|
|
|
Eina_Inlist *itr;
|
2016-08-15 06:44:41 -07:00
|
|
|
Evas_Public_Data *e = efl_data_scope_get(eo_e, EVAS_CANVAS_CLASS);
|
2010-03-28 22:03:25 -07:00
|
|
|
|
2012-11-11 18:22:39 -08:00
|
|
|
if (!e) return;
|
2010-03-28 22:03:25 -07:00
|
|
|
if (!e->callbacks) return;
|
2013-04-11 12:08:24 -07:00
|
|
|
|
|
|
|
EINA_INLIST_FOREACH_SAFE(e->callbacks, itr, info)
|
|
|
|
{
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_e, _legacy_evas_callback_table(info->type), _eo_evas_cb, info);
|
2013-04-11 12:08:24 -07:00
|
|
|
|
|
|
|
e->callbacks =
|
|
|
|
eina_inlist_remove(e->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
|
|
|
}
|
2010-03-28 22:03:25 -07:00
|
|
|
}
|
|
|
|
|
2010-03-28 19:40:49 -07:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_cleanup(Evas *eo_e)
|
2010-03-28 19:40:49 -07:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
evas_event_callback_all_del(eo_e);
|
2010-03-28 19:40:49 -07:00
|
|
|
}
|
|
|
|
|
2010-01-31 20:26:55 -08:00
|
|
|
void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(eo_e, _legacy_evas_callback_table(type), event_info);
|
2010-01-31 20:26:55 -08:00
|
|
|
}
|
|
|
|
|
2019-10-14 06:29:23 -07:00
|
|
|
static void
|
|
|
|
_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info)
|
|
|
|
{
|
2019-02-25 10:59:49 -08:00
|
|
|
/* this is inverted: the base call is the legacy compat and this is the new event */
|
2019-10-14 06:29:23 -07:00
|
|
|
if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
|
2019-02-25 10:59:49 -08:00
|
|
|
efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
|
2019-09-18 01:08:58 -07:00
|
|
|
else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD))
|
|
|
|
efl_event_callback_call(eo_obj, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD_STATE_CHANGED, event_info);
|
2019-02-22 05:50:07 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-11-08 00:02:15 -08:00
|
|
|
void
|
2016-06-01 04:40:18 -07:00
|
|
|
evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj,
|
|
|
|
Evas_Callback_Type type, void *event_info, int event_id,
|
2016-08-25 00:03:45 -07:00
|
|
|
const Efl_Event_Description *efl_event_desc)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2002-11-23 20:06:08 -08:00
|
|
|
/* MEM OK */
|
2016-08-30 19:33:20 -07:00
|
|
|
const Evas_Button_Flags CLICK_MASK = EVAS_BUTTON_DOUBLE_CLICK | EVAS_BUTTON_TRIPLE_CLICK;
|
2006-08-25 13:47:32 -07:00
|
|
|
Evas_Button_Flags flags = EVAS_BUTTON_NONE;
|
2017-02-15 23:26:42 -08:00
|
|
|
Evas_Callback_Type prev_type;
|
2012-10-08 18:58:41 -07:00
|
|
|
Evas_Public_Data *e;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2012-11-11 18:22:39 -08:00
|
|
|
if (!obj) return;
|
2010-08-29 15:59:11 -07:00
|
|
|
if ((obj->delete_me) || (!obj->layer)) return;
|
2016-12-15 21:35:52 -08:00
|
|
|
if ((obj->last_event_id == event_id) &&
|
From: Hyoyoung Chang <hyoyoung.chang@samsung.com>
Subject: [E-devel] [patch] evas - add checking event type
Dear developers.
I found a bug about evas event handling.
In some situation, evas blocks some events by checking _evas_event_counter.
So I made a patch that is checking event type also event counter.
Reproduce steps:
1. make a window
2. show window before adding a elementary/genlist widget
--- codes ---
void _gl_mousedown_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
printf("_gl_mousedown_cb !! \n");
}
static Eina_Bool create_main_win(App *app)
{
app->win = elm_win_add(NULL, "genlist-win", ELM_WIN_BASIC);
evas_object_show(app->win); <-- position 1
Evas_Object *genlist = elm_genlist_add(app->win);
elm_win_resize_object_add(app->win, genlist);
evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_DOWN, _gl_mousedown_cb, NULL);
evas_object_show(genlist);
evas_object_resize(app->win, 320, 240);
//evas_object_show(app->win); <-- position 2
return EINA_TRUE;
}
--- codes ---
In common use case, apps don't show main window at position 1.
However to reproduce, it can be at position 1. Then, focus is at just on main window.
In that situation, if a user clicks a genlist, its event is dropped by evas.
Because in mouse down callback, it give focus to genlist.
Then two events is made. First is mouse down, second is focus handling.
In event callback, evas processes mouse down after focus handling.
But evas found that mouse event is retarded event than focus handling.
So it ignores it.
This patch is introduce event handling type checking to
evas_object_event_callback_call.
SVN revision: 61026
2011-07-04 18:33:59 -07:00
|
|
|
(obj->last_event_type == type)) return;
|
2016-12-15 21:35:52 -08:00
|
|
|
if (obj->last_event_id > event_id)
|
2012-02-13 03:25:23 -08:00
|
|
|
{
|
|
|
|
if ((obj->last_event_type == EVAS_CALLBACK_MOUSE_OUT) &&
|
|
|
|
((type >= EVAS_CALLBACK_MOUSE_DOWN) &&
|
|
|
|
(type <= EVAS_CALLBACK_MULTI_MOVE)))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2016-12-15 21:35:52 -08:00
|
|
|
obj->last_event_id = event_id;
|
From: Hyoyoung Chang <hyoyoung.chang@samsung.com>
Subject: [E-devel] [patch] evas - add checking event type
Dear developers.
I found a bug about evas event handling.
In some situation, evas blocks some events by checking _evas_event_counter.
So I made a patch that is checking event type also event counter.
Reproduce steps:
1. make a window
2. show window before adding a elementary/genlist widget
--- codes ---
void _gl_mousedown_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
{
printf("_gl_mousedown_cb !! \n");
}
static Eina_Bool create_main_win(App *app)
{
app->win = elm_win_add(NULL, "genlist-win", ELM_WIN_BASIC);
evas_object_show(app->win); <-- position 1
Evas_Object *genlist = elm_genlist_add(app->win);
elm_win_resize_object_add(app->win, genlist);
evas_object_event_callback_add(genlist, EVAS_CALLBACK_MOUSE_DOWN, _gl_mousedown_cb, NULL);
evas_object_show(genlist);
evas_object_resize(app->win, 320, 240);
//evas_object_show(app->win); <-- position 2
return EINA_TRUE;
}
--- codes ---
In common use case, apps don't show main window at position 1.
However to reproduce, it can be at position 1. Then, focus is at just on main window.
In that situation, if a user clicks a genlist, its event is dropped by evas.
Because in mouse down callback, it give focus to genlist.
Then two events is made. First is mouse down, second is focus handling.
In event callback, evas processes mouse down after focus handling.
But evas found that mouse event is retarded event than focus handling.
So it ignores it.
This patch is introduce event handling type checking to
evas_object_event_callback_call.
SVN revision: 61026
2011-07-04 18:33:59 -07:00
|
|
|
obj->last_event_type = type;
|
2010-08-29 15:59:11 -07:00
|
|
|
if (!(e = obj->layer->evas)) return;
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2007-04-29 21:22:42 -07:00
|
|
|
_evas_walk(e);
|
2016-02-01 15:46:50 -08:00
|
|
|
|
2017-09-19 01:17:39 -07:00
|
|
|
// gesture hook
|
|
|
|
if ( type == EVAS_CALLBACK_MOUSE_MOVE ||
|
|
|
|
type == EVAS_CALLBACK_MULTI_MOVE ||
|
|
|
|
type == EVAS_CALLBACK_MOUSE_DOWN ||
|
|
|
|
type == EVAS_CALLBACK_MULTI_DOWN ||
|
|
|
|
type == EVAS_CALLBACK_MOUSE_UP ||
|
|
|
|
type == EVAS_CALLBACK_MULTI_UP)
|
2018-02-21 11:20:09 -08:00
|
|
|
_efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
|
2017-09-19 01:17:39 -07:00
|
|
|
|
2019-10-14 06:29:37 -07:00
|
|
|
if (obj->is_smart)
|
|
|
|
_evas_object_smart_callback_call_internal(eo_obj, efl_event_desc);
|
2019-10-14 06:29:23 -07:00
|
|
|
|
2016-08-19 00:40:57 -07:00
|
|
|
if (!_evas_object_callback_has_by_type(obj, type))
|
2016-02-01 15:46:50 -08:00
|
|
|
goto nothing_here;
|
|
|
|
|
2016-08-17 04:29:39 -07:00
|
|
|
if ((type == EVAS_CALLBACK_MOUSE_DOWN) || (type == EVAS_CALLBACK_MOUSE_UP))
|
2003-12-11 03:20:40 -08:00
|
|
|
{
|
2016-08-25 03:20:10 -07:00
|
|
|
flags = efl_input_pointer_button_flags_get(event_info);
|
2016-08-30 19:33:20 -07:00
|
|
|
if (flags & CLICK_MASK)
|
2016-08-17 04:29:39 -07:00
|
|
|
{
|
|
|
|
if (obj->last_mouse_down_counter < (e->last_mouse_down_counter - 1))
|
2016-08-30 19:33:20 -07:00
|
|
|
efl_input_pointer_button_flags_set(event_info, flags & ~CLICK_MASK);
|
2016-08-17 04:29:39 -07:00
|
|
|
}
|
|
|
|
obj->last_mouse_down_counter = e->last_mouse_down_counter;
|
2016-05-18 12:27:58 -07:00
|
|
|
}
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2016-08-25 00:03:45 -07:00
|
|
|
if (!efl_event_desc)
|
2016-06-01 04:40:18 -07:00
|
|
|
{
|
2016-08-25 00:03:45 -07:00
|
|
|
/* This can happen for DEL and FREE which are defined only in here */
|
|
|
|
efl_event_desc = _legacy_evas_callback_table(type);
|
2016-08-10 02:59:36 -07:00
|
|
|
}
|
2016-06-01 04:40:18 -07:00
|
|
|
|
2017-02-15 23:26:42 -08:00
|
|
|
prev_type = e->current_event;
|
|
|
|
e->current_event = type;
|
|
|
|
|
2016-08-22 15:40:39 -07:00
|
|
|
efl_event_callback_legacy_call(eo_obj, efl_event_desc, event_info);
|
2019-02-25 10:59:49 -08:00
|
|
|
_evas_callback_legacy_smart_compatibility_do_it(eo_obj, efl_event_desc, event_info);
|
2016-08-25 00:03:45 -07:00
|
|
|
|
2016-08-30 19:33:20 -07:00
|
|
|
/* multi events with finger 0 - only for eo callbacks */
|
|
|
|
if (type == EVAS_CALLBACK_MOUSE_DOWN)
|
|
|
|
{
|
|
|
|
if (_evas_object_callback_has_by_type(obj, EVAS_CALLBACK_MULTI_DOWN))
|
2017-02-15 23:26:42 -08:00
|
|
|
{
|
|
|
|
e->current_event = EVAS_CALLBACK_MULTI_DOWN;
|
|
|
|
efl_event_callback_call(eo_obj, EFL_EVENT_FINGER_DOWN, event_info);
|
|
|
|
}
|
2016-08-30 19:33:20 -07:00
|
|
|
efl_input_pointer_button_flags_set(event_info, flags);
|
|
|
|
}
|
|
|
|
else if (type == EVAS_CALLBACK_MOUSE_UP)
|
|
|
|
{
|
|
|
|
if (_evas_object_callback_has_by_type(obj, EVAS_CALLBACK_MULTI_UP))
|
2017-02-15 23:26:42 -08:00
|
|
|
{
|
|
|
|
e->current_event = EVAS_CALLBACK_MULTI_UP;
|
|
|
|
efl_event_callback_call(eo_obj, EFL_EVENT_FINGER_UP, event_info);
|
|
|
|
}
|
2016-08-30 19:33:20 -07:00
|
|
|
efl_input_pointer_button_flags_set(event_info, flags);
|
|
|
|
}
|
|
|
|
else if (type == EVAS_CALLBACK_MOUSE_MOVE)
|
|
|
|
{
|
|
|
|
if (_evas_object_callback_has_by_type(obj, EVAS_CALLBACK_MULTI_MOVE))
|
2017-02-15 23:26:42 -08:00
|
|
|
{
|
|
|
|
e->current_event = EVAS_CALLBACK_MULTI_MOVE;
|
|
|
|
efl_event_callback_call(eo_obj, EFL_EVENT_FINGER_MOVE, event_info);
|
|
|
|
}
|
2016-08-30 19:33:20 -07:00
|
|
|
}
|
2009-09-03 22:13:19 -07:00
|
|
|
|
2017-02-15 23:26:42 -08:00
|
|
|
e->current_event = prev_type;
|
|
|
|
|
2016-08-19 00:40:57 -07:00
|
|
|
nothing_here:
|
2013-04-11 12:08:24 -07:00
|
|
|
if (!obj->no_propagate)
|
2007-04-29 21:22:42 -07:00
|
|
|
{
|
2017-07-23 02:53:46 -07:00
|
|
|
if ((obj->smart.parent || ((obj->events) && obj->events->parent)) &&
|
|
|
|
(type != EVAS_CALLBACK_FREE) &&
|
|
|
|
(type <= EVAS_CALLBACK_KEY_UP))
|
2011-12-14 21:56:19 -08:00
|
|
|
{
|
evas: add new event_grabber smart-ish object
adding an "event rect" is a common use case for rectangles, but I needed
a smarter event rect so I sent one off to school and it came back like this.
an event_grabber is a smart object which functions like a normal event rect
which has color(0,0,0,0), but with an important difference: it can have smart
members. event propagation works differently for an event_grabber:
normal:
event -> layer -> smart(obj1,obj2,obj3) ->(?) other objects
in this case, obj1,obj2,obj3 are all "inside" the smart object and their stacking
will always be considered as being inside the smart object. rendering is also
tied to the smart object in this case, as is clipping.
an event which reaches a smart object will be sent to the objects inside,
and then may continue through the smart object if there are no objects which
block repeating.
event_grabber:
event -> layer -> event_grabber -> obj1,obj2,obj3 -> STOP
in this case, obj1,obj2,obj3 are unmodified after being added to the event_grabber
and can be stacked, rendered, and clipped completely independently of the
event_grabber.
the event_grabber is considered an "event_parent" for this case. member objects
are not "inside" the event_grabber, and they are unable to receive events on
their own. instead, the event_grabber, which must be stacked above all its
members, receives events and propagates them top->down through its member objects.
if none of the member objects block the repeat of an event then the event will
still be blocked from further propagation past the event_grabber.
object lifetimes are independent of the event_grabber; deleting the event_grabber
has no effect on its members.
@feature
2017-06-09 17:16:08 -07:00
|
|
|
Evas_Object_Protected_Data *parent_obj;
|
|
|
|
Eo *parent;
|
|
|
|
|
2017-07-23 02:53:46 -07:00
|
|
|
parent = ((obj->events) && obj->events->parent) ?
|
|
|
|
obj->events->parent: obj->smart.parent;
|
evas: add new event_grabber smart-ish object
adding an "event rect" is a common use case for rectangles, but I needed
a smarter event rect so I sent one off to school and it came back like this.
an event_grabber is a smart object which functions like a normal event rect
which has color(0,0,0,0), but with an important difference: it can have smart
members. event propagation works differently for an event_grabber:
normal:
event -> layer -> smart(obj1,obj2,obj3) ->(?) other objects
in this case, obj1,obj2,obj3 are all "inside" the smart object and their stacking
will always be considered as being inside the smart object. rendering is also
tied to the smart object in this case, as is clipping.
an event which reaches a smart object will be sent to the objects inside,
and then may continue through the smart object if there are no objects which
block repeating.
event_grabber:
event -> layer -> event_grabber -> obj1,obj2,obj3 -> STOP
in this case, obj1,obj2,obj3 are unmodified after being added to the event_grabber
and can be stacked, rendered, and clipped completely independently of the
event_grabber.
the event_grabber is considered an "event_parent" for this case. member objects
are not "inside" the event_grabber, and they are unable to receive events on
their own. instead, the event_grabber, which must be stacked above all its
members, receives events and propagates them top->down through its member objects.
if none of the member objects block the repeat of an event then the event will
still be blocked from further propagation past the event_grabber.
object lifetimes are independent of the event_grabber; deleting the event_grabber
has no effect on its members.
@feature
2017-06-09 17:16:08 -07:00
|
|
|
parent_obj = efl_data_scope_get(parent, EFL_CANVAS_OBJECT_CLASS);
|
|
|
|
evas_object_event_callback_call(parent, parent_obj, type, event_info, event_id, efl_event_desc);
|
2011-12-14 21:56:19 -08:00
|
|
|
}
|
2007-04-29 21:22:42 -07:00
|
|
|
}
|
|
|
|
_evas_unwalk(e);
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
|
2011-08-17 04:55:29 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_priority_add(eo_obj, type,
|
2011-12-14 21:56:19 -08:00
|
|
|
EVAS_CALLBACK_PRIORITY_DEFAULT, func, data);
|
2011-08-17 04:55:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_priority_add(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Callback_Priority priority, Evas_Object_Event_Cb func, const void *data)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *cb_info;
|
|
|
|
const Efl_Event_Description *desc;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(eo_obj);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(efl_invalidated_get(eo_obj));
|
|
|
|
|
|
|
|
obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(obj);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2017-03-13 23:30:40 -07:00
|
|
|
cb_info = calloc(1, sizeof(*cb_info));
|
|
|
|
cb_info->func.object_cb = func;
|
2013-04-11 12:08:24 -07:00
|
|
|
cb_info->data = (void *)data;
|
|
|
|
cb_info->type = type;
|
2016-08-25 00:03:45 -07:00
|
|
|
cb_info->efl_event_type = _evas_event_efl_event_info_type(type);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2017-03-13 23:30:40 -07:00
|
|
|
desc = _legacy_evas_callback_table(type);
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_priority_add(eo_obj, desc, priority, _eo_evas_object_cb, cb_info);
|
2013-04-11 12:08:24 -07:00
|
|
|
|
|
|
|
obj->callbacks =
|
|
|
|
eina_inlist_append(obj->callbacks, EINA_INLIST_GET(cb_info));
|
2002-11-08 00:02:15 -08:00
|
|
|
}
|
|
|
|
|
2006-01-06 15:05:17 -08:00
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_del(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func)
|
2002-11-08 00:02:15 -08:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2018-09-12 12:16:39 -07:00
|
|
|
if (!eo_obj) return NULL;
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
|
|
|
|
|
|
|
|
obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2003-02-08 20:22:45 -08:00
|
|
|
if (!obj->callbacks) return NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2015-04-20 00:31:36 -07:00
|
|
|
EINA_INLIST_REVERSE_FOREACH(obj->callbacks, info)
|
2007-01-22 04:44:57 -08:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
if ((info->func.object_cb == func) && (info->type == type))
|
2011-12-14 21:56:19 -08:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
void *tmp = info->data;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_obj, _legacy_evas_callback_table(type), _eo_evas_object_cb, info);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
obj->callbacks =
|
|
|
|
eina_inlist_remove(obj->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
2011-12-14 21:56:19 -08:00
|
|
|
return tmp;
|
|
|
|
}
|
2007-01-22 04:44:57 -08:00
|
|
|
}
|
2002-11-08 00:02:15 -08:00
|
|
|
return NULL;
|
|
|
|
}
|
2008-06-03 13:33:40 -07:00
|
|
|
|
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_event_callback_del_full(Evas_Object *eo_obj, Evas_Callback_Type type, Evas_Object_Event_Cb func, const void *data)
|
2008-06-03 13:33:40 -07:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Object_Protected_Data *obj;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2008-06-03 13:33:40 -07:00
|
|
|
|
2018-09-12 12:16:39 -07:00
|
|
|
if (!eo_obj) return NULL;
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
|
|
|
|
|
|
|
|
obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
|
2008-06-03 13:33:40 -07:00
|
|
|
|
|
|
|
if (!obj->callbacks) return NULL;
|
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
EINA_INLIST_FOREACH(obj->callbacks, info)
|
2008-06-03 13:33:40 -07:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
if ((info->func.object_cb == func) && (info->type == type) && info->data == data)
|
2011-12-14 21:56:19 -08:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
void *tmp = info->data;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_obj, _legacy_evas_callback_table(type), _eo_evas_object_cb, info);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
obj->callbacks =
|
|
|
|
eina_inlist_remove(obj->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
2011-12-14 21:56:19 -08:00
|
|
|
return tmp;
|
|
|
|
}
|
2008-06-03 13:33:40 -07:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-11-01 14:50:36 -07:00
|
|
|
|
2010-01-31 20:26:55 -08:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_add(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
|
2011-08-17 04:55:29 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_priority_add(eo_e, type, EVAS_CALLBACK_PRIORITY_DEFAULT,
|
2011-12-14 21:56:19 -08:00
|
|
|
func, data);
|
2011-08-17 04:55:29 -07:00
|
|
|
}
|
|
|
|
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
void
|
|
|
|
_deferred_callbacks_process(Evas *eo_e, Evas_Public_Data *e)
|
|
|
|
{
|
|
|
|
Evas_Event_Cb_Wrapper_Info *cb_info;
|
|
|
|
const Efl_Event_Description *desc;
|
|
|
|
|
|
|
|
while (e->deferred_callbacks)
|
|
|
|
{
|
|
|
|
cb_info = EINA_INLIST_CONTAINER_GET(e->deferred_callbacks,
|
|
|
|
Evas_Event_Cb_Wrapper_Info);
|
|
|
|
e->deferred_callbacks = eina_inlist_remove(e->deferred_callbacks,
|
|
|
|
e->deferred_callbacks);
|
|
|
|
desc = _legacy_evas_callback_table(cb_info->type);
|
|
|
|
efl_event_callback_priority_add(eo_e, desc, cb_info->priority, _eo_evas_cb, cb_info);
|
|
|
|
e->callbacks = eina_inlist_append(e->callbacks, EINA_INLIST_GET(cb_info));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-17 04:55:29 -07:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_priority_add(Evas *eo_e, Evas_Callback_Type type, Evas_Callback_Priority priority, Evas_Event_Cb func, const void *data)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *cb_info;
|
|
|
|
const Efl_Event_Description *desc;
|
2010-01-31 20:26:55 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(eo_e);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(func);
|
|
|
|
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(efl_invalidated_get(eo_e));
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(e);
|
2010-01-31 20:26:55 -08:00
|
|
|
|
2017-03-13 23:30:40 -07:00
|
|
|
cb_info = calloc(1, sizeof(*cb_info));
|
|
|
|
cb_info->func.evas_cb = func;
|
2013-04-11 12:08:24 -07:00
|
|
|
cb_info->data = (void *)data;
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
cb_info->priority = priority;
|
2013-04-11 12:08:24 -07:00
|
|
|
cb_info->type = type;
|
2017-03-13 23:30:40 -07:00
|
|
|
cb_info->efl_event_type = _evas_event_efl_event_info_type(type);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
if ((e->rendering || e->inside_post_render) && type == EVAS_CALLBACK_RENDER_POST)
|
|
|
|
{
|
|
|
|
e->deferred_callbacks = eina_inlist_append(e->deferred_callbacks,
|
|
|
|
EINA_INLIST_GET(cb_info));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
desc = _legacy_evas_callback_table(type);
|
|
|
|
efl_event_callback_priority_add(eo_e, desc, priority, _eo_evas_cb, cb_info);
|
2013-04-11 12:08:24 -07:00
|
|
|
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
e->callbacks = eina_inlist_append(e->callbacks, EINA_INLIST_GET(cb_info));
|
|
|
|
}
|
2010-01-31 20:26:55 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_del(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2010-01-31 20:26:55 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_e, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
|
2010-01-31 20:26:55 -08:00
|
|
|
|
|
|
|
if (!e->callbacks) return NULL;
|
|
|
|
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
if (type == EVAS_CALLBACK_RENDER_POST)
|
|
|
|
EINA_INLIST_REVERSE_FOREACH(e->deferred_callbacks, info)
|
|
|
|
{
|
|
|
|
if (info->func.evas_cb == func)
|
|
|
|
{
|
|
|
|
void *tmp = info->data;
|
|
|
|
|
|
|
|
e->deferred_callbacks =
|
|
|
|
eina_inlist_remove(e->deferred_callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-16 23:03:26 -08:00
|
|
|
EINA_INLIST_REVERSE_FOREACH(e->callbacks, info)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
if ((info->func.evas_cb == func) && (info->type == type))
|
2011-12-14 21:56:19 -08:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
void *tmp = info->data;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_e, _legacy_evas_callback_table(type), _eo_evas_cb, info);
|
2013-04-11 12:08:24 -07:00
|
|
|
|
|
|
|
e->callbacks =
|
|
|
|
eina_inlist_remove(e->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
|
|
|
return tmp;
|
2011-12-14 21:56:19 -08:00
|
|
|
}
|
2010-01-31 20:26:55 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void *
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_event_callback_del_full(Evas *eo_e, Evas_Callback_Type type, Evas_Event_Cb func, const void *data)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2017-03-13 23:30:40 -07:00
|
|
|
Evas_Event_Cb_Wrapper_Info *info;
|
2010-01-31 20:26:55 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(eo_e, NULL);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL);
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(e, NULL);
|
2010-01-31 20:26:55 -08:00
|
|
|
|
|
|
|
if (!e->callbacks) return NULL;
|
|
|
|
|
evas: Defer render post callbacks added during async render
Summary:
To take screenshots, Enlightenment makes a new snapshot object, performs
a manual render, and uses the snapshot results.
Turns out if this happens while an async render is in progress, the
async render's completion triggers a render post callback on the snapshot
object even though it's never been involved in a render.
We need to defer new render post callbacks until any currently running
render completes, then add them during that render's post.
Fix T7156
Reviewers: devilhorns, zmike
Reviewed By: devilhorns, zmike
Subscribers: devilhorns, cedric, #committers, zmike
Tags: #efl
Maniphest Tasks: T7156
Differential Revision: https://phab.enlightenment.org/D6711
2018-07-31 14:02:12 -07:00
|
|
|
if (type == EVAS_CALLBACK_RENDER_POST)
|
|
|
|
EINA_INLIST_REVERSE_FOREACH(e->deferred_callbacks, info)
|
|
|
|
{
|
|
|
|
if ((info->func.evas_cb == func) && (info->data == data))
|
|
|
|
{
|
|
|
|
void *tmp = info->data;
|
|
|
|
|
|
|
|
e->deferred_callbacks =
|
|
|
|
eina_inlist_remove(e->deferred_callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
EINA_INLIST_FOREACH(e->callbacks, info)
|
2010-01-31 20:26:55 -08:00
|
|
|
{
|
2017-03-13 23:30:40 -07:00
|
|
|
if ((info->func.evas_cb == func) && (info->type == type) && (info->data == data))
|
2011-12-14 21:56:19 -08:00
|
|
|
{
|
2013-04-11 12:08:24 -07:00
|
|
|
void *tmp = info->data;
|
2016-08-10 07:23:04 -07:00
|
|
|
efl_event_callback_del(eo_e, _legacy_evas_callback_table(type), _eo_evas_cb, info);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2013-04-11 12:08:24 -07:00
|
|
|
e->callbacks =
|
|
|
|
eina_inlist_remove(e->callbacks, EINA_INLIST_GET(info));
|
|
|
|
free(info);
|
2011-12-14 21:56:19 -08:00
|
|
|
return tmp;
|
|
|
|
}
|
2010-01-31 20:26:55 -08:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-04 08:58:10 -07:00
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_post_event_callback_push(Evas *eo_e, Evas_Object_Event_Post_Cb func, const void *data)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2010-05-04 08:58:10 -07:00
|
|
|
Evas_Post_Callback *pc;
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(eo_e);
|
|
|
|
EINA_SAFETY_ON_TRUE_RETURN(efl_invalidated_get(eo_e));
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(e);
|
|
|
|
if (e->delete_me) return;
|
2017-02-15 23:26:42 -08:00
|
|
|
if (e->current_event == EVAS_CALLBACK_LAST)
|
|
|
|
{
|
|
|
|
ERR("%s() can only be called from an input event callback!", __FUNCTION__);
|
|
|
|
return;
|
|
|
|
}
|
2010-11-26 02:01:18 -08:00
|
|
|
EVAS_MEMPOOL_INIT(_mp_pc, "evas_post_callback", Evas_Post_Callback, 64, );
|
|
|
|
pc = EVAS_MEMPOOL_ALLOC(_mp_pc, Evas_Post_Callback);
|
2010-05-04 08:58:10 -07:00
|
|
|
if (!pc) return;
|
2010-11-26 02:01:18 -08:00
|
|
|
EVAS_MEMPOOL_PREP(_mp_pc, pc, Evas_Post_Callback);
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2010-05-04 08:58:10 -07:00
|
|
|
pc->func = func;
|
|
|
|
pc->data = data;
|
2017-02-16 02:34:08 -08:00
|
|
|
pc->type = e->current_event;
|
|
|
|
pc->event_id = _evas_event_counter;
|
2010-05-04 08:58:10 -07:00
|
|
|
e->post_events = eina_list_prepend(e->post_events, pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_post_event_callback_remove(Evas *eo_e, Evas_Object_Event_Post_Cb func)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2010-05-04 08:58:10 -07:00
|
|
|
Evas_Post_Callback *pc;
|
|
|
|
Eina_List *l;
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(eo_e);
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(e);
|
2010-05-04 08:58:10 -07:00
|
|
|
EINA_LIST_FOREACH(e->post_events, l, pc)
|
|
|
|
{
|
|
|
|
if (pc->func == func)
|
|
|
|
{
|
|
|
|
pc->delete_me = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_post_event_callback_remove_full(Evas *eo_e, Evas_Object_Event_Post_Cb func, const void *data)
|
2010-05-04 08:58:10 -07:00
|
|
|
{
|
2018-07-03 18:51:01 -07:00
|
|
|
Evas_Public_Data *e;
|
2010-05-04 08:58:10 -07:00
|
|
|
Evas_Post_Callback *pc;
|
|
|
|
Eina_List *l;
|
2011-12-14 21:56:19 -08:00
|
|
|
|
2018-07-03 18:51:01 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(eo_e);
|
|
|
|
|
|
|
|
e = efl_data_scope_safe_get(eo_e, EVAS_CANVAS_CLASS);
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(e);
|
2010-05-04 08:58:10 -07:00
|
|
|
EINA_LIST_FOREACH(e->post_events, l, pc)
|
|
|
|
{
|
|
|
|
if ((pc->func == func) && (pc->data == data))
|
|
|
|
{
|
|
|
|
pc->delete_me = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-08-19 00:20:39 -07:00
|
|
|
|
|
|
|
static void
|
2016-08-30 05:34:10 -07:00
|
|
|
_animator_repeater(void *data, const Efl_Event *event)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
|
|
|
Evas_Object_Protected_Data *obj = data;
|
|
|
|
|
2019-02-21 12:50:35 -08:00
|
|
|
efl_event_callback_legacy_call(obj->object, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, event->info);
|
2016-08-19 00:20:39 -07:00
|
|
|
DBG("Emitting animator tick on %p.", obj->object);
|
|
|
|
}
|
|
|
|
|
2019-09-04 12:18:18 -07:00
|
|
|
void
|
|
|
|
evas_object_callbacks_finalized(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
|
|
|
|
{
|
2019-09-25 03:53:53 -07:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(obj);
|
|
|
|
|
2019-09-04 12:18:18 -07:00
|
|
|
if (obj->animator_ref > 0)
|
|
|
|
{
|
|
|
|
if (obj->layer && obj->layer->evas)
|
|
|
|
{
|
|
|
|
efl_event_callback_add(obj->layer->evas->evas, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
|
|
|
|
DBG("Registering an animator tick on canvas %p for object %p.",
|
|
|
|
obj->layer->evas->evas, obj->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_object_callbacks_event_catcher_add(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
2016-08-19 00:40:57 -07:00
|
|
|
Evas_Callback_Type type = EVAS_CALLBACK_LAST;
|
2019-01-24 09:34:12 -08:00
|
|
|
void *gd = NULL;
|
2016-08-19 00:20:39 -07:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; array[i].desc != NULL; i++)
|
|
|
|
{
|
2019-09-04 12:18:18 -07:00
|
|
|
if (obj->layer && obj->layer->evas && obj->layer->evas->gesture_manager)
|
2019-01-24 09:34:12 -08:00
|
|
|
{
|
|
|
|
if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
|
|
|
|
|
|
|
|
_efl_canvas_gesture_manager_callback_add_hook(gd, obj->object, array[i].desc);
|
|
|
|
}
|
2017-09-19 01:17:39 -07:00
|
|
|
|
2019-02-21 12:50:35 -08:00
|
|
|
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
|
|
|
if (obj->animator_ref++ > 0) break;
|
|
|
|
|
2019-09-04 12:18:18 -07:00
|
|
|
if (efl_finalized_get(eo_obj))
|
|
|
|
{
|
|
|
|
efl_event_callback_add(obj->layer->evas->evas, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
|
|
|
|
DBG("Registering an animator tick on canvas %p for object %p.",
|
|
|
|
obj->layer->evas->evas, obj->object);
|
|
|
|
}
|
2016-08-19 00:20:39 -07:00
|
|
|
}
|
2016-08-19 00:40:57 -07:00
|
|
|
else if ((type = _legacy_evas_callback_type(array[i].desc)) != EVAS_CALLBACK_LAST)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
2017-07-28 04:08:21 -07:00
|
|
|
obj->callback_mask |= (((uint64_t)1) << type);
|
2016-08-19 00:20:39 -07:00
|
|
|
}
|
2019-04-03 06:26:50 -07:00
|
|
|
else if (array[i].desc == EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED)
|
|
|
|
{
|
|
|
|
obj->callback_mask |= (((uint64_t)1) << EVAS_CALLBACK_SHOW);
|
|
|
|
obj->callback_mask |= (((uint64_t)1) << EVAS_CALLBACK_HIDE);
|
|
|
|
}
|
2016-08-19 00:20:39 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-04 12:18:18 -07:00
|
|
|
void
|
|
|
|
evas_object_callbacks_event_catcher_del(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, const Efl_Callback_Array_Item *array)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
2019-01-24 09:34:12 -08:00
|
|
|
void *gd = NULL;
|
2016-08-19 00:20:39 -07:00
|
|
|
int i;
|
|
|
|
|
2018-04-10 14:02:48 -07:00
|
|
|
if (!obj->layer ||
|
|
|
|
!obj->layer->evas)
|
|
|
|
return ;
|
|
|
|
|
2016-08-19 00:20:39 -07:00
|
|
|
for (i = 0; array[i].desc != NULL; i++)
|
|
|
|
{
|
2019-05-14 00:37:20 -07:00
|
|
|
if (obj->layer->evas->gesture_manager)
|
2019-01-24 09:34:12 -08:00
|
|
|
{
|
|
|
|
if (!gd) gd = _efl_canvas_gesture_manager_private_data_get(obj->layer->evas->gesture_manager);
|
|
|
|
|
|
|
|
_efl_canvas_gesture_manager_callback_del_hook(gd, obj->object, array[i].desc);
|
|
|
|
}
|
2017-09-19 01:17:39 -07:00
|
|
|
|
2019-02-21 12:50:35 -08:00
|
|
|
if (array[i].desc == EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK)
|
2016-08-19 00:20:39 -07:00
|
|
|
{
|
|
|
|
if ((--obj->animator_ref) > 0) break;
|
|
|
|
|
2019-02-21 12:50:35 -08:00
|
|
|
efl_event_callback_del(obj->layer->evas->evas, EFL_CANVAS_OBJECT_EVENT_ANIMATOR_TICK, _animator_repeater, obj);
|
2017-06-21 19:47:42 -07:00
|
|
|
DBG("Unregistering an animator tick on canvas %p for object %p.",
|
2016-08-19 00:20:39 -07:00
|
|
|
obj->layer->evas->evas, obj->object);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|