efl/image: merge preload and unload events into preload_state,changed

Summary:
this reduces the necessary event subscriptions for cases where someone
is likely to want to listen on these events

ref T7875
Depends on D9996

Subscribers: cedric, #reviewers, #committers

Tags: #efl_api

Maniphest Tasks: T7875

Differential Revision: https://phab.enlightenment.org/D9997
This commit is contained in:
Mike Blumenkrantz 2019-09-18 10:08:58 +02:00 committed by Xavi Artigas
parent 28f589d795
commit fa03eb44f7
4 changed files with 16 additions and 5 deletions

View File

@ -281,9 +281,8 @@ interface @beta Efl.Gfx.Image
}
}
events {
image,preload: void; [[Image data has been preloaded.]]
image,preload_state,changed: bool; [[If $true, image data has been preloaded and can be displayed.
If $false, the image data has been unloaded and can no longer be displayed.]]
image,resized: Eina.Size2D; [[Image was resized (its pixel data). The event data is the image's new size.]]
image,unload: void; [[Image data has been unloaded (by some mechanism in
EFL that threw out the original image data).]]
}
}

View File

@ -359,6 +359,8 @@ _evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_E
/* this is inverted: the base call is the legacy compat and this is the new event */
else if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
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);
}

View File

@ -7,6 +7,10 @@ EWAPI const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_SHOW =
EFL_EVENT_DESCRIPTION("show");
EWAPI const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_HIDE =
EFL_EVENT_DESCRIPTION("hide");
EWAPI const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_IMAGE_PRELOAD =
EFL_EVENT_DESCRIPTION("preload");
EWAPI const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_IMAGE_UNLOAD =
EFL_EVENT_DESCRIPTION("unload");
/* END: events to maintain compatibility with legacy */
/* local calls */
@ -94,8 +98,9 @@ evas_object_inform_call_image_preloaded(Evas_Object *eo_obj)
and mimic as it finished preloading done. */
(preload & EVAS_IMAGE_PRELOAD_CANCEL))
{
Eina_Bool val = EINA_TRUE;
event_id = _evas_object_event_new();
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_IMAGE_PRELOADED, NULL, event_id, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD);
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_IMAGE_PRELOADED, &val, event_id, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD);
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
}
}
@ -105,8 +110,9 @@ evas_object_inform_call_image_unloaded(Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
int event_id = _evas_object_event_new();
Eina_Bool val = EINA_FALSE;
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_IMAGE_UNLOADED, NULL, event_id, EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD);
evas_object_event_callback_call(eo_obj, obj, EVAS_CALLBACK_IMAGE_UNLOADED, &val, event_id, EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD);
_evas_post_event_callback_call(obj->layer->evas->evas, obj->layer->evas, event_id);
}

View File

@ -1966,6 +1966,10 @@ EWAPI extern const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_SHOW;
#define EFL_GFX_ENTITY_EVENT_SHOW (&(_EFL_GFX_ENTITY_EVENT_SHOW))
EWAPI extern const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_HIDE;
#define EFL_GFX_ENTITY_EVENT_HIDE (&(_EFL_GFX_ENTITY_EVENT_HIDE))
EWAPI extern const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_IMAGE_PRELOAD;
#define EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD (&(_EFL_GFX_ENTITY_EVENT_IMAGE_PRELOAD))
EWAPI extern const Efl_Event_Description _EFL_GFX_ENTITY_EVENT_IMAGE_UNLOAD;
#define EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD (&(_EFL_GFX_ENTITY_EVENT_IMAGE_UNLOAD))
/* END: events to maintain compatibility with legacy */
/****************************************************************************/