xartigas pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fa03eb44f73d516566e758103112712fbe6861e8

commit fa03eb44f73d516566e758103112712fbe6861e8
Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Sep 18 10:08:58 2019 +0200

    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
---
 src/lib/efl/interfaces/efl_gfx_image.eo  |  5 ++---
 src/lib/evas/canvas/evas_callbacks.c     |  2 ++
 src/lib/evas/canvas/evas_object_inform.c | 10 ++++++++--
 src/lib/evas/include/evas_private.h      |  4 ++++
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_gfx_image.eo 
b/src/lib/efl/interfaces/efl_gfx_image.eo
index 48a75404a5..3f9ee77a98 100644
--- a/src/lib/efl/interfaces/efl_gfx_image.eo
+++ b/src/lib/efl/interfaces/efl_gfx_image.eo
@@ -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).]]
    }
 }
diff --git a/src/lib/evas/canvas/evas_callbacks.c 
b/src/lib/evas/canvas/evas_callbacks.c
index fc2fc1a7d3..cadd0212f0 100644
--- a/src/lib/evas/canvas/evas_callbacks.c
+++ b/src/lib/evas/canvas/evas_callbacks.c
@@ -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);
 }
 
 
diff --git a/src/lib/evas/canvas/evas_object_inform.c 
b/src/lib/evas/canvas/evas_object_inform.c
index ef823fecc2..ef5ee4051f 100644
--- a/src/lib/evas/canvas/evas_object_inform.c
+++ b/src/lib/evas/canvas/evas_object_inform.c
@@ -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);
 }
 
diff --git a/src/lib/evas/include/evas_private.h 
b/src/lib/evas/include/evas_private.h
index 2050a487e3..c80053c7f9 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -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 */
 
 /****************************************************************************/

-- 


Reply via email to