Enlightenment CVS committal Author : englebass Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_actions.c e_apps.c e_apps.h e_exebuf.c e_fwin.c e_int_menus.c e_startup.c e_zone.c e_zone.h Log Message: Merge all app executing into one function. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_actions.c,v retrieving revision 1.92 retrieving revision 1.93 diff -u -3 -r1.92 -r1.93 --- e_actions.c 4 Mar 2007 07:03:10 -0000 1.92 +++ e_actions.c 24 Mar 2007 17:42:12 -0000 1.93 @@ -1426,10 +1426,7 @@ else if (!strcmp(p2, "exe:")) a = e_app_exe_find(p + 1); if (a) - { - e_zone_app_exec(zone, a); - e_exehist_add("action/app", a->exe); - } + e_app_exec(zone, a, NULL, NULL, "action/app"); } } } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.c,v retrieving revision 1.252 retrieving revision 1.253 diff -u -3 -r1.252 -r1.253 --- e_apps.c 24 Mar 2007 06:59:41 -0000 1.252 +++ e_apps.c 24 Mar 2007 17:42:12 -0000 1.253 @@ -25,6 +25,8 @@ /* local subsystem functions */ typedef struct _E_App_Change_Info E_App_Change_Info; typedef struct _E_App_Callback E_App_Callback; +typedef struct _E_App_Launch E_App_Launch; +typedef struct _E_App_Instance E_App_Instance; struct _E_App_Change_Info { @@ -39,6 +41,22 @@ unsigned char delete_me : 1; }; +struct _E_App_Launch +{ + E_App *app; + E_Zone *zone; + const char *launch_method; +}; + +struct _E_App_Instance +{ + E_App *app; + Ecore_Exe *exe; + int launch_id; + double launch_time; + Ecore_Timer *expire_timer; +}; + struct _E_App_Hash_Idler { Ecore_Idler *idler; @@ -70,6 +88,7 @@ static void _e_app_check_order (const char *file); static int _e_app_order_contains (E_App *a, const char *file); static void _e_app_resolve_file_name (char *buf, size_t size, const char *path, const char *file); +static void _e_app_cb_exec (void *data, Efreet_Desktop *desktop, char *exec, int remaining); /* local subsystem globals */ static int _e_apps_callbacks_walking = 0; @@ -84,6 +103,8 @@ static Evas_Hash *_e_apps_every_app = NULL; static struct _E_App_Hash_Idler _e_apps_hash_idler; +static int startup_id = 0; + #if CLEVER_BORDERS struct _E_App_Glob_List_Entry { @@ -239,6 +260,16 @@ e_app_shutdown(void) { Evas_List *list; + char buf[256]; + + snprintf(buf, sizeof(buf), "%i", startup_id); + e_util_env_set("E_STARTUP_ID", buf); + + while (_e_apps_change_callbacks) + { + free(_e_apps_change_callbacks->data); + _e_apps_change_callbacks = evas_list_remove_list(_e_apps_change_callbacks, _e_apps_change_callbacks); + } if (_e_apps_hash_idler.idler) { @@ -264,16 +295,6 @@ } evas_stringshare_del(_e_apps_path_trash); evas_stringshare_del(_e_apps_path_all); - { - Evas_List *l; - - for (l = list; l; l = l->next) - { - E_App *a; - a = l->data; - printf("BUG: References %d %s\n", E_OBJECT(a)->references, a->path); - } - } evas_hash_free(_e_apps_every_app); _e_apps_every_app = NULL; #if CLEVER_BORDERS @@ -621,102 +642,46 @@ } EAPI int -e_app_exec(E_App *a, int launch_id) +e_app_exec(E_Zone *zone, E_App *a, const char *exec, Ecore_List *files, const char *launch_method) { - Ecore_Exe *exe; - E_App *original; - E_App_Instance *inst; - Evas_List *l; - char *command; - - E_OBJECT_CHECK_RETURN(a, 0); - E_OBJECT_TYPE_CHECK_RETURN(a, E_APP_TYPE, 0); - if (!a->exe) return 0; + E_App_Launch *launch; - /* no exe field, don't exe it. */ -// if (!_e_app_exe_valid_get(a->exe)) -// return 0; - - /* FIXME: set up locale, encoding and input method env vars if they are in - * the eapp file */ - inst = E_NEW(E_App_Instance, 1); - if (!inst) return 0; - - if (a->orig) - original = a->orig; - else - original = a; - - if (a->desktop) + if ((!a) && (!exec)) return 0; + launch = E_NEW(E_App_Launch, 1); + if (!launch) return 0; + if (zone) { - Ecore_List *commands; + launch->zone = zone; + e_object_ref(E_OBJECT(launch->zone)); + } + if (launch_method) launch->launch_method = evas_stringshare_add(launch_method); - /* We are not passing a list of files, so we only expect one command. */ - commands = ecore_desktop_get_command(a->desktop, NULL, 1); - if (commands) + if (a) + { + if (a->orig) a = a->orig; + launch->app = a; + e_object_ref(E_OBJECT(launch->app)); + if (exec) + _e_app_cb_exec(launch, NULL, strdup(exec), 0); + else { - char *temp; + Ecore_List *commands; + + commands = ecore_desktop_get_command(a->desktop, files, 1); + if (commands) + { + char *command; - temp = ecore_list_first(commands); - if (temp) - command = strdup(temp); - ecore_list_destroy(commands); + while ((command = ecore_list_remove_first(commands))) + _e_app_cb_exec(launch, NULL, command, ecore_list_nodes(commands)); + ecore_list_destroy(commands); + } } } else - command = strdup(a->exe); - if (!command) - { - free(inst); - e_util_dialog_show(_("Run Error"), - _("Enlightenment was unable to process a command line:<br>" - "<br>" - "%s %s<br>"), - a->exe, (a->exe_params != NULL) ? a->exe_params : "" ); - return 0; - } - /* We want the stdout and stderr as lines for the error dialog if it exits abnormally. */ - e_util_library_path_strip(); - exe = ecore_exe_pipe_run(command, ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR | ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, inst); - e_util_library_path_restore(); - if (!exe) - { - free(command); - free(inst); - e_util_dialog_show(_("Run Error"), - _("Enlightenment was unable to fork a child process:<br>" - "<br>" - "%s %s<br>"), - a->exe, (a->exe_params != NULL) ? a->exe_params : "" ); - return 0; - } - /* 20 lines at start and end, 20x100 limit on bytes at each end. */ - ecore_exe_auto_limits_set(exe, 2000, 2000, 20, 20); - ecore_exe_tag_set(exe, "E/app"); - inst->app = original; - inst->exe = exe; - inst->launch_id = launch_id; - inst->launch_time = ecore_time_get(); - inst->expire_timer = ecore_timer_add(10.0, _e_app_cb_expire_timer, inst); - - if (original->parent == _e_apps_all) - { - _e_apps_all->subapps = evas_list_remove(_e_apps_all->subapps, original); - _e_apps_all->subapps = evas_list_prepend(_e_apps_all->subapps, original); - } - - original->instances = evas_list_append(original->instances, inst); - _e_apps_start_pending = evas_list_append(_e_apps_start_pending, original); - if (original->startup_notify) original->starting = 1; - for (l = original->references; l; l = l->next) { - E_App *a2; - - a2 = l->data; - _e_app_change(a2, E_APP_EXEC); + _e_app_cb_exec(launch, NULL, strdup(exec), 0); } - _e_app_change(original, E_APP_EXEC); - free(command); return 1; } @@ -2793,7 +2758,7 @@ ev = event; if (!ev->exe) return 1; if (!(ecore_exe_tag_get(ev->exe) && - (!strcmp(ecore_exe_tag_get(ev->exe), "E/app")))) return 1; + (!strcmp(ecore_exe_tag_get(ev->exe), "E/app")))) return 1; ai = ecore_exe_data_get(ev->exe); if (!ai) return 1; a = ai->app; @@ -3008,7 +2973,6 @@ return ret; } - static void _e_app_resolve_file_name(char *buf, size_t size, const char *path, const char *file) { @@ -3021,4 +2985,133 @@ snprintf(buf, size, "%s%s", path, file); else snprintf(buf, size, "%s/%s", path, file); +} + +static void +_e_app_cb_exec(void *data, Efreet_Desktop *desktop, char *exec, int remaining) +{ + E_App_Instance *inst = NULL; + E_App_Launch *launch; + Ecore_Exe *exe; + const char *penv_display; + char buf[4096]; + + launch = data; + if (launch->app) + { + inst = E_NEW(E_App_Instance, 1); + if (!inst) return; + } + + if (startup_id == 0) + { + const char *p; + p = getenv("E_STARTUP_ID"); + if (p) startup_id = atoi(p); + e_util_env_set("E_STARTUP_ID", NULL); + } + if (++startup_id < 1) startup_id = 1; + /* save previous env vars we need to save */ + penv_display = getenv("DISPLAY"); + if (penv_display) penv_display = strdup(penv_display); + if ((penv_display) && (launch->zone)) + { + const char *p1, *p2; + char buf2[32]; + int head; + + head = launch->zone->container->manager->num; + + /* set env vars */ + p1 = strrchr(penv_display, ':'); + p2 = strrchr(penv_display, '.'); + if ((p1) && (p2) && (p2 > p1)) /* "blah:x.y" */ + { + /* yes it could overflow... but who will overflow DISPLAY eh? why? to + * "exploit" your own applications running as you? + */ + strcpy(buf, penv_display); + buf[p2 - penv_display + 1] = 0; + snprintf(buf2, sizeof(buf2), "%i", head); + strcat(buf, buf2); + } + else if (p1) /* "blah:x */ + { + strcpy(buf, penv_display); + snprintf(buf2, sizeof(buf2), ".%i", head); + strcat(buf, buf2); + } + else + strcpy(buf, penv_display); + e_util_env_set("DISPLAY", buf); + } + snprintf(buf, sizeof(buf), "E_START|%i", startup_id); + e_util_env_set("DESKTOP_STARTUP_ID", buf); + + e_util_library_path_strip(); + printf("exec: %s\n", exec); + exe = ecore_exe_pipe_run(exec, + ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR | + ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, + inst); + e_util_library_path_restore(); + if (penv_display) + { + e_util_env_set("DISPLAY", penv_display); + free(penv_display); + } + if (!exe) + { + E_FREE(inst); + e_util_dialog_show(_("Run Error"), + _("Enlightenment was unable to fork a child process:<br>" + "<br>" + "%s<br>"), + exec); + return; + } + /* reset env vars */ + if (launch->launch_method) e_exehist_add(launch->launch_method, exec); + free(exec); + /* 20 lines at start and end, 20x100 limit on bytes at each end. */ + ecore_exe_auto_limits_set(exe, 2000, 2000, 20, 20); + ecore_exe_tag_set(exe, "E/app"); + + if (launch->app) + { + Evas_List *l; + + inst->app = launch->app; + inst->exe = exe; + inst->launch_id = startup_id; + inst->launch_time = ecore_time_get(); + inst->expire_timer = ecore_timer_add(10.0, _e_app_cb_expire_timer, inst); + + if (inst->app->parent == _e_apps_all) + { + _e_apps_all->subapps = evas_list_remove(_e_apps_all->subapps, inst->app); + _e_apps_all->subapps = evas_list_prepend(_e_apps_all->subapps, inst->app); + } + + inst->app->instances = evas_list_append(inst->app->instances, inst); + _e_apps_start_pending = evas_list_append(_e_apps_start_pending, inst->app); + if (inst->app->startup_notify) inst->app->starting = 1; + for (l = inst->app->references; l; l = l->next) + { + E_App *a2; + + a2 = l->data; + _e_app_change(a2, E_APP_EXEC); + } + _e_app_change(inst->app, E_APP_EXEC); + } + else + ecore_exe_free(exe); + if (!remaining) + { + if (launch->launch_method) evas_stringshare_del(launch->launch_method); + if (launch->zone) e_object_unref(E_OBJECT(launch->zone)); + if (launch->app) e_object_unref(E_OBJECT(launch->app)); + free(launch); + } } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_apps.h,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- e_apps.h 28 Dec 2006 13:43:30 -0000 1.51 +++ e_apps.h 24 Mar 2007 17:42:12 -0000 1.52 @@ -27,7 +27,6 @@ typedef struct _E_App E_App; -typedef struct _E_App_Instance E_App_Instance; typedef struct _E_App_Autopsy E_App_Autopsy; #else @@ -97,15 +96,6 @@ unsigned char tmpfile : 1; }; -struct _E_App_Instance -{ - E_App *app; - Ecore_Exe *exe; - int launch_id; - double launch_time; - Ecore_Timer *expire_timer; -}; - struct _E_App_Autopsy { E_App *app; @@ -126,7 +116,7 @@ EAPI int e_app_is_parent (E_App *parent, E_App *app); EAPI int e_app_equals (E_App *app1, E_App *app2); EAPI void e_app_subdir_scan (E_App *a, int scan_subdirs); -EAPI int e_app_exec (E_App *a, int launch_id); +EAPI int e_app_exec (E_Zone *zone, E_App *a, const char *exec, Ecore_List *files, const char *launch_method); EAPI int e_app_starting_get (E_App *a); EAPI int e_app_running_get (E_App *a); EAPI void e_app_list_prepend_relative (E_App *add, E_App *before); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_exebuf.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- e_exebuf.c 28 Dec 2006 13:43:30 -0000 1.29 +++ e_exebuf.c 24 Mar 2007 17:42:12 -0000 1.30 @@ -424,21 +424,12 @@ if (exe_sel) { if (exe_sel->app) - { - e_zone_app_exec(exebuf->zone, exe_sel->app); - e_exehist_add("exebuf", exe_sel->app->exe); - } + e_app_exec(exebuf->zone, exe_sel->app, NULL, NULL, "exebuf"); else - { - e_zone_exec(exebuf->zone, exe_sel->file); - e_exehist_add("exebuf", exe_sel->file); - } + e_app_exec(exebuf->zone, NULL, exe_sel->file, NULL, "exebuf"); } else - { - e_zone_exec(exebuf->zone, cmd_buf); - e_exehist_add("exebuf", cmd_buf); - } + e_app_exec(exebuf->zone, NULL, cmd_buf, NULL, "exebuf"); e_exebuf_hide(); } @@ -456,10 +447,7 @@ if (exe_sel->app->exe) active_cmd = exe_sel->app->exe; else - { - e_zone_app_exec(exebuf->zone, exe_sel->app); - e_exehist_add("exebuf", exe_sel->app->exe); - } + e_app_exec(exebuf->zone, exe_sel->app, NULL, NULL, "exebuf"); } else active_cmd = exe_sel->file; @@ -467,13 +455,12 @@ else active_cmd = cmd_buf; - if (strlen(active_cmd) > 0) + if (active_cmd[0]) { /* Copy the terminal command to the start of the string... * making sure it has a null terminator if greater than EXEBUFLEN */ snprintf(tmp, EXEBUFLEN, "%s %s", e_config->exebuf_term_cmd, active_cmd); - e_zone_exec(exebuf->zone, tmp); - e_exehist_add("exebuf", tmp); + e_app_exec(exebuf->zone, NULL, tmp, NULL, "exebuf"); } e_exebuf_hide(); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_fwin.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -3 -r1.29 -r1.30 --- e_fwin.c 2 Mar 2007 17:00:20 -0000 1.29 +++ e_fwin.c 24 Mar 2007 17:42:12 -0000 1.30 @@ -361,10 +361,10 @@ { E_Fwin_Apps_Dialog *fad; E_App *a = NULL; - char pcwd[4096], buf[4096], *cmd; + char pcwd[4096], buf[4096]; Evas_List *selected, *l; E_Fm2_Icon_Info *ici; - Ecore_List *files = NULL, *cmds = NULL; + Ecore_List *files = NULL; fad = data; if (fad->app1) a = e_app_file_find(fad->app1); @@ -416,17 +416,7 @@ } } evas_list_free(selected); - cmds = ecore_desktop_get_command(a->desktop, files, 1); - if (cmds) - { - ecore_list_goto_first(cmds); - while ((cmd = ecore_list_next(cmds))) - { - e_zone_exec(fad->fwin->win->border->zone, cmd); - e_exehist_add("fwin", cmd); - } - ecore_list_destroy(cmds); - } + e_app_exec(fad->fwin->win->border->zone, a, NULL, files, "fwin"); ecore_list_destroy(files); } chdir(pcwd); @@ -556,27 +546,26 @@ case E_FWIN_EXEC_NONE: break; case E_FWIN_EXEC_DIRECT: - e_zone_exec(fwin->win->border->zone, ici->file); - e_exehist_add("fwin", ici->file); + e_app_exec(fwin->win->border->zone, NULL, ici->file, NULL, "fwin"); break; case E_FWIN_EXEC_SH: snprintf(buf, sizeof(buf), "/bin/sh %s", e_util_filename_escape(ici->file)); - e_zone_exec(fwin->win->border->zone, buf); + e_app_exec(fwin->win->border->zone, NULL, buf, NULL, NULL); break; case E_FWIN_EXEC_TERMINAL_DIRECT: snprintf(buf, sizeof(buf), "%s %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file)); - e_zone_exec(fwin->win->border->zone, buf); + e_app_exec(fwin->win->border->zone, NULL, buf, NULL, NULL); break; case E_FWIN_EXEC_TERMINAL_SH: snprintf(buf, sizeof(buf), "%s /bin/sh %s", e_config->exebuf_term_cmd, e_util_filename_escape(ici->file)); - e_zone_exec(fwin->win->border->zone, buf); + e_app_exec(fwin->win->border->zone, NULL, buf, NULL, NULL); break; case E_FWIN_EXEC_DESKTOP: snprintf(buf, sizeof(buf), "%s/%s", e_fm2_real_path_get(fwin->fm_obj), ici->file); a = e_app_new(buf, 0); if (a) { - e_zone_app_exec(fwin->win->border->zone, a); + e_app_exec(fwin->win->border->zone, a, NULL, NULL, NULL); e_object_unref(E_OBJECT(a)); } break; @@ -709,8 +698,8 @@ */ if (evas_list_count(mlist) <= 1) { - char pcwd[4096], *cmd; - Ecore_List *files_list = NULL, *cmds = NULL; + char pcwd[4096]; + Ecore_List *files_list = NULL; need_dia = 1; a = NULL; @@ -740,18 +729,8 @@ } if (a) { - cmds = ecore_desktop_get_command(a->desktop, files_list, 1); - if (cmds) - { - ecore_list_goto_first(cmds); - while ((cmd = ecore_list_next(cmds))) - { - e_zone_exec(fwin->win->border->zone, cmd); - e_exehist_add("fwin", cmd); - need_dia = 0; - } - ecore_list_destroy(cmds); - } + if (e_app_exec(fwin->win->border->zone, a, NULL, files_list, "fwin")) + need_dia = 0; } ecore_list_destroy(files_list); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_int_menus.c,v retrieving revision 1.201 retrieving revision 1.202 diff -u -3 -r1.201 -r1.202 --- e_int_menus.c 13 Mar 2007 18:03:19 -0000 1.201 +++ e_int_menus.c 24 Mar 2007 17:42:12 -0000 1.202 @@ -626,8 +626,7 @@ E_App *a; a = data; - e_zone_app_exec(m->zone, a); - e_exehist_add("menu/apps", a->exe); + e_app_exec(m->zone, a, NULL, NULL, "menu/apps"); } static void =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_startup.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_startup.c 12 Jan 2007 13:29:54 -0000 1.9 +++ e_startup.c 24 Mar 2007 17:42:12 -0000 1.10 @@ -63,7 +63,7 @@ e_init_done(); return; } - e_app_exec(a, 0); + e_app_exec(NULL, a, NULL, NULL, NULL); snprintf(buf, sizeof(buf), _("Starting %s"), a->name); e_init_status_set(buf); e_init_icons_app_add(a); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_zone.c,v retrieving revision 1.111 retrieving revision 1.112 diff -u -3 -r1.111 -r1.112 --- e_zone.c 3 Mar 2007 18:38:44 -0000 1.111 +++ e_zone.c 24 Mar 2007 17:42:12 -0000 1.112 @@ -26,8 +26,6 @@ #define E_ZONE_FLIP_UP(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || ((zone)->desk_y_current > 0)) #define E_ZONE_FLIP_DOWN(zone) ((e_config->desk_flip_wrap && ((zone)->desk_y_count > 1)) || (((zone)->desk_y_current + 1) < (zone)->desk_y_count)) -static int startup_id = 0; - EAPI int e_zone_init(void) { @@ -39,9 +37,6 @@ EAPI int e_zone_shutdown(void) { - char buf[256]; - snprintf(buf, sizeof(buf), "%i", startup_id); - e_util_env_set("E_STARTUP_ID", buf); return 1; } @@ -596,159 +591,6 @@ } } } -} - -EAPI int -e_zone_exec(E_Zone *zone, const char *exe) -{ - int ret = 0; - char *p1, *p2; - char *penv_display; - char buf[4096], buf2[32]; - Ecore_Exe *ex; - E_App_Instance *inst = NULL; - E_App *a; - - E_OBJECT_CHECK_RETURN(zone, 0); - E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - - if (startup_id == 0) - { - p1 = getenv("E_STARTUP_ID"); - if (p1) startup_id = atoi(p1); - } - if (++startup_id < 1) startup_id = 1; - /* save previous env vars we need to save */ - penv_display = getenv("DISPLAY"); - if (penv_display) penv_display = strdup(penv_display); - - /* set env vars */ - p1 = strrchr(penv_display, ':'); - p2 = strrchr(penv_display, '.'); - if ((p1) && (p2) && (p2 > p1)) /* "blah:x.y" */ - { - /* yes it could overflow... but who will overflow DISPLAY eh? why? to - * "exploit" your own applications running as you? - */ - strcpy(buf, penv_display); - buf[p2 - penv_display + 1] = 0; - snprintf(buf2, sizeof(buf2), "%i", zone->container->manager->num); - strcat(buf, buf2); - } - else if (p1) /* "blah:x */ - { - strcpy(buf, penv_display); - snprintf(buf2, sizeof(buf2), ".%i", zone->container->manager->num); - strcat(buf, buf2); - } - else - strcpy(buf, penv_display); - e_util_env_set("DISPLAY", buf); - snprintf(buf, sizeof(buf), "E_START|%i", startup_id); - e_util_env_set("DESKTOP_STARTUP_ID", buf); - /* execute */ - a = e_app_exe_find(exe); - if (!a) - { -// a = E_NEW(E_App, 1); -// a->name = strdup(exe); -// a->exe = strdup(exe); - } - - if (a) - { - inst = E_NEW(E_App_Instance, 1); - if (!inst) return 0; - } - - e_util_library_path_strip(); - ex = ecore_exe_pipe_run(exe, ECORE_EXE_PIPE_AUTO | ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR | ECORE_EXE_PIPE_READ_LINE_BUFFERED | ECORE_EXE_PIPE_ERROR_LINE_BUFFERED, inst); - e_util_library_path_restore(); - if (!ex) - { - if (inst) free(inst); - ret = 0; - } - /* reset env vars */ - else ret = 1; - if (penv_display) - { - e_util_env_set("DISPLAY", penv_display); - free(penv_display); - } - /* 20 lines at start and end, 20x100 limit on bytes at each end. */ - ecore_exe_auto_limits_set(ex, 2000, 2000, 20, 20); - if (a) - { - ecore_exe_tag_set(ex, "E/app"); - inst->app = a; - inst->exe = ex; - inst->launch_id = startup_id; - inst->launch_time = ecore_time_get(); - a->instances = evas_list_append(a->instances, inst); - if (a->startup_notify) a->starting = 1; - } - else - ecore_exe_free(ex); - return ret; -} - -EAPI int -e_zone_app_exec(E_Zone *zone, E_App *a) -{ - int ret; - char *p1, *p2; - char *penv_display; - char buf[4096], buf2[32]; - - E_OBJECT_CHECK_RETURN(zone, 0); - E_OBJECT_TYPE_CHECK_RETURN(zone, E_ZONE_TYPE, 0); - - if (!a) return 0; - if (startup_id == 0) - { - p1 = getenv("E_STARTUP_ID"); - if (p1) startup_id = atoi(p1); - } - if (++startup_id < 1) startup_id = 1; - /* save previous env vars we need to save */ - penv_display = getenv("DISPLAY"); - if (penv_display) penv_display = strdup(penv_display); - - /* set env vars */ - p1 = strrchr(penv_display, ':'); - p2 = strrchr(penv_display, '.'); - if ((p1) && (p2) && (p2 > p1)) /* "blah:x.y" */ - { - /* yes it could overflow... but who will overflow DISPLAY eh? why? to - * "exploit" your own applications running as you? - */ - strcpy(buf, penv_display); - buf[p2 - penv_display + 1] = 0; - snprintf(buf2, sizeof(buf2), "%i", zone->container->manager->num); - strcat(buf, buf2); - } - else if (p1) /* "blah:x */ - { - strcpy(buf, penv_display); - snprintf(buf2, sizeof(buf2), ".%i", zone->container->manager->num); - strcat(buf, buf2); - } - else - strcpy(buf, penv_display); - e_util_env_set("DISPLAY", buf); - snprintf(buf, sizeof(buf), "E_START|%i", startup_id); - e_util_env_set("DESKTOP_STARTUP_ID", buf); - /* execute */ - ret = e_app_exec(a, startup_id); - - /* reset env vars */ - if (penv_display) - { - e_util_env_set("DISPLAY", penv_display); - free(penv_display); - } - return ret; } /* local subsystem functions */ =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_zone.h,v retrieving revision 1.38 retrieving revision 1.39 diff -u -3 -r1.38 -r1.39 --- e_zone.h 14 Dec 2006 19:29:24 -0000 1.38 +++ e_zone.h 24 Mar 2007 17:42:12 -0000 1.39 @@ -90,9 +90,6 @@ EAPI void e_zone_flip_win_disable(void); EAPI void e_zone_flip_win_restore(void); -EAPI int e_zone_exec(E_Zone *zone, const char *exe); -EAPI int e_zone_app_exec(E_Zone *zone, E_App *a); - extern EAPI int E_EVENT_ZONE_DESK_COUNT_SET; extern EAPI int E_EVENT_POINTER_WARP; ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs