support ~/.e/e/applications/startup (and restart) dirs. they work likeall

other app dirs - defining a list of apps to start on start (or restart).

also splashscreen will be gone now on restart :)


SVN revision: 12421
This commit is contained in:
Carsten Haitzler 2004-12-09 13:56:06 +00:00
parent b1ea85565e
commit 261d7f48b1
12 changed files with 202 additions and 14 deletions

View File

@ -1433,6 +1433,12 @@ collections {
source: "button_0";
action: SIGNAL_EMIT "action" "close";
}
program {
name: "shade_action";
signal: "mouse,clicked,1,double";
source: "title";
action: SIGNAL_EMIT "action" "shade";
}
program {
name: "go_active_pre";

View File

@ -60,7 +60,9 @@ e_focus.c \
e_place.h \
e_place.c \
e_resist.h \
e_resist.c
e_resist.c \
e_startup.h \
e_startup.c
enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@

View File

@ -66,6 +66,8 @@
#include "e_canvas.h"
#include "e_focus.h"
#include "e_place.h"
#include "e_resist.h"
#include "e_startup.h"
typedef struct _E_Before_Idler E_Before_Idler;

View File

@ -461,6 +461,12 @@ _e_app_fields_fill(E_App *a, char *path)
a->startup_notify = *v;
free(v);
}
v = eet_read(ef, "app/info/wait_exit", &size);
if (v)
{
a->wait_exit = *v;
free(v);
}
eet_close(ef);
}

View File

@ -38,6 +38,7 @@ struct _E_App
Evas_List *instances; /* a list of all the exe handles for executions */
unsigned char startup_notify : 1; /* disable while starting etc. */
unsigned char wait_exit : 1; /* wait for app to exit before execing next */
unsigned char starting : 1; /* this app is starting */
unsigned char scanned : 1; /* have we scanned a subdir app yet */

View File

@ -655,13 +655,6 @@ _e_border_cb_window_property(void *data, int ev_type, void *ev)
e = ev;
bd = e_border_find_by_client_window(e->win);
if (!bd) return 1;
{
char *name;
name = XGetAtomName(ecore_x_display_get(), e->atom);
printf("property for %0x [%s]\n", e->win, name);
XFree(name);
}
if (e->atom == ECORE_X_ATOM_WM_NAME)
{
bd->client.icccm.fetch.title = 1;
@ -932,6 +925,21 @@ _e_border_cb_signal_action(void *data, Evas_Object *obj, const char *emission, c
e_object_del(E_OBJECT(bd));
}
}
else if (!strcmp(source, "shade"))
{
if (bd->shaded)
{
bd->shaded = 0;
bd->changes.shaded = 1;
bd->changed = 1;
}
else
{
bd->shaded = 1;
bd->changes.shaded = 1;
bd->changed = 1;
}
}
}
static int
@ -1588,6 +1596,7 @@ _e_border_eval(E_Border *bd)
else ecore_x_window_hide(bd->win);
bd->changes.visible = 0;
}
/* FIXME: handle shaded flag */
if ((bd->changes.pos) && (bd->changes.size))
{
printf("border move resize\n");
@ -1637,6 +1646,7 @@ _e_border_eval(E_Border *bd)
printf("border move resize done\n");
bd->changes.size = 0;
}
if (bd->changes.reset_gravity)
{
GRAV_SET(bd, ECORE_X_GRAVITY_NW);

View File

@ -113,6 +113,7 @@ struct _E_Border
unsigned char focused : 1;
unsigned char new_client : 1;
unsigned char re_manage : 1;
unsigned char shaded : 1;
unsigned char changed : 1;
@ -127,6 +128,7 @@ struct _E_Border
unsigned int prop : 1;
unsigned int border : 1;
unsigned int reset_gravity : 1;
unsigned int shaded : 1;
} changes;
};

View File

