raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=072fd2d741db4c63ff1b42298fb4b38665fb2e30

commit 072fd2d741db4c63ff1b42298fb4b38665fb2e30
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Jul 14 13:31:29 2020 +0100

    e system - isolate stdio of commands we run so they dont pollute
---
 src/bin/e_comp.c                  | 15 +++++----------
 src/bin/e_comp_canvas.c           | 15 ++++++++++++++-
 src/bin/system/e_system.h         |  2 ++
 src/bin/system/e_system_main.c    | 13 +++++++++++++
 src/bin/system/e_system_power.c   |  8 ++++----
 src/bin/system/e_system_storage.c |  6 +++---
 6 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index 523c5f24f..b3111f3bf 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -379,11 +379,11 @@ _e_comp_cb_update(void)
      ecore_animator_freeze(e_comp->render_animator);
    DBG("UPDATE ALL");
    if (e_comp->nocomp) goto nocomp;
-   if (conf->grab && (!e_comp->grabbed))
-     {
-        if (e_comp->grab_cb) e_comp->grab_cb();
-        e_comp->grabbed = 1;
-     }
+//   if (conf->grab && (!e_comp->grabbed))
+//     {
+//        if (e_comp->grab_cb) e_comp->grab_cb();
+//        e_comp->grabbed = 1;
+//     }
    e_comp->updating = 1;
    l = e_comp->updates;
    e_comp->updates = NULL;
@@ -460,11 +460,6 @@ _e_comp_cb_update(void)
         //        if (!e_comp->nocomp) ecore_evas_manual_render(e_comp->ee);
      }
 
