From 94c79d788a155362b9f6b2ee2486eafda09ff49e Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 26 Nov 2004 11:11:05 +0000 Subject: [PATCH] and here is some substance SVN revision: 12275 --- src/bin/Makefile.am | 2 ++ src/bin/e_main.c | 4 +-- src/bin/e_remote_main.c | 78 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 src/bin/e_remote_main.c diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 4c4fc3669..33a5ad7c0 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -65,3 +65,5 @@ enlightenment_LDFLAGS = -export-dynamic @e_libs@ @dlopen_libs@ enlightenment_remote_SOURCES = \ e.h \ e_remote_main.c + +enlightenment_remote_LDFLAGS = @e_libs@ @dlopen_libs@ diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 6b6cb57d8..76ebc1494 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -8,7 +8,7 @@ struct _E_Before_Idler unsigned char delete_me : 1; }; -/* local subsystem globals */ +/* local subsystem functions */ static void _e_main_shutdown_push(void (*func)(void)); static void _e_main_shutdown(int errorcode); @@ -37,7 +37,7 @@ E_Path *path_themes = NULL; E_Path *path_init = NULL; int restart = 0; -/* local subsystem functions */ +/* local subsystem globals */ #define MAX_LEVEL 32 static void (*_e_main_shutdown_func[MAX_LEVEL]) (void); static int _e_main_level = 0; diff --git a/src/bin/e_remote_main.c b/src/bin/e_remote_main.c new file mode 100644 index 000000000..d7438d4da --- /dev/null +++ b/src/bin/e_remote_main.c @@ -0,0 +1,78 @@ +#include "e.h" + +/* local subsystem functions */ +static int _e_cb_signal_exit(void *data, int ev_type, void *ev); +static int _e_ipc_init(void); + +/* local subsystem globals */ + +/* externally accessible functions */ +int +main(int argc, char **argv) +{ + int i; + + /* handle some command-line parameters */ + for (i = 1; i < argc; i++) + { + if ((!strcmp(argv[i], "-instance")) && (i < (argc - 1))) + { + i++; + } + } + + /* basic ecore init */ + if (!ecore_init()) + { + printf("Enlightenment cannot Initialize Ecore!\n" + "Perhaps you are out of memory?\n"); + exit(-1); + } + ecore_app_args_set((int)argc, (const char **)argv); + /* setup a handler for when e is asked to exit via a system signal */ + if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _e_cb_signal_exit, NULL)) + { + printf("Enlightenment cannot set up an exit signal handler.\n" + "Perhaps you are out of memory?\n"); + exit(-1); + } + /* init ipc */ + if (!ecore_ipc_init()) + { + printf("Enlightenment cannot initialize the ipc system.\n" + "Perhaps you are out of memory?\n"); + exit(-1); + } + + /* setup e ipc service */ + if (!_e_ipc_init()) + { + printf("Enlightenment cannot set up the IPC socket.\n" + "It likely is already in use by an exisiting copy of Enlightenment.\n" + "Double check to see if Enlightenment is not already on this display,\n" + "but if that fails try deleting all files in ~/.ecore/enlightenment-*\n" + "and try running again.\n"); + exit(-1); + } + + /* start our main loop */ + ecore_main_loop_begin(); + + /* just return 0 to keep the compiler quiet */ + return 0; +} + +/* local subsystem functions */ +static int +_e_cb_signal_exit(void *data, int ev_type, void *ev) +{ + /* called on ctrl-c, kill (pid) (also SIGINT, SIGTERM and SIGQIT) */ + ecore_main_loop_quit(); + return 1; +} + +static int +_e_ipc_init(void) +{ + return 0; +}