@ -5,6 +5,7 @@
/* local subsystem globals */
static Evas_List *_e_canvases = NULL;
/* externally accessible functions */
void
e_canvas_add(Ecore_Evas *ee)
{

View File

@ -20,6 +20,7 @@ main(int argc, char **argv)
int del_win_name = 0;
int del_win_class = 0;
int del_startup_notify = 0;
int del_wait_exit = 0;
char *file = NULL;
char *set_name = NULL;
char *set_generic = NULL;
@ -28,6 +29,7 @@ main(int argc, char **argv)
char *set_win_name = NULL;
char *set_win_class = NULL;
int set_startup_notify = -1;
int set_wait_exit = -1;
/* handle some command-line parameters */
for (i = 1; i < argc; i++)
@ -77,6 +79,11 @@ main(int argc, char **argv)
i++;
set_startup_notify = atoi(argv[i]);
}
else if ((!strcmp(argv[i], "-set-wait-exit")) && (i < (argc - 1)))
{
i++;
set_wait_exit = atoi(argv[i]);
}
else if ((!strcmp(argv[i], "-del-all")))
{
del_name = 1;
@ -114,6 +121,10 @@ main(int argc, char **argv)
{
del_startup_notify = 1;
}
else if ((!strcmp(argv[i], "-del-wait-exit")))
{
del_wait_exit = 1;
}
else if ((!strcmp(argv[i], "-h")) ||
(!strcmp(argv[i], "-help")) ||
(!strcmp(argv[i], "--h")) ||
@ -172,6 +183,16 @@ main(int argc, char **argv)
else
eet_write(ef, "app/info/startup_notify", tmp, 1, 0);
}
if (set_wait_exit >= 0)
{
unsigned char tmp[1];
tmp[0] = set_wait_exit;
if (set_wait_exit)
eet_write(ef, "app/info/wait_exit", tmp, 1, 0);
else
eet_write(ef, "app/info/wait_exit", tmp, 1, 0);
}
if (del_name)
{
char **matches = NULL;
@ -216,6 +237,8 @@ main(int argc, char **argv)
eet_delete(ef, "app/window/class");
if (del_startup_notify)
eet_delete(ef, "app/info/startup_notify");
if (del_wait_exit)
eet_delete(ef, "app/info/wait_exit");
eet_close(ef);
eet_shutdown();
@ -235,6 +258,7 @@ _e_help(void)
" -set-win-name WIN_NAME Set the application window name\n"
" -set-win-class WIN_CLASS Set the application window class\n"
" -set-startup-notify [1/0] Set the application startup notify flag to on/off\n"
" -set-wait-exit [1/0] Set the application wait exit flag to on/off\n"
" -del-name Delete the application name\n"
" -del-generic Delete the application generic name\n"
" -del-comment Delete the application comment\n"
@ -242,5 +266,6 @@ _e_help(void)
" -del-win-name Delete the application window name\n"
" -del-win-class Delete the application window class\n"
" -del-startup-notify Delete the application startup notify flag\n"
" -del-wait-exit Delete the application wait exit flag\n"
);
}

View File

@ -56,14 +56,22 @@ main(int argc, char **argv)
int i;
char *display_name = NULL;
int nosplash = 0;
int after_restart = 0;
char buf[1024];
if (getenv("NOSPLASH")) nosplash = 1;
if (getenv("RESTART"))
{
printf("after restart!!!\n");
after_restart = 1;
}
putenv("RESTART=1");
/* handle some command-line parameters */
for (i = 1; i < argc; i++)
{
if ((!strcmp(argv[i], "-display")) && (i < (argc - 1)))
{
char buf[1024];
i++;
snprintf(buf, sizeof(buf), "DISPLAY=%s", argv[i]);
@ -257,10 +265,11 @@ main(int argc, char **argv)
e_init_title_set("Enlightenment");
e_init_version_set(VERSION);
e_init_status_set("Enlightenment Starting. Please wait.");
/* FIXME: "faking" startup here. normally we would now execute background */
/* handlers, panels, initial clients, filemanager etc. and wait till they */
/* all have started and are "ready to go". */
if (nosplash)
if (after_restart) e_startup(E_STARTUP_RESTART);
else e_startup(E_STARTUP_START);
if ((nosplash) || (after_restart))
{
ecore_timer_add(0.0, _e_main_cb_startup_fake_end, NULL);
}
@ -373,6 +382,8 @@ _e_main_dirs_init(void)
"%s/.e/e/applications/all",
"%s/.e/e/applications/favorite",
"%s/.e/e/applications/bar",
"%s/.e/e/applications/startup",
"%s/.e/e/applications/restart",
"%s/.e/e/modules",
"%s/.e/e/config"
};
@ -403,6 +414,7 @@ _e_main_dirs_init(void)
"(cd %s/.e/e/ ; tar -xf -)",
PACKAGE_DATA_DIR,
homedir);
system(buf);
}
free(homedir);