-   if (conf->grab && e_comp->grabbed)
-     {
-        if (e_comp->grab_cb) e_comp->grab_cb();
-        e_comp->grabbed = 0;
-     }
    if (e_comp->updates && (!e_comp->update_job))
      ecore_animator_thaw(e_comp->render_animator);
    /*
diff --git a/src/bin/e_comp_canvas.c b/src/bin/e_comp_canvas.c
index e011e858c..5003be5c8 100644
--- a/src/bin/e_comp_canvas.c
+++ b/src/bin/e_comp_canvas.c
@@ -42,6 +42,7 @@ _e_comp_canvas_cb_first_frame(void *data EINA_UNUSED, Evas 
*e, void *event_info
 static void
 _e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void 
*event_info EINA_UNUSED)
 {
+   E_Comp_Config *conf = e_comp_config_get();
    E_Client *ec;
    //Evas_Event_Render_Post *ev = event_info;
    //Eina_List *l;
@@ -65,6 +66,11 @@ _e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e 
EINA_UNUSED, void *ev
         UNREFD(ec, 111);
         e_object_unref(E_OBJECT(ec));
      }
+   if (conf->grab && e_comp->grabbed)
+     {
+        if (e_comp->grab_cb) e_comp->grab_cb();
+        e_comp->grabbed = 0;
+     }
 }
 
 ///////////////////////////////////
@@ -354,9 +360,16 @@ _e_comp_canvas_prerender(void *data EINA_UNUSED, Evas *e 
EINA_UNUSED, void *even
 {
    E_Comp_Cb cb;
    Eina_List *l;
+   E_Comp_Config *conf = e_comp_config_get();
 
    e_comp->rendering = EINA_TRUE;
 
+   if (conf->grab && (!e_comp->grabbed))
+     {
+        if (e_comp->grab_cb) e_comp->grab_cb();
+        e_comp->grabbed = 1;
+     }
+
    EINA_LIST_FOREACH(e_comp->pre_render_cbs, l, cb)
      cb();
 }
@@ -404,7 +417,7 @@ e_comp_canvas_init(int w, int h)
    //   ecore_evas_manual_render_set(e_comp->ee, conf->lock_fps);
    ecore_evas_show(e_comp->ee);
 
-   evas_event_callback_add(e_comp->evas, EVAS_CALLBACK_RENDER_POST, 
_e_comp_canvas_render_post, NULL);
+   evas_event_callback_add(e_comp->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, 
_e_comp_canvas_render_post, NULL);
 
    e_comp->ee_win = ecore_evas_window_get(e_comp->ee);
 
diff --git a/src/bin/system/e_system.h b/src/bin/system/e_system.h
index f2255b803..8ecef6d3d 100644
--- a/src/bin/system/e_system.h
+++ b/src/bin/system/e_system.h
@@ -122,5 +122,7 @@ void e_system_cpufreq_shutdown(void);
 void e_system_ddc_init(void);
 void e_system_ddc_shutdown(void);
 
+extern Ecore_Exe *e_system_run(const char *exe);
+
 #endif
 
diff --git a/src/bin/system/e_system_main.c b/src/bin/system/e_system_main.c
index d18a80f39..23a5f6f77 100644
--- a/src/bin/system/e_system_main.c
+++ b/src/bin/system/e_system_main.c
@@ -203,3 +203,16 @@ main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
    eina_shutdown();
    return 0;
 }
+
+Ecore_Exe *
+e_system_run(const char *cmd)
+{
+   Ecore_Exe_Flags flags = ECORE_EXE_NONE;
+#if (ECORE_VERSION_MAJOR >= 1) && (ECORE_VERSION_MINOR >= 21)
+   flags |= ECORE_EXE_ISOLATE_IO;
+#else
+   flags |= 1024; // isolate_io is bit 10 .... it will be ignored if
+   // efl doesn't do it, so harmless
+#endif
+   return ecore_exe_pipe_run(cmd, flags, NULL);
+}
diff --git a/src/bin/system/e_system_power.c b/src/bin/system/e_system_power.c
index 6643a3133..9b44bc4db 100644
--- a/src/bin/system/e_system_power.c
+++ b/src/bin/system/e_system_power.c
@@ -8,25 +8,25 @@ char *_cmd_hibernate = NULL;
 static void
 _cb_power_halt(void *data EINA_UNUSED, const char *params EINA_UNUSED)
 {
-   if (_cmd_halt) ecore_exe_run(_cmd_halt, NULL);
+   if (_cmd_halt) e_system_run(_cmd_halt);
 }
 
 static void
 _cb_power_reboot(void *data EINA_UNUSED, const char *params EINA_UNUSED)
 {
-   if (_cmd_reboot) ecore_exe_run(_cmd_reboot, NULL);
+   if (_cmd_reboot) e_system_run(_cmd_reboot);
 }
 
 static void
 _cb_power_suspend(void *data EINA_UNUSED, const char *params EINA_UNUSED)
 {
-   if (_cmd_suspend) ecore_exe_run(_cmd_suspend, NULL);
+   if (_cmd_suspend) e_system_run(_cmd_suspend);
 }
 
 static void
 _cb_power_hibernate(void *data EINA_UNUSED, const char *params EINA_UNUSED)
 {
-   if (_cmd_hibernate) ecore_exe_run(_cmd_hibernate, NULL);
+   if (_cmd_hibernate) e_system_run(_cmd_hibernate);
 }
 
 static void
diff --git a/src/bin/system/e_system_storage.c 
b/src/bin/system/e_system_storage.c
index c696f0e8c..ddbfb22cb 100644
--- a/src/bin/system/e_system_storage.c
+++ b/src/bin/system/e_system_storage.c
@@ -328,19 +328,19 @@ _store_action_do(Action *a)
      {
         if (a->cmd2)
           {
-             a->exe = ecore_exe_run(a->cmd2, NULL);
+             a->exe = e_system_run(a->cmd2);
              free(a->cmd2);
              a->cmd2 = NULL;
           }
         else if (a->cmd1)
           {
-             a->exe = ecore_exe_run(a->cmd1, NULL);
+             a->exe = e_system_run(a->cmd1);
              free(a->cmd1);
              a->cmd1 = NULL;
           }
         else
           {
-             a->exe = ecore_exe_run(a->cmd, NULL);
+             a->exe = e_system_run(a->cmd);
              free(a->cmd);
              a->cmd = NULL;
           }

-- 


Reply via email to