e system - isolate stdio of commands we run so they dont pollute

This commit is contained in:
Carsten Haitzler 2020-07-14 13:31:29 +01:00
parent e278fb3cda
commit 072fd2d741
6 changed files with 41 additions and 18 deletions

View File

@ -379,11 +379,11 @@ _e_comp_cb_update(void)
ecore_animator_freeze(e_comp->render_animator); ecore_animator_freeze(e_comp->render_animator);
DBG("UPDATE ALL"); DBG("UPDATE ALL");
if (e_comp->nocomp) goto nocomp; if (e_comp->nocomp) goto nocomp;
if (conf->grab && (!e_comp->grabbed)) // if (conf->grab && (!e_comp->grabbed))
{ // {
if (e_comp->grab_cb) e_comp->grab_cb(); // if (e_comp->grab_cb) e_comp->grab_cb();
e_comp->grabbed = 1; // e_comp->grabbed = 1;
} // }
e_comp->updating = 1; e_comp->updating = 1;
l = e_comp->updates; l = e_comp->updates;
e_comp->updates = NULL; 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 (!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)) if (e_comp->updates && (!e_comp->update_job))
ecore_animator_thaw(e_comp->render_animator); ecore_animator_thaw(e_comp->render_animator);
/* /*

View File

@ -42,6 +42,7 @@ _e_comp_canvas_cb_first_frame(void *data EINA_UNUSED, Evas *e, void *event_info
static void static void
_e_comp_canvas_render_post(void *data EINA_UNUSED, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED) _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; E_Client *ec;
//Evas_Event_Render_Post *ev = event_info; //Evas_Event_Render_Post *ev = event_info;
//Eina_List *l; //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); UNREFD(ec, 111);
e_object_unref(E_OBJECT(ec)); 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; E_Comp_Cb cb;
Eina_List *l; Eina_List *l;
E_Comp_Config *conf = e_comp_config_get();
e_comp->rendering = EINA_TRUE; 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) EINA_LIST_FOREACH(e_comp->pre_render_cbs, l, cb)
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_manual_render_set(e_comp->ee, conf->lock_fps);
ecore_evas_show(e_comp->ee); 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); e_comp->ee_win = ecore_evas_window_get(e_comp->ee);

View File

@ -122,5 +122,7 @@ void e_system_cpufreq_shutdown(void);
void e_system_ddc_init(void); void e_system_ddc_init(void);
void e_system_ddc_shutdown(void); void e_system_ddc_shutdown(void);
extern Ecore_Exe *e_system_run(const char *exe);
#endif #endif

View File

@ -203,3 +203,16 @@ main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
eina_shutdown(); eina_shutdown();
return 0; 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);
}

View File

@ -8,25 +8,25 @@ char *_cmd_hibernate = NULL;
static void static void
_cb_power_halt(void *data EINA_UNUSED, const char *params EINA_UNUSED) _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 static void
_cb_power_reboot(void *data EINA_UNUSED, const char *params EINA_UNUSED) _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 static void
_cb_power_suspend(void *data EINA_UNUSED, const char *params EINA_UNUSED) _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 static void
_cb_power_hibernate(void *data EINA_UNUSED, const char *params EINA_UNUSED) _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 static void

View File

@ -328,19 +328,19 @@ _store_action_do(Action *a)
{ {
if (a->cmd2) if (a->cmd2)
{ {
a->exe = ecore_exe_run(a->cmd2, NULL); a->exe = e_system_run(a->cmd2);
free(a->cmd2); free(a->cmd2);
a->cmd2 = NULL; a->cmd2 = NULL;
} }
else if (a->cmd1) else if (a->cmd1)
{ {
a->exe = ecore_exe_run(a->cmd1, NULL); a->exe = e_system_run(a->cmd1);
free(a->cmd1); free(a->cmd1);
a->cmd1 = NULL; a->cmd1 = NULL;
} }
else else
{ {
a->exe = ecore_exe_run(a->cmd, NULL); a->exe = e_system_run(a->cmd);
free(a->cmd); free(a->cmd);
a->cmd = NULL; a->cmd = NULL;
} }