#include "e.h"
+#include "e_actions_intern.h"
+#include "e_test_helper_intern.h"
+#include "e_user_intern.h"
+#include "e_utils_intern.h"
+#include "e_theme_intern.h"
+#include "e_signals_intern.h"
+#include "e_security_intern.h"
+#include "e_screensaver_intern.h"
+#include "e_scale_intern.h"
+
#ifdef __linux__
# include <sys/prctl.h>
#endif
static void _e_main_parse_arguments(int argc, char **argv);
static Eina_Bool _e_main_cb_signal_exit(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED);
static Eina_Bool _e_main_cb_signal_hup(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED);
-static Eina_Bool _e_main_cb_signal_user(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev);
static int _e_main_dirs_init(void);
static int _e_main_dirs_shutdown(void);
static int _e_main_path_init(void);
static int _e_main_screens_shutdown(void);
static void _e_main_desk_save(void);
static void _e_main_desk_restore(void);
-static void _e_main_modules_load(Eina_Bool safe_mode);
static Eina_Bool _e_main_cb_idle_before(void *data EINA_UNUSED);
static Eina_Bool _e_main_cb_idle_after(void *data EINA_UNUSED);
static void _e_main_create_wm_ready(void);
static void _e_main_hook_call(E_Main_Hook_Point hookpoint, void *data EINA_UNUSED);
/* local variables */
-static Eina_Bool really_know = EINA_FALSE;
-static Eina_Bool inloop = EINA_FALSE;
-
static int _e_main_lvl = 0;
static int(*_e_main_shutdown_func[MAX_LEVEL]) (void);
static Ecore_Idle_Enterer *_idle_before = NULL;
static Ecore_Idle_Enterer *_idle_after = NULL;
-static Ecore_Event_Handler *mod_init_end = NULL;
-
static Eina_List *hooks = NULL;
static int _e_main_hooks_delete = 0;
static Eina_Inlist *_e_main_hooks[] =
{
[E_MAIN_HOOK_MODULE_LOAD_DONE] = NULL,
- [E_MAIN_HOOK_E_INFO_READY] = NULL
+ [E_MAIN_HOOK_E_INFO_READY] = NULL,
+ [E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE] = NULL
};
/* external variables */
-E_API Eina_Bool e_precache_end = EINA_FALSE;
-E_API Eina_Bool good = EINA_FALSE;
-E_API Eina_Bool evil = EINA_FALSE;
E_API Eina_Bool starting = EINA_TRUE;
E_API Eina_Bool stopping = EINA_FALSE;
-E_API Eina_Bool restart = EINA_FALSE;
-E_API Eina_Bool e_nopause = EINA_FALSE;
static Eina_Bool
_xdg_check_str(const char *env, const char *str)
{
char *s;
const char *p = e_prefix_get();
- char newpath[4096], buf[4096];
+ char newpath[PATH_MAX], buf[PATH_MAX + PATH_MAX + 200];
if (!p) return;
static Eina_Bool
_e_main_subsystem_defer(void *data EINA_UNUSED)
{
- int argc;
- char **argv;
-
TRACE_DS_BEGIN(MAIN:SUBSYSTEMS DEFER);
- ecore_app_args_get(&argc, &argv);
-
/* try to init delayed subsystems */
TRACE_DS_BEGIN(MAIN:DEFERRED INTERNAL SUBSYSTEMS INIT);
TSE("[DEFERRED] DPMS Init Done");
_e_main_shutdown_push(e_dpms_shutdown);
- TSB("[DEFERRED] Screens Init: win");
- if (!e_win_init())
- {
- e_error_message_show(_("Enlightenment cannot setup elementary trap!\n"));
- goto failed;
- }
- TSE("[DEFERRED] Screens Init: win Done");
-
TSB("[DEFERRED] E_Dnd Init");
if (!e_dnd_init())
{
int
main(int argc, char **argv)
{
- Eina_Bool safe_mode = EINA_FALSE;
- double t = 0.0, tstart = 0.0;
- char *s = NULL, *s1 = NULL, buff[32];
+ char *s = NULL;
struct sigaction action;
#ifdef __linux__
# endif
# endif
#endif
+
+#ifdef TIZEN_TEST_GCOV
+ setenv("GCOV_PREFIX", "/tmp", 1);
+#endif
+
+ /* for debugging by redirecting stdout & stderr of e to a log file to tail */
+ setvbuf(stdout, NULL, _IONBF, 0);
+ setvbuf(stderr, NULL, _IONBF, 0);
+
#ifdef TS_DO
t0 = t1 = t2 = ecore_time_unix_get();
printf("ESTART(main) %1.5f\n", t0);
TSE("Signal Trap Done");
}
- t = ecore_time_unix_get();
- s = e_util_env_get("E_START_TIME");
- if (s)
- {
- s1 = e_util_env_get("E_RESTART_OK");
- if (s1)
- E_FREE(s1); /* do nothing... */
- else
- {
- /* enable safe mode
- * 1. E_RESTART_OK is not defined.
- * 2. the diff time between this and previous start is less than 5 seconds.
- */
- tstart = atof(s);
- if ((t - tstart) < 5.0) safe_mode = EINA_TRUE;
- }
- E_FREE(s);
- }
-
- /* save start time to environment variable to calculate
- * diff time at the next restart
- */
- tstart = t;
- snprintf(buff, sizeof(buff), "%1.1f", tstart);
- e_util_env_set("E_START_TIME", buff);
-
- s = e_util_env_get("E_START_MTRACK");
- if (s)
- {
- e_util_env_set("MTRACK", NULL);
- E_FREE(s);
- }
TSB("Eina Init");
if (!eina_init())
{
}
TSE("Determine Prefix Done");
- /* for debugging by redirecting stdout of e to a log file to tail */
- setvbuf(stdout, NULL, _IONBF, 0);
-
TSB("Parse Arguments");
_e_main_parse_arguments(argc, argv);
TSE("Parse Arguments Done");
TSE("EIO Init Done");
_e_main_shutdown_push(eio_shutdown);
- ecore_app_args_set(argc, (const char **)argv);
-
TSB("Ecore Event Handlers");
if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,
_e_main_cb_signal_exit, NULL))
"Perhaps you are out of memory?"));
goto failed;
}
- if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
- _e_main_cb_signal_user, NULL))
- {
- e_error_message_show(_("Enlightenment cannot set up a USER signal handler.\n"
- "Perhaps you are out of memory?"));
- goto failed;
- }
TSE("Ecore Event Handlers Done");
TSB("Ecore_File Init");
TSE("Ecore_File Init Done");
_e_main_shutdown_push(ecore_file_shutdown);
+ TSB("E_Util_File_Monitor Init");
+ e_util_file_monitor_init();
+ TSE("E_Util_File_Monitor Init Done");
+ _e_main_shutdown_push(e_util_file_monitor_shutdown);
+
_idle_before = ecore_idle_enterer_before_add(_e_main_cb_idle_before, NULL);
TSB("XDG_DATA_DIRS Init");
}
TSE("Ecore_Evas Init Done");
- /* e doesn't sync to compositor - it should be one */
- ecore_evas_app_comp_sync_set(0);
-
TSB("Edje Init");
if (!edje_init())
{
e_screensaver_preinit();
e_zone_init();
e_desk_init();
- e_slot_init();
+ e_magnifier_init();
TRACE_DS_BEGIN(MAIN:WAIT /dev/dri/card0);
if (e_config->sleep_for_dri)
}
TRACE_DS_END();
+ TSB("E_Msg Init");
+ if (!e_msg_init())
+ {
+ e_error_message_show(_("Enlightenment cannot set up its msg system."));
+ goto failed;
+ }
+ TSE("E_Msg Init Done");
+ _e_main_shutdown_push(e_msg_shutdown);
+
e_module_event_init();
TSB("E_Pointer Init");
_e_main_shutdown_push(_e_main_screens_shutdown);
TRACE_DS_END();
+ TSB("E_Devicemgr Init");
+ if (!e_devicemgr_init())
+ {
+ e_error_message_show(_("Enlightenment cannot set up its device_manager system.\n"));
+ goto failed;
+ }
+ TSE("E_Devicemgr Init Done");
+ _e_main_shutdown_push(e_devicemgr_shutdown);
+
+ TSB("E_Keyrouter Init");
+ if (!e_keyrouter_init())
+ {
+ e_error_message_show(_("Enlightenment cannot set up its keyrouting system.\n"));
+ goto failed;
+ }
+ TSE("E_Keyrouter Init Done");
+ _e_main_shutdown_push(e_keyrouter_shutdown);
+
if (e_config->eom_enable)
{
TSB("Eom Init");
_e_main_shutdown_push(e_security_shutdown);
TSB("Load Modules");
- _e_main_modules_load(safe_mode);
+ e_module_all_load();
TSE("Load Modules Done");
TSB("E_Comp Thaw");
e_comp_all_thaw();
TSE("E_Comp Thaw Done");
+ if (e_config->use_thread_max_cpu)
+ {
+ int cpus;
+
+ cpus = eina_cpu_count();
+ if (cpus >= 1)
+ {
+ TSM("Set ecore thread max");
+ ecore_thread_max_set(cpus);
+ }
+ }
+
_idle_after = ecore_idle_enterer_add(_e_main_cb_idle_after, NULL);
starting = EINA_FALSE;
- inloop = EINA_TRUE;
-
- e_util_env_set("E_RESTART", "1");
TSM("MAIN LOOP AT LAST");
#endif
ecore_main_loop_begin();
- inloop = EINA_FALSE;
-
- ELOGF("COMP", "STOPPING enlightenment...", NULL, NULL);
+ ELOGF("COMP", "STOPPING enlightenment...", NULL);
stopping = EINA_TRUE;
_e_main_desk_save();
_e_main_shutdown(0);
- if (restart)
- {
- e_util_env_set("E_RESTART_OK", "1");
- s = e_util_env_get("E_START_MTRACK");
- if (s)
- {
- e_util_env_set("MTRACK", "track");
- E_FREE(s);
- }
- ecore_app_restart();
- }
-
e_prefix_shutdown();
return 0;
dir = e_util_env_get("XDG_RUNTIME_DIR");
if (dir)
{
- char buf_env[PATH_MAX];
+ char buf_env[PATH_MAX - 12];
snprintf(buf_env, sizeof(buf_env), "%s", dir);
snprintf(buf, sizeof(buf), "%s/.e-deleteme", buf_env);
if (ecore_file_exists(buf)) ecore_file_recursive_rm(buf_env);
/* handle some command-line parameters */
for (i = 1; i < argc; i++)
{
- if (!strcmp(argv[i], "-good"))
- {
- good = EINA_TRUE;
- evil = EINA_FALSE;
- printf("LA LA LA\n");
- }
- else if (!strcmp(argv[i], "-evil"))
- {
- good = EINA_FALSE;
- evil = EINA_TRUE;
- printf("MUHAHAHAHHAHAHAHAHA\n");
- }
- else if (!strcmp(argv[i], "-psychotic"))
- {
- good = EINA_TRUE;
- evil = EINA_TRUE;
- printf("MUHAHALALALALALALALA\n");
- }
- else if ((!strcmp(argv[i], "-profile")) && (i < (argc - 1)))
+ if ((!strcmp(argv[i], "-profile")) && (i < (argc - 1)))
{
i++;
if (!getenv("E_CONF_PROFILE"))
e_util_env_set("E_CONF_PROFILE", argv[i]);
}
- else if (!strcmp(argv[i], "-i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it"))
- really_know = EINA_TRUE;
- else if (!strcmp(argv[i], "-nopause"))
- e_nopause = EINA_TRUE;
else if ((!strcmp(argv[i], "-version")) ||
(!strcmp(argv[i], "--version")))
{
printf
(_(
"Options:\n"
- "\t-display DISPLAY\n"
- "\t\tConnect to display named DISPLAY.\n"
- "\t\tEG: -display :1.0\n"
- "\t-fake-xinerama-screen WxH+X+Y\n"
- "\t\tAdd a FAKE xinerama screen (instead of the real ones)\n"
- "\t\tgiven the geometry. Add as many as you like. They all\n"
- "\t\treplace the real xinerama screens, if any. This can\n"
- "\t\tbe used to simulate xinerama.\n"
- "\t\tEG: -fake-xinerama-screen 800x600+0+0 -fake-xinerama-screen 800x600+800+0\n"
"\t-profile CONF_PROFILE\n"
"\t\tUse the configuration profile CONF_PROFILE instead of the user selected default or just \"default\".\n"
- "\t-good\n"
- "\t\tBe good.\n"
- "\t-evil\n"
- "\t\tBe evil.\n"
- "\t-psychotic\n"
- "\t\tBe psychotic.\n"
- "\t-i-really-know-what-i-am-doing-and-accept-full-responsibility-for-it\n"
- "\t\tIf you need this help, you don't need this option.\n"
"\t-version\n"
)
);
static Eina_Bool
_e_main_cb_signal_hup(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev EINA_UNUSED)
{
- restart = 1;
ecore_main_loop_quit();
return ECORE_CALLBACK_RENEW;
}
-static Eina_Bool
-_e_main_cb_signal_user(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *ev)
-{
- Ecore_Event_Signal_User *e = ev;
-
- if (e->number == 1)
- {
-// E_Action *a = e_action_find("configuration");
-// if ((a) && (a->func.go)) a->func.go(NULL, NULL);
- }
- else if (e->number == 2)
- {
- // comp module has its own handler for this for enabling/disabling fps debug
- }
- return ECORE_CALLBACK_RENEW;
-
-}
-
static int
_e_main_dirs_init(void)
{
static int
_e_main_screens_shutdown(void)
{
- e_win_shutdown();
e_comp_shutdown();
e_client_shutdown();
- e_slot_shutdown();
+ e_magnifier_shutdown();
e_desk_shutdown();
e_zone_shutdown();
return 1;
_e_main_desk_restore(void)
{
E_Client *ec;
+ E_Zone *zone;
E_CLIENT_REVERSE_FOREACH(ec)
- if ((!e_client_util_ignored_get(ec)) && e_client_util_desk_visible(ec, e_desk_current_get(ec->zone)))
- {
- ec->want_focus = ec->take_focus = 1;
- break;
- }
-}
-
-static Eina_Bool
-_e_main_modules_load_after(void *d EINA_UNUSED, int type EINA_UNUSED, void *ev EINA_UNUSED)
-{
- E_FREE_FUNC(mod_init_end, ecore_event_handler_del);
- return ECORE_CALLBACK_RENEW;
-}
-
-static void
-_e_main_modules_load(Eina_Bool safe_mode)
-{
- if (!safe_mode)
- e_module_all_load();
- else
{
- E_Module *m;
- char *crashmodule;
-
- crashmodule = getenv("E_MODULE_LOAD");
- if (crashmodule) m = e_module_new(crashmodule);
-
- if ((crashmodule) && (m))
- {
- e_module_disable(m);
- e_object_del(E_OBJECT(m));
-
- e_error_message_show
- (_("Enlightenment crashed early on start and has<br>"
- "been restarted. There was an error loading the<br>"
- "module named: %s. This module has been disabled<br>"
- "and will not be loaded."), crashmodule);
- e_util_dialog_show
- (_("Enlightenment crashed early on start and has been restarted"),
- _("Enlightenment crashed early on start and has been restarted.<br>"
- "There was an error loading the module named: %s<br><br>"
- "This module has been disabled and will not be loaded."), crashmodule);
- e_module_all_load();
- }
- else
+ zone = e_comp_zone_find_by_ec(ec);
+ if ((!e_client_util_ignored_get(ec)) && e_desk_has_ec(e_desk_current_get(zone), ec))
{
- e_error_message_show
- (_("Enlightenment crashed early on start and has<br>"
- "been restarted. All modules have been disabled<br>"
- "and will not be loaded to help remove any problem<br>"
- "modules from your configuration. The module<br>"
- "configuration dialog should let you select your<br>"
- "modules again.\n"));
- e_util_dialog_show
- (_("Enlightenment crashed early on start and has been restarted"),
- _("Enlightenment crashed early on start and has been restarted.<br>"
- "All modules have been disabled and will not be loaded to help<br>"
- "remove any problem modules from your configuration.<br><br>"
- "The module configuration dialog should let you select your<br>"
- "modules again."));
+ ec->want_focus = ec->take_focus = 1;
+ break;
}
- mod_init_end = ecore_event_handler_add(E_EVENT_MODULE_INIT_END, _e_main_modules_load_after, NULL);
}
}
static Eina_Bool
_e_main_cb_idle_before(void *data EINA_UNUSED)
{
- e_client_idler_before();
+ e_comp_idler_before();
+ _e_main_hook_call(E_MAIN_HOOK_POST_CLIENT_IDLER_BEFORE, NULL);
edje_thaw();
+
return ECORE_CALLBACK_RENEW;
}
eet_clearcache();
edje_freeze();
-#ifdef E_RELEASE_BUILD
if (first_idle)
{
TSM("SLEEP");
first_idle = 0;
- e_precache_end = EINA_TRUE;
- }
-#else
- if (first_idle++ < 60)
- {
- TSM("SLEEP");
- if (!first_idle)
- e_precache_end = EINA_TRUE;
}
-#endif
return ECORE_CALLBACK_RENEW;
}