109
src/bin/e_startup.c Normal file
View File

@ -0,0 +1,109 @@
#include "e.h"
/* local subsystem functions */
static void _e_startup(void);
static int _e_startup_timeout_cb(void *data);
static int _e_startup_next_cb(void *data);
static void _e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch);
/* local subsystem globals */
static E_App *startup_apps = NULL;
static int start_app_pos = -1;
static Ecore_Timer *next_timer = NULL;
static Ecore_Timer *timeout_timer = NULL;
static E_App *waiting_app = NULL;
/* externally accessible functions */
void
e_startup(E_Startup_Mode mode)
{
char *homedir;
char buf[PATH_MAX];
homedir = e_user_homedir_get();
if (mode == E_STARTUP_START)
snprintf(buf, sizeof(buf), "%s/.e/e/applications/startup", homedir);
else if (mode == E_STARTUP_RESTART)
snprintf(buf, sizeof(buf), "%s/.e/e/applications/restart", homedir);
free(homedir);
startup_apps = e_app_new(buf, 1);
if (!startup_apps)
{
// e_init_hide();
return;
}
e_app_change_callback_add(_e_startup_app_exit_cb, NULL);
start_app_pos = 0;
_e_startup();
}
/* local subsystem functions */
static void
_e_startup(void)
{
E_App *a;
char buf[4096];
if (!startup_apps) return;
a = evas_list_nth(startup_apps->subapps, start_app_pos);
start_app_pos++;
if (!a)
{
e_object_unref(E_OBJECT(startup_apps));
startup_apps = NULL;
start_app_pos = -1;
waiting_app = NULL;
e_app_change_callback_del(_e_startup_app_exit_cb, NULL);
// e_init_hide();
return;
}
e_app_exec(a);
snprintf(buf, sizeof(buf), "Starting %s", a->name);
e_init_status_set((const char *)buf);
if (a->wait_exit)
{
timeout_timer = ecore_timer_add(10.0, _e_startup_timeout_cb, NULL);
waiting_app = a;
}
else
{
timeout_timer = ecore_timer_add(0.0, _e_startup_next_cb, NULL);
waiting_app = NULL;
}
}
static int
_e_startup_timeout_cb(void *data)
{
timeout_timer = NULL;
waiting_app = NULL;
/* FIXME: error dialog or log etc..... */
_e_startup();
return 0;
}
static int
_e_startup_next_cb(void *data)
{
next_timer = NULL;
_e_startup();
return 0;
}
static void
_e_startup_app_exit_cb(void *data, E_App *a, E_App_Change ch)
{
if (ch == E_APP_EXIT)
{
if (a == waiting_app)
{
waiting_app = NULL;
if (timeout_timer)
{
ecore_timer_del(timeout_timer);
timeout_timer = NULL;
}
_e_startup();
}
}
}

12
src/bin/e_startup.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef E_STARTUP_H
#define E_STARTUP_H
typedef enum _E_Startup_Mode
{
E_STARTUP_START,
E_STARTUP_RESTART
} E_Startup_Mode;
EAPI void e_startup(E_Startup_Mode mode);
#endif