/
e_main.c
2040 lines (1810 loc) · 58.4 KB
/
e_main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "e.h"
#ifdef __linux__
# include <sys/prctl.h>
#endif
#define MAX_LEVEL 80
#ifdef HAVE_ECORE_IMF
# include <Ecore_IMF.h>
#endif
#define TS_DO
#ifdef TS_DO
# define TS(x) \
{ \
t1 = ecore_time_unix_get(); \
printf("ESTART: %1.5f [%1.5f] - %s\n", t1 - t0, t1 - t2, x); \
t2 = t1; \
}
static double t0, t1, t2;
#else
# define TS(x)
#endif
#ifdef HAVE_ELEMENTARY
#include <Elementary.h>
#endif
#ifdef HAVE_EMOTION
#include <Emotion.h>
#endif
/*
* i need to make more use of these when i'm baffled as to when something is
* up. other hooks:
*
* void *(*__malloc_hook)(size_t size, const void *caller);
*
* void *(*__realloc_hook)(void *ptr, size_t size, const void *caller);
*
* void *(*__memalign_hook)(size_t alignment, size_t size,
* const void *caller);
*
* void (*__free_hook)(void *ptr, const void *caller);
*
* void (*__malloc_initialize_hook)(void);
*
* void (*__after_morecore_hook)(void);
*
static void my_init_hook(void);
static void my_free_hook(void *p, const void *caller);
static void (*old_free_hook)(void *ptr, const void *caller) = NULL;
void (*__free_hook)(void *ptr, const void *caller);
void (*__malloc_initialize_hook) (void) = my_init_hook;
static void
my_init_hook(void)
{
old_free_hook = __free_hook;
__free_hook = my_free_hook;
}
//void *magicfree = NULL;
static void
my_free_hook(void *p, const void *caller)
{
__free_hook = old_free_hook;
// if ((p) && (p == magicfree))
// {
// printf("CAUGHT!!!!! %p ...\n", p);
// abort();
// }
free(p);
__free_hook = my_free_hook;
}
*/
/* local function prototypes */
static void _e_main_shutdown(int errcode);
static void _e_main_shutdown_push(int (*func)(void));
static void _e_main_parse_arguments(int argc, char **argv);
static void _e_main_cb_x_fatal(void *data __UNUSED__);
static Eina_Bool _e_main_cb_signal_exit(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__);
static Eina_Bool _e_main_cb_signal_hup(void *data __UNUSED__, int ev_type __UNUSED__, void *ev __UNUSED__);
static Eina_Bool _e_main_cb_signal_user(void *data __UNUSED__, int ev_type __UNUSED__, void *ev);
static int _e_main_x_shutdown(void);
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_path_shutdown(void);
static void _e_main_test_formats(void);
static int _e_main_screens_init(void);
static int _e_main_screens_shutdown(void);
static void _e_main_desk_save(void);
static void _e_main_desk_restore(E_Manager *man, E_Container *con);
static void _e_main_efreet_paths_init(void);
static void _e_main_modules_load(Eina_Bool safe_mode);
static void _e_main_manage_all(void);
static Eina_Bool _e_main_cb_x_flusher(void *data __UNUSED__);
static Eina_Bool _e_main_cb_idle_before(void *data __UNUSED__);
static Eina_Bool _e_main_cb_idle_after(void *data __UNUSED__);
static Eina_Bool _e_main_cb_startup_fake_end(void *data __UNUSED__);
/* local variables */
static Eina_Bool really_know = EINA_FALSE;
static Eina_Bool locked = EINA_FALSE;
static Eina_Bool inloop = EINA_FALSE;
static jmp_buf x_fatal_buff;
static int _e_main_lvl = 0;
static int(*_e_main_shutdown_func[MAX_LEVEL]) (void);
static Eina_List *_idle_before_list = NULL;
static Ecore_Idle_Enterer *_idle_before = NULL;
static Ecore_Idle_Enterer *_idle_after = NULL;
static Ecore_Idle_Enterer *_idle_flush = NULL;
static Ecore_Event_Handler *mod_init_end = NULL;
/* external variables */
EAPI Eina_Bool e_precache_end = EINA_FALSE;
EAPI Eina_Bool x_fatal = EINA_FALSE;
EAPI Eina_Bool good = EINA_FALSE;
EAPI Eina_Bool evil = EINA_FALSE;
EAPI Eina_Bool starting = EINA_TRUE;
EAPI Eina_Bool stopping = EINA_FALSE;
EAPI Eina_Bool restart = EINA_FALSE;
EAPI Eina_Bool e_nopause = EINA_FALSE;
static Eina_Bool
_xdg_check_str(const char *env, const char *str)
{
const char *p;
size_t len;
len = strlen(str);
for (p = strstr(env, str); p; p++, p = strstr(p, str))
{
if ((!p[len]) || (p[len] == ':')) return EINA_TRUE;
}
return EINA_FALSE;
}
static void
_xdg_data_dirs_augment(void)
{
const char *s;
const char *p = e_prefix_get();
char newpath[PATH_MAX], buf[PATH_MAX + PATH_MAX + 200];
if (!p) return;
s = getenv("XDG_DATA_DIRS");
if (s)
{
Eina_Bool pfxdata, pfx;
pfxdata = !_xdg_check_str(s, e_prefix_data_get());
snprintf(newpath, sizeof(newpath), "%s/share", p);
pfx = !_xdg_check_str(s, newpath);
if (pfxdata || pfx)
{
snprintf(buf, sizeof(buf), "%s%s%s%s%s",
pfxdata ? e_prefix_data_get() : "",
pfxdata ? ":" : "",
pfx ? newpath : "",
pfx ? ":" : "",
s);
e_util_env_set("XDG_DATA_DIRS", buf);
}
}
else
{
snprintf(buf, sizeof(buf), "%s:%s/share:/usr/local/share:/usr/share", e_prefix_data_get(), p);
e_util_env_set("XDG_DATA_DIRS", buf);
}
s = getenv("XDG_CONFIG_DIRS");
snprintf(newpath, sizeof(newpath), "%s/etc/xdg", p);
if (s)
{
if (!_xdg_check_str(s, newpath))
{
snprintf(buf, sizeof(buf), "%s:%s", newpath, s);
e_util_env_set("XDG_CONFIG_DIRS", buf);
}
}
else
{
snprintf(buf, sizeof(buf), "%s:/etc/xdg", newpath);
e_util_env_set("XDG_CONFIG_DIRS", buf);
}
/* set menu prefix so we get our e menu */
if (!getenv("XDG_MENU_PREFIX"))
{
e_util_env_set("XDG_MENU_PREFIX", "moksha-");
}
}
static void
_fix_user_default_edj(void)
{
char buff[PATH_MAX];
/* fix for FOOLS that keep cp'ing default.edj into ~/.e/e/themes */
e_user_dir_concat_static(buff, "themes/default.edj");
if (ecore_file_exists(buff)) ecore_file_unlink(buff);
}
/* externally accessible functions */
int
main(int argc, char **argv)
{
Eina_Bool nostartup = EINA_FALSE;
Eina_Bool safe_mode = EINA_FALSE;
Eina_Bool after_restart = EINA_FALSE;
Eina_Bool waslocked = EINA_FALSE;
double t = 0.0, tstart = 0.0;
char *s = NULL, buff[32], moksha[14];
struct sigaction action;
#ifdef __linux__
# ifdef PR_SET_PTRACER
# ifdef PR_SET_PTRACER_ANY
prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY);
# endif
# endif
#endif
#ifdef TS_DO
t0 = t1 = t2 = ecore_time_unix_get();
#endif
TS("Begin Startup");
/* trap deadly bug signals and allow some form of sane recovery */
/* or ability to gdb attach and debug at this point - better than your */
/* wm/desktop vanishing and not knowing what happened */
if (!getenv("NOTIFY_SOCKET"))
{
TS("Signal Trap");
action.sa_sigaction = e_sigseg_act;
action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
sigaction(SIGSEGV, &action, NULL);
action.sa_sigaction = e_sigill_act;
action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
sigaction(SIGILL, &action, NULL);
action.sa_sigaction = e_sigfpe_act;
action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
sigaction(SIGFPE, &action, NULL);
action.sa_sigaction = e_sigbus_act;
action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
sigaction(SIGBUS, &action, NULL);
action.sa_sigaction = e_sigabrt_act;
action.sa_flags = SA_NODEFER | SA_RESETHAND | SA_SIGINFO;
sigemptyset(&action.sa_mask);
sigaction(SIGABRT, &action, NULL);
TS("Signal Trap Done");
}
t = ecore_time_unix_get();
s = getenv("E_START_TIME");
if ((s) && (!getenv("E_RESTART_OK")))
{
tstart = atof(s);
if ((t - tstart) < 5.0) safe_mode = EINA_TRUE;
}
tstart = t;
snprintf(buff, sizeof(buff), "%1.1f", tstart);
e_util_env_set("E_START_TIME", buff);
if (getenv("E_START_MTRACK"))
e_util_env_set("MTRACK", NULL);
TS("Eina Init");
if (!eina_init())
{
e_error_message_show(_("Moksha cannot initialize Eina!\n"));
_e_main_shutdown(-1);
}
_e_main_shutdown_push(eina_shutdown);
if (!e_log_init())
{
e_error_message_show(_("Moksha could not create a logging domain!\n"));
_e_main_shutdown(-1);
}
#ifdef TS_DO
#undef TS
# define TS(x) \
{ \
t1 = ecore_time_unix_get(); \
printf("ESTART: %1.5f [%1.5f] - %s\n", t1 - t0, t1 - t2, x); \
t2 = t1; \
}
#endif
TS("Eina Init Done");
_e_main_shutdown_push(e_log_shutdown);
TS("Determine Prefix");
if (!e_prefix_determine(argv[0]))
{
fprintf(stderr,
"ERROR: Moksha cannot determine it's installed\n"
" prefix from the system or argv[0].\n"
" This is because it is not on Linux AND has been\n"
" executed strangely. This is unusual.\n");
}
TS("Determine Prefix Done");
/* for debugging by redirecting stdout of e to a log file to tail */
setvbuf(stdout, NULL, _IONBF, 0);
TS("Environment Variables");
if (getenv("E_RESTART")) after_restart = EINA_TRUE;
if (getenv("DESKTOP_STARTUP_ID"))
e_util_env_set("DESKTOP_STARTUP_ID", NULL);
e_util_env_set("E_RESTART_OK", NULL);
snprintf(moksha, 13, "Moksha-%.5s", VERSION);
e_util_env_set("DESKTOP", moksha);
e_util_env_set("XDG_CURRENT_DESKTOP", "Enlightenment");
e_util_env_set("MOKSHA_VERSION", PACKAGE_VERSION);
TS("Environment Variables Done");
TS("Parse Arguments");
_e_main_parse_arguments(argc, argv);
TS("Parse Arguments Done");
/*** Initialize Core EFL Libraries We Need ***/
TS("Eet Init");
if (!eet_init())
{
e_error_message_show(_("Moksha cannot initialize Eet!\n"));
_e_main_shutdown(-1);
}
TS("Eet Init Done");
_e_main_shutdown_push(eet_shutdown);
TS("Ecore Init");
if (!ecore_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore!\n"));
_e_main_shutdown(-1);
}
TS("Ecore Init Done");
_e_main_shutdown_push(ecore_shutdown);
/* Eio's eio_init internally calls efreet_init. Set XDG_MENU_PREFIX here */
/* else efreet's efreet_menu_prefix symbol is set erroneously during eio_init. */
_xdg_data_dirs_augment();
TS("EIO Init");
if (!eio_init())
{
e_error_message_show(_("Moksha cannot initialize EIO!\n"));
_e_main_shutdown(-1);
}
TS("EIO Init Done");
_e_main_shutdown_push(eio_shutdown);
ecore_app_args_set(argc, (const char **)argv);
TS("Ecore Event Handlers");
if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,
_e_main_cb_signal_exit, NULL))
{
e_error_message_show(_("Moksha cannot set up an exit signal handler.\n"
"Perhaps you are out of memory?"));
_e_main_shutdown(-1);
}
if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP,
_e_main_cb_signal_hup, NULL))
{
e_error_message_show(_("Moksha cannot set up a HUP signal handler.\n"
"Perhaps you are out of memory?"));
_e_main_shutdown(-1);
}
if (!ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
_e_main_cb_signal_user, NULL))
{
e_error_message_show(_("Moksha cannot set up a USER signal handler.\n"
"Perhaps you are out of memory?"));
_e_main_shutdown(-1);
}
TS("Ecore Event Handlers Done");
TS("Ecore_File Init");
if (!ecore_file_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore_File!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_File Init Done");
_e_main_shutdown_push(ecore_file_shutdown);
TS("Ecore_Con Init");
if (!ecore_con_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore_Con!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_Con Init Done");
_e_main_shutdown_push(ecore_con_shutdown);
TS("Ecore_Ipc Init");
if (!ecore_ipc_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore_Ipc!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_Ipc Init Done");
_e_main_shutdown_push(ecore_ipc_shutdown);
_idle_before = ecore_idle_enterer_before_add(_e_main_cb_idle_before, NULL);
TS("Ecore_X Init");
if (!ecore_x_init(NULL))
{
e_error_message_show(_("Moksha cannot initialize Ecore_X!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_X Init Done");
_e_main_shutdown_push(_e_main_x_shutdown);
ecore_x_io_error_handler_set(_e_main_cb_x_fatal, NULL);
#ifdef HAVE_ECORE_IMF
TS("Ecore_IMF Init");
if (!ecore_imf_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore_IMF!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_IMF Init Done");
_e_main_shutdown_push(ecore_imf_shutdown);
#endif
TS("Ecore_Evas Init");
if (!ecore_evas_init())
{
e_error_message_show(_("Moksha cannot initialize Ecore_Evas!\n"));
_e_main_shutdown(-1);
}
TS("Ecore_Evas Init Done");
// _e_main_shutdown_push(ecore_evas_shutdown);
#ifdef HAVE_ELEMENTARY
TS("Elementary Init");
if (!elm_init(argc, argv))
{
e_error_message_show(_("Moksha cannot initialize Elementary!\n"));
_e_main_shutdown(-1);
}
TS("Elementary Init Done");
_e_main_shutdown_push(elm_shutdown);
#endif
#ifdef HAVE_EMOTION
TS("Emotion Init");
if (!emotion_init())
{
e_error_message_show(_("Moksha cannot initialize Emotion!\n"));
_e_main_shutdown(-1);
}
TS("Emotion Init Done");
_e_main_shutdown_push((void*)emotion_shutdown);
#endif
/* e doesn't sync to compositor - it should be one */
ecore_evas_app_comp_sync_set(0);
TS("Ecore_Evas Engine Check");
if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_XCB))
{
if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_XLIB))
{
e_error_message_show(_("Moksha found ecore_evas doesn't support the Software X11\n"
"rendering in Evas. Please check your installation of Evas and\n"
"Ecore and check they support the Software X11 rendering engine."));
_e_main_shutdown(-1);
}
}
if (!ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_SOFTWARE_BUFFER))
{
e_error_message_show(_("Moksha found ecore_evas doesn't support the Software Buffer\n"
"rendering in Evas. Please check your installation of Evas and\n"
"Ecore and check they support the Software Buffer rendering engine."));
_e_main_shutdown(-1);
}
TS("Ecore_Evas Engine Check Done");
TS("Edje Init");
if (!edje_init())
{
e_error_message_show(_("Moksha cannot initialize Edje!\n"));
_e_main_shutdown(-1);
}
TS("Edje Init Done");
_e_main_shutdown_push(edje_shutdown);
edje_freeze();
/*** Initialize E Subsystems We Need ***/
TS("E Intl Init");
if (!e_intl_init())
{
e_error_message_show(_("Moksha cannot initialize E_Intl!\n"));
_e_main_shutdown(-1);
}
TS("E Intl Init Done");
_e_main_shutdown_push(e_intl_shutdown);
/* init white box of death alert */
TS("E_Alert Init");
if (!e_alert_init())
{
e_error_message_show(_("Moksha cannot initialize its emergency alert system.\n"
"Have you set your DISPLAY variable?"));
_e_main_shutdown(-1);
}
TS("E_Alert Init Done");
_e_main_shutdown_push(e_alert_shutdown);
TS("E_Hints Init");
e_hints_init();
TS("E_Hints Init Done");
TS("E_Configure Init");
e_configure_init();
TS("E_Configure Init Done");
TS("E Directories Init");
/* setup directories we will be using for configurations storage etc. */
if (!_e_main_dirs_init())
{
e_error_message_show(_("Moksha cannot create directories in your home directory.\n"
"Perhaps you have no home directory or the disk is full?"));
_e_main_shutdown(-1);
}
TS("E Directories Init Done");
_e_main_shutdown_push(_e_main_dirs_shutdown);
TS("E_Filereg Init");
if (!e_filereg_init())
{
e_error_message_show(_("Moksha cannot set up its file registry system.\n"));
_e_main_shutdown(-1);
}
TS("E_Filereg Init Done");
_e_main_shutdown_push(e_filereg_shutdown);
TS("E_Config Init");
if (!e_config_init())
{
e_error_message_show(_("Moksha cannot set up its config system.\n"));
_e_main_shutdown(-1);
}
TS("E_Config Init Done");
_e_main_shutdown_push(e_config_shutdown);
if (e_config->xsettings.match_e17_theme)
{
/* KDE5 applications don't understand anything other then gnome or kde */
/* They expect everyone else to set QT_QPA_PLATFORMTHEME to tell them how */
/* to theme there apps otherwise they use a fallback mode which results in */
/* missing icons and a inability to change the appearance of applications */
/* see https://bugzilla.suse.com/show_bug.cgi?id=920792 for more info. */
/* There are two sensible defaults for this variable, "kde" which will */
/* make apps appear the same as they do if they are run in kde. and gtk2 */
/* which will make kde applications follow the gtk/gnome theme, we have */
/* decided on choosing gtk2 as it means that kde/qt apps will follow the */
/* app and icon theme set in the enlightenment settings dialog. Some users */
/* who wish to use Qt apps without any gnome or gtk usage may choose to */
/* install qt5ct and overwrite this variable with qt5ct and use that to */
/* configure there Qt5 applications. */
e_util_env_set("QT_QPA_PLATFORMTHEME", "gtk2");
e_util_env_set("QT_STYLE_OVERRIDE", "gtk2");
}
_fix_user_default_edj();
/* TS("E_Randr Init");
if (!e_randr_init())
{
e_error_message_show(_("Moksha cannot initialize E_Randr!\n"));
}
else
_e_main_shutdown_push(e_randr_shutdown);
TS("E_Randr Init Done");*/
TS("E_Xinerama Init");
if (!e_xinerama_init())
{
e_error_message_show(_("Moksha cannot initialize E_Xinerama!\n"));
_e_main_shutdown(-1);
}
TS("E_Xinerama Init Done");
_e_main_shutdown_push(e_xinerama_shutdown);
TS("E_Env Init");
if (!e_env_init())
{
e_error_message_show(_("Moksha cannot set up its environment.\n"));
_e_main_shutdown(-1);
}
TS("E_Env Init Done");
_e_main_shutdown_push(e_env_shutdown);
e_util_env_set("E_ICON_THEME", e_config->icon_theme);
ecore_exe_run_priority_set(e_config->priority);
locked |= e_config->desklock_start_locked;
s = getenv("E_DESKLOCK_LOCKED");
if ((s) && (!strcmp(s, "locked"))) waslocked = EINA_TRUE;
TS("E_Scale Init");
if (!e_scale_init())
{
e_error_message_show(_("Moksha cannot set up its scale system.\n"));
_e_main_shutdown(-1);
}
TS("E_Scale Init Done");
_e_main_shutdown_push(e_scale_shutdown);
TS("E_Pointer Init");
if (!e_pointer_init())
{
e_error_message_show(_("Moksha cannot set up its pointer system.\n"));
_e_main_shutdown(-1);
}
TS("E_Pointer Init Done");
_e_main_shutdown_push(e_pointer_shutdown);
TS("E Paths Init");
if (!_e_main_path_init())
{
e_error_message_show(_("Moksha cannot set up paths for finding files.\n"
"Perhaps you are out of memory?"));
_e_main_shutdown(-1);
}
TS("E Paths Init Done");
_e_main_shutdown_push(_e_main_path_shutdown);
TS("E_Ipc Init");
if (!e_ipc_init()) _e_main_shutdown(-1);
TS("E_Ipc Init Done");
_e_main_shutdown_push(e_ipc_shutdown);
edje_frametime_set(1.0 / e_config->framerate);
TS("E_Font Init");
if (!e_font_init())
{
e_error_message_show(_("Moksha cannot set up its font system.\n"));
_e_main_shutdown(-1);
}
TS("E_Font Init Done");
_e_main_shutdown_push(e_font_shutdown);
TS("E_Font Apply");
e_font_apply();
TS("E_Font Apply Done");
TS("E_Canvas Recache");
e_canvas_recache();
TS("E_Canvas Recache Done");
TS("E_Theme Init");
if (!e_theme_init())
{
e_error_message_show(_("Moksha cannot set up its theme system.\n"));
_e_main_shutdown(-1);
}
TS("E_Theme Init Done");
_e_main_shutdown_push(e_theme_shutdown);
TS("E_Moveresize Init");
e_moveresize_init();
TS("E_Moveresize Init Done");
_e_main_shutdown_push(e_moveresize_shutdown);
if (e_config->show_splash)
{
TS("E_Splash Init");
if (!e_init_init())
{
e_error_message_show(_("Moksha cannot set up its init screen.\n"));
_e_main_shutdown(-1);
}
TS("E_Splash Init Done");
_e_main_shutdown_push(e_init_shutdown);
}
if (!((!e_config->show_splash) || (after_restart)))
{
e_init_title_set(_("Moksha"));
e_init_version_set(VERSION);
e_init_show();
pause();
}
if (e_config->show_splash)
e_init_status_set(_("Starting International Support"));
TS("E_Intl Post Init");
if (!e_intl_post_init())
{
e_error_message_show(_("Moksha cannot set up its intl system.\n"));
_e_main_shutdown(-1);
}
TS("E_Intl Post Init Done");
_e_main_shutdown_push(e_intl_post_shutdown);
TS("Efreet Init");
if (!efreet_init())
{
e_error_message_show(_("Moksha cannot initialize the FDO desktop system.\n"
"Perhaps you lack permissions on ~/.cache/efreet or are\n"
"out of memory or disk space?"));
_e_main_shutdown(-1);
}
TS("Efreet Init Done");
_e_main_shutdown_push(efreet_shutdown);
if (!really_know)
{
TS("Test File Format Support");
_e_main_test_formats();
TS("Test File Format Support Done");
}
else
{
efreet_icon_extension_add(".svg");
efreet_icon_extension_add(".jpg");
efreet_icon_extension_add(".png");
efreet_icon_extension_add(".edj");
}
e_screensaver_preinit();
if (e_config->show_splash)
e_init_status_set(_("Setup Screens"));
TS("Screens Init");
if (!_e_main_screens_init())
{
e_error_message_show(_("Moksha set up window management for all the screens on your system\n"
"failed. Perhaps another window manager is running?\n"));
_e_main_shutdown(-1);
}
TS("Screens Init Done");
_e_main_shutdown_push(_e_main_screens_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup ACPI"));
TS("E_Acpi Init");
e_acpi_init();
TS("E_Acpi Init Done");
_e_main_shutdown_push(e_acpi_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Backlight"));
TS("E_Backlight Init");
if (!e_backlight_init())
{
e_error_message_show(_("Moksha cannot configure the backlight.\n"));
_e_main_shutdown(-1);
}
TS("E_Backlight Init Done");
_e_main_shutdown_push(e_backlight_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Powersave Modes"));
TS("E_Powersave Init");
if (!e_powersave_init())
{
e_error_message_show(_("Moksha cannot set up its powersave modes.\n"));
_e_main_shutdown(-1);
}
TS("E_Powersave Init Done");
_e_main_shutdown_push(e_powersave_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Screensaver"));
TS("E_Screensaver Init");
if (!e_screensaver_init())
{
e_error_message_show(_("Moksha cannot configure the X screensaver.\n"));
_e_main_shutdown(-1);
}
TS("E_Screensaver Init Done");
_e_main_shutdown_push(e_screensaver_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup DPMS"));
TS("E_Dpms Init");
if (!e_dpms_init())
{
e_error_message_show(_("Moksha cannot configure the DPMS settings.\n"));
_e_main_shutdown(-1);
}
TS("E_Dpms Init Done");
_e_main_shutdown_push(e_dpms_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Desklock"));
TS("E_Desklock Init");
if (!e_desklock_init())
{
e_error_message_show(_("Moksha cannot set up its desk locking system.\n"));
_e_main_shutdown(-1);
}
TS("E_Desklock Init Done");
_e_main_shutdown_push(e_desklock_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Popups"));
TS("E_Popups Init");
if (!e_popup_init())
{
e_error_message_show(_("Moksha cannot set up its popup system.\n"));
_e_main_shutdown(-1);
}
TS("E_Popups Init Done");
_e_main_shutdown_push(e_popup_shutdown);
if ((locked) && ((!e_config->show_splash) && (!after_restart)))
e_desklock_show(EINA_TRUE);
else if (waslocked)
e_desklock_show(EINA_TRUE);
if (e_config->show_splash)
e_init_status_set(_("Setup Message Bus"));
TS("E_Msgbus Init");
if (e_msgbus_init())
_e_main_shutdown_push(e_msgbus_shutdown);
TS("E_Msgbus Init Done");
if (e_config->show_splash)
e_init_status_set(_("Setup Paths"));
TS("Efreet Paths");
_e_main_efreet_paths_init();
TS("Efreet Paths Done");
if (e_config->show_splash)
e_init_status_set(_("Setup System Controls"));
TS("E_Sys Init");
if (!e_sys_init())
{
e_error_message_show(_("Moksha cannot initialize the System Command system.\n"));
_e_main_shutdown(-1);
}
TS("E_Sys Init Done");
_e_main_shutdown_push(e_sys_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Actions"));
TS("E_Actions Init");
if (!e_actions_init())
{
e_error_message_show(_("Moksha cannot set up its actions system.\n"));
_e_main_shutdown(-1);
}
TS("E_Actions Init Done");
_e_main_shutdown_push(e_actions_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Execution System"));
TS("E_Exec Init");
if (!e_exec_init())
{
e_error_message_show(_("Moksha cannot set up its exec system.\n"));
_e_main_shutdown(-1);
}
TS("E_Exec Init Done");
_e_main_shutdown_push(e_exec_shutdown);
TS("E_Container Freeze");
e_container_all_freeze();
TS("E_Container Freeze Done");
if (e_config->show_splash)
e_init_status_set(_("Setup Filemanager"));
TS("E_Fm2 Init");
if (!e_fm2_init())
{
e_error_message_show(_("Moksha cannot initialize the File manager.\n"));
_e_main_shutdown(-1);
}
TS("E_Fm2 Init Done");
_e_main_shutdown_push(e_fm2_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Message System"));
TS("E_Msg Init");
if (!e_msg_init())
{
e_error_message_show(_("Moksha cannot set up its msg system.\n"));
_e_main_shutdown(-1);
}
TS("E_Msg Init Done");
_e_main_shutdown_push(e_msg_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup DND"));
TS("E_Dnd Init");
if (!e_dnd_init())
{
e_error_message_show(_("Moksha cannot set up its dnd system.\n"));
_e_main_shutdown(-1);
}
TS("E_Dnd Init Done");
_e_main_shutdown_push(e_dnd_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Grab Input Handling"));
TS("E_Grabinput Init");
if (!e_grabinput_init())
{
e_error_message_show(_("Moksha cannot set up its grab input handling system.\n"));
_e_main_shutdown(-1);
}
TS("E_Grabinput Init Done");
_e_main_shutdown_push(e_grabinput_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Modules"));
TS("E_Module Init");
if (!e_module_init())
{
e_error_message_show(_("Moksha cannot set up its module system.\n"));
_e_main_shutdown(-1);
}
TS("E_Module Init Done");
_e_main_shutdown_push(e_module_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Remembers"));
TS("E_Remember Init");
if (!e_remember_init(after_restart ? E_STARTUP_RESTART : E_STARTUP_START))
{
e_error_message_show(_("Moksha cannot setup remember settings.\n"));
_e_main_shutdown(-1);
}
TS("E_Remember Init Done");
_e_main_shutdown_push(e_remember_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Color Classes"));
TS("E_Color_Class Init");
if (!e_color_class_init())
{
e_error_message_show(_("Moksha cannot set up its color class system.\n"));
_e_main_shutdown(-1);
}
TS("E_Color_Class Init Done");
_e_main_shutdown_push(e_color_class_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Gadcon"));
TS("E_Gadcon Init");
if (!e_gadcon_init())
{
e_error_message_show(_("Moksha cannot set up its gadget control system.\n"));
_e_main_shutdown(-1);
}
TS("E_Gadcon Init Done");
_e_main_shutdown_push(e_gadcon_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Wallpaper"));
TS("E_Bg Init");
if (!e_bg_init())
{
e_error_message_show(_("Moksha cannot set up its desktop background system.\n"));
_e_main_shutdown(-1);
}
TS("E_Bg Init Done");
_e_main_shutdown_push(e_bg_shutdown);
if (e_config->show_splash)
e_init_status_set(_("Setup Mouse"));
TS("E_Mouse Init");
if (!e_mouse_update())
{
e_error_message_show(_("Moksha cannot configure the mouse settings.\n"));
_e_main_shutdown(-1);
}