This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch reproducible-widget-previews
in repository efl.

View the commit online.

commit 026f385191dab61f63cfed9533eeb78269e56ed4
Author: Carsten Haitzler <[email protected]>
AuthorDate: Sun Apr 19 11:03:29 2026 +0100

    efl - interfaces - file - file io set/get and then use it in evas
    
    this adds a file io property to enable or disable if io will be done
    on file set for any optimizing etc. - necessary if you don't want a
    file set to go to the filesystem for a check like if you want to
    evas_object_image_load_head_skip_set() whose entire point is to move
    all the io into threads so the mainloop never goes to disk for this.
    use this interface here as this is the whole purpose of it.
    
    @feat
---
 src/lib/efl/interfaces/efl_file.c        | 23 ++++++++++++++++++++---
 src/lib/efl/interfaces/efl_file.eo       | 19 +++++++++++++++++++
 src/lib/evas/canvas/efl_canvas_image.c   |  3 ++-
 src/lib/evas/canvas/evas_image_private.h |  2 +-
 4 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/lib/efl/interfaces/efl_file.c b/src/lib/efl/interfaces/efl_file.c
index 206a4eb789..5724eeb906 100644
--- a/src/lib/efl/interfaces/efl_file.c
+++ b/src/lib/efl/interfaces/efl_file.c
@@ -14,6 +14,7 @@ struct _Efl_File_Data
    Eina_Bool file_opened : 1; /* if `file` was opened implicitly during load */
    Eina_Bool setting : 1; /* set when this file is internally calling methods to avoid infinite recursion */
    Eina_Bool loaded : 1; /* whether the currently set file properties have been loaded */
+   Eina_Bool no_io : 1; /* i/o will be avoided on file_set */
 };
 
 EOLIAN static void
@@ -100,13 +101,17 @@ _efl_file_file_set(Eo *obj, Efl_File_Data *pd, const char *file)
 
    same = !eina_stringshare_replace(&pd->vpath, tmp ?: file);
    free(tmp);
-   if (file)
+   if ((!pd->no_io) && (file))
      {
         err = stat(pd->vpath, &st);
         if (same && (!err)) same = st.st_mtime == pd->mtime;
      }
-   if (same) return err;
-   pd->mtime = file && (!err) ? st.st_mtime : 0;
+   if (!pd->no_io)
+     {
+        if (same) return err;
+        pd->mtime = file && (!err) ? st.st_mtime : 0;
+     }
+   else pd->mtime = 0;
    pd->loaded = EINA_FALSE;
    if (pd->setting)
      err = 0; /* this is from mmap_set, which may provide a virtual file */
@@ -125,6 +130,18 @@ _efl_file_file_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
    return pd->vpath;
 }
 
+EOLIAN static void
+_efl_file_file_io_set(Eo *obj EINA_UNUSED, Efl_File_Data *pd, Eina_Bool enabled)
+{
+  pd->no_io = !!!enabled;
+}
+
+EOLIAN static Eina_Bool
+_efl_file_file_io_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
+{
+  return !pd->no_io;
+}
+
 EOLIAN static void
 _efl_file_key_set(Eo *obj EINA_UNUSED, Efl_File_Data *pd, const char *key)
 {
diff --git a/src/lib/efl/interfaces/efl_file.eo b/src/lib/efl/interfaces/efl_file.eo
index 93343dca3a..5fcf455144 100644
--- a/src/lib/efl/interfaces/efl_file.eo
+++ b/src/lib/efl/interfaces/efl_file.eo
@@ -39,6 +39,25 @@ mixin Efl.File requires Efl.Object {
             file: string; [[The file path.]]
          }
       }
+      @property file_io {
+         [[If any I/O will take place when setting file
+
+           If file is set, there may be disk/file I/O done on the actual
+           resulting file path to see if it exists or is valid etc. to
+           avoid repeated settings of file to the same file causing
+           repeated loads of that file unless it keeps changing.
+
+           This will ddisable that I/O and thus any optimizations
+           avoiding re-loads etc.
+         ]]
+         set {
+         }
+         get {
+         }
+         values {
+            enabled: bool; [[If I/O is enabled. True by default.]]
+         }
+      }
       @property key {
          [[The key which corresponds to the target data within a file.
 
diff --git a/src/lib/evas/canvas/efl_canvas_image.c b/src/lib/evas/canvas/efl_canvas_image.c
index f4a8cb1f22..374945af49 100644
--- a/src/lib/evas/canvas/efl_canvas_image.c
+++ b/src/lib/evas/canvas/efl_canvas_image.c
@@ -335,10 +335,11 @@ _efl_canvas_image_efl_gfx_image_load_controller_load_scale_down_get(const Eo *eo
 }
 
 void
-_evas_image_load_head_skip_set(const Eo *eo_obj, Eina_Bool skip)
+_evas_image_load_head_skip_set(Eo *eo_obj, Eina_Bool skip)
 {
    Evas_Image_Data *o = efl_data_scope_get(eo_obj, EFL_CANVAS_IMAGE_INTERNAL_CLASS);
    o->skip_head = skip;
+   efl_file_io_set(eo_obj, !skip);
 }
 
 EOLIAN static void
diff --git a/src/lib/evas/canvas/evas_image_private.h b/src/lib/evas/canvas/evas_image_private.h
index f8888d71ad..e094478def 100644
--- a/src/lib/evas/canvas/evas_image_private.h
+++ b/src/lib/evas/canvas/evas_image_private.h
@@ -185,7 +185,7 @@ void _evas_image_load_scale_down_set(Eo *eo_obj, int scale_down);
 int _evas_image_load_scale_down_get(const Eo *eo_obj);
 void _evas_image_load_region_set(Eo *eo_obj, int x, int y, int w, int h);
 void _evas_image_load_region_get(const Eo *eo_obj, int *x, int *y, int *w, int *h);
-void _evas_image_load_head_skip_set(const Eo *eo_obj, Eina_Bool skip);
+void _evas_image_load_head_skip_set(Eo *eo_obj, Eina_Bool skip);
 Eina_Bool _evas_image_load_head_skip_get(const Eo *eo_obj);
 void _evas_image_load_orientation_set(Eo *eo_obj, Eina_Bool enable);
 Eina_Bool _evas_image_load_orientation_get(const Eo *eo_obj);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to