eo: some event should not be frozen.

This commit is contained in:
Cedric Bail 2013-05-20 18:16:39 +09:00
parent 0532a992d9
commit 1db92f9ac0
2 changed files with 28 additions and 4 deletions

View File

@ -271,6 +271,8 @@ struct _Eo_Event_Description
{
const char *name; /**< name of the event. */
const char *doc; /**< Explanation about the event. */
Eina_Bool unfreezable; /**< Eina_True if the event cannot be frozen */
};
/**
@ -286,7 +288,20 @@ typedef struct _Eo_Event_Description Eo_Event_Description;
* @param doc Additional doc for the event.
* @see Eo_Event_Description
*/
#define EO_EVENT_DESCRIPTION(name, doc) { name, doc }
#define EO_EVENT_DESCRIPTION(name, doc) { name, doc, EINA_FALSE }
/**
* @def EO_HOT_EVENT_DESCRIPTION(name, doc)
* An helper macro to help populating #Eo_Event_Description and make
* the event impossible to freeze.
* @param name The name of the event.
* @param doc Additional doc for the event.
* @see Eo_Event_Description
* @see EO_EVENT_DESCRIPTION
*/
#define EO_HOT_EVENT_DESCRIPTION(name, doc) { name, doc, EINA_TRUE }
/**
* @}

View File

@ -247,13 +247,16 @@ _wref_destruct(Private_Data *pd)
struct _Eo_Callback_Description
{
Eo_Callback_Description *next;
union
{
Eo_Callback_Array_Item item;
const Eo_Callback_Array_Item *item_array;
} items;
void *func_data;
Eo_Callback_Priority priority;
Eina_Bool delete_me : 1;
Eina_Bool func_array : 1;
};
@ -452,9 +455,6 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
if (ret) *ret = EINA_TRUE;
if (event_freeze_count || pd->event_freeze_count)
return;
/* FIXME: Change eo_ref to _eo_ref and unref. */
eo_ref(obj);
pd->walking_list++;
@ -471,6 +471,10 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
{
if (it->desc != desc)
continue;
if (!it->desc->unfreezable &&
(event_freeze_count || pd->event_freeze_count))
continue;
/* Abort callback calling if the func says so. */
if (!it->func((void *) cb->func_data, obj, desc,
(void *) event_info))
@ -482,6 +486,11 @@ _ev_cb_call(Eo *obj, void *class_data, va_list *list)
}
else
{
if ((!cb->items.item.desc
|| !cb->items.item.desc->unfreezable) &&
(event_freeze_count || pd->event_freeze_count))
continue;
if (cb->items.item.desc == desc)
{
/* Abort callback calling if the func says so. */