Merge all app executing into one function.

SVN revision: 29026
This commit is contained in:
Sebastian Dransfeld 2007-03-24 17:42:12 +00:00
parent f14e05f082
commit faf9f548bf
10 changed files with 213 additions and 330 deletions

View File

@ -1426,10 +1426,7 @@ ACT_FN_GO(app)
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");
}
}
}

View File

@ -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 @@ struct _E_App_Callback
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_print (const char *path, Ecore_File_Event e
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_List *_e_apps_start_pending = NULL;
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 @@ EAPI int
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 @@ e_app_shutdown(void)
}
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 @@ e_app_subdir_scan(E_App *a, int scan_subdirs)
}
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;
temp = ecore_list_first(commands);
if (temp)
command = strdup(temp);
ecore_list_destroy(commands);
commands = ecore_desktop_get_command(a->desktop, files, 1);
if (commands)
{
char *command;
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;
_e_app_cb_exec(launch, NULL, strdup(exec), 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_change(original, E_APP_EXEC);
free(command);
return 1;
}
@ -2793,7 +2758,7 @@ _e_apps_cb_exit(void *data, int type, void *event)
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 @@ _e_app_order_contains(E_App *a, const char *file)
return ret;
}
static void
_e_app_resolve_file_name(char *buf, size_t size, const char *path, const char *file)
{
@ -3022,3 +2986,132 @@ _e_app_resolve_file_name(char *buf, size_t size, const char *path, const char *f
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);
}
}

View File

@ -27,7 +27,6 @@ typedef enum _E_App_Icon_Type
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 @@ struct _E_App
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 void e_app_image_size_set (E_App *a, int w, int h
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);

View File

@ -424,21 +424,12 @@ _e_exebuf_exec(void)
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 @@ _e_exebuf_exec_term(void)
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 @@ _e_exebuf_exec_term(void)
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();

View File

@ -361,10 +361,10 @@ _e_fwin_cb_open(void *data, E_Dialog *dia)
{
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 @@ _e_fwin_cb_open(void *data, E_Dialog *dia)
}
}
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 @@ _e_fwin_file_exec(E_Fwin *fwin, E_Fm2_Icon_Info *ici, E_Fwin_Exec_Type ext)
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 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
*/
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 @@ _e_fwin_file_open_dialog(E_Fwin *fwin, Evas_List *files, int always)
}
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);

View File

@ -626,8 +626,7 @@ _e_int_menus_apps_run(void *data, E_Menu *m, E_Menu_Item *mi)
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

View File

@ -63,7 +63,7 @@ _e_startup(void)
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);

View File

@ -26,8 +26,6 @@ EAPI int E_EVENT_POINTER_WARP = 0;
#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 @@ e_zone_init(void)
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;
}
@ -598,159 +593,6 @@ e_zone_flip_win_restore(void)
}
}
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 */
static void
_e_zone_free(E_Zone *zone)

View File

@ -90,9 +90,6 @@ EAPI void e_zone_desk_linear_flip_to(E_Zone *zone, int x);
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;

View File

@ -951,8 +951,7 @@ _ibar_cb_icon_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
ic = data;
if ((ev->button == 1) && (!ic->drag.dnd) && (ic->mouse_down == 1))
{
e_zone_app_exec(ic->ibar->inst->gcc->gadcon->zone, ic->app);
e_exehist_add("ibar", ic->app->exe);
e_app_exec(ic->ibar->inst->gcc->gadcon->zone, ic->app, NULL, NULL, "ibar");
ic->drag.start = 0;
ic->drag.dnd = 0;
ic->mouse_down = 0;