Enlightenment CVS committal Author : dj2 Project : e17 Module : libs/ewl
Dir : e17/libs/ewl/src/lib Modified Files: ewl_callback.c ewl_callback.h ewl_config.h ewl_misc.c ewl_text.c ewl_text.h ewl_window.c Log Message: - cleanup the init function in ewl - remove some globals =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_callback.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -3 -r1.15 -r1.16 --- ewl_callback.c 12 Jan 2006 18:21:18 -0000 1.15 +++ ewl_callback.c 31 Jan 2006 16:37:09 -0000 1.16 @@ -49,7 +49,7 @@ * So using an array for the callbacks saves us about 2MB of memory in this * case. */ -void +int ewl_callbacks_init(void) { DENTER_FUNCTION(DLEVEL_STABLE); @@ -57,7 +57,7 @@ cb_registration = ecore_hash_new(ewl_callback_hash, ewl_callback_compare); - DLEAVE_FUNCTION(DLEVEL_STABLE); + DRETURN_INT(TRUE, DLEVEL_STABLE); } /** @@ -72,7 +72,8 @@ { DENTER_FUNCTION(DLEVEL_STABLE); - ecore_hash_destroy(cb_registration); + if (cb_registration) + ecore_hash_destroy(cb_registration); DLEAVE_FUNCTION(DLEVEL_STABLE); } =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_callback.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- ewl_callback.h 16 Nov 2005 17:13:04 -0000 1.6 +++ ewl_callback.h 31 Jan 2006 16:37:09 -0000 1.7 @@ -114,7 +114,7 @@ w->callbacks[t].mask &= ~EWL_CALLBACK_TYPE_DIRECT -void ewl_callbacks_init(void); +int ewl_callbacks_init(void); void ewl_callbacks_shutdown(void); int ewl_callback_append(Ewl_Widget * widget, Ewl_Callback_Type type, Ewl_Callback_Function func, =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_config.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -3 -r1.5 -r1.6 --- ewl_config.h 17 Dec 2005 21:55:55 -0000 1.5 +++ ewl_config.h 31 Jan 2006 16:37:09 -0000 1.6 @@ -17,10 +17,15 @@ int enable; int level; int indent_lvl; + + int segv; + int backtrace; + int gc_reap; } debug; struct { int font_cache; int image_cache; + int engine; char *render_method; } evas; struct { @@ -30,6 +35,7 @@ int print_keys; int print_signals; } theme; + }; extern Ewl_Config ewl_config; =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_misc.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -3 -r1.42 -r1.43 --- ewl_misc.c 31 Jan 2006 14:45:01 -0000 1.42 +++ ewl_misc.c 31 Jan 2006 16:37:09 -0000 1.43 @@ -13,14 +13,7 @@ /* * Configuration and option related flags. */ -static unsigned int debug_segv = 0; -static unsigned int debug_bt = 0; -static unsigned int use_engine = EWL_ENGINE_ALL; static unsigned int phase_status = 0; -static unsigned int print_theme_keys = 0; -static unsigned int print_theme_signals = 0; -static unsigned int print_gc_reap = 0; -static unsigned int debug_level = 0; static Ecore_Idle_Enterer *idle_enterer = NULL; static Ecore_Idler *ewl_garbage_collect = NULL; @@ -69,7 +62,7 @@ inline void ewl_segv(void) { - if (debug_segv) { + if (ewl_config.debug.segv) { char *null = NULL; *null = '\0'; } @@ -88,7 +81,7 @@ char **strings; size_t i; - if (!debug_bt) return; + if (!ewl_config.debug.backtrace) return; fprintf(stderr, "\n***** Backtrace *****\n"); size = backtrace(array, 128); @@ -118,8 +111,6 @@ if (++ewl_init_count > 1) DRETURN_INT(ewl_init_count, DLEVEL_STABLE); - ewl_init_parse_options(argc, argv); - if (!evas_init()) { DERROR("Could not init evas....\n"); DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); @@ -127,24 +118,37 @@ if (!ecore_init()) { DERROR("Could not init ecore....\n"); + evas_shutdown(); DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } if (!ecore_string_init()) { DERROR("Could not init ecore strings....\n"); + evas_shutdown(); ecore_shutdown(); DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } + if (!ewl_config_init()) { + DERROR("Could not init config data.\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); + } + + /* make sure we have an engine set by default */ + ewl_config.evas.engine = EWL_ENGINE_ALL; + ewl_config.evas.render_method = strdup("software_x11"); + + ewl_init_parse_options(argc, argv); + if (!edje_init()) { DERROR("Could not init edje....\n"); + evas_shutdown(); ecore_string_shutdown(); ecore_shutdown(); DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - - reveal_list = ecore_list_new(); obscure_list = ecore_list_new(); configure_list = ecore_list_new(); @@ -153,105 +157,96 @@ free_evas_list = ecore_list_new(); free_evas_object_list = ecore_list_new(); child_add_list = ecore_list_new(); + if ((!reveal_list) || (!obscure_list) || (!configure_list) + || (!realize_list) || (!destroy_list) + || (!free_evas_list) || (!free_evas_object_list) + || (!child_add_list)) { + DERROR("Unable to create internal configuration, out of memory?\n"); + evas_shutdown(); + ecore_string_shutdown(); + ecore_shutdown(); + edje_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); + } #ifdef ENABLE_EWL_SOFTWARE_X11 /* * Attempt to pick the correct engine by adjusting the bitmask * relative to the success of each engines init routine. */ - if (use_engine & EWL_ENGINE_X11) { + if (ewl_config.evas.engine & EWL_ENGINE_X11) { if (!ecore_x_init(NULL)) - use_engine &= ~EWL_ENGINE_X11; + ewl_config.evas.engine &= ~EWL_ENGINE_X11; else - use_engine &= EWL_ENGINE_X11; + ewl_config.evas.engine &= EWL_ENGINE_X11; } #endif - #ifdef ENABLE_EWL_FB /* * Maybe the X11 engines arent' available or they failed, so see if * we should load up the FB. */ - if (use_engine & EWL_ENGINE_FB) { + if (ewl_config.evas.engine & EWL_ENGINE_FB) { if (!ecore_fb_init(NULL)) - use_engine &= ~EWL_ENGINE_FB; + ewl_config.evas.engine &= ~EWL_ENGINE_FB; else - use_engine &= EWL_ENGINE_FB; + ewl_config.evas.engine &= EWL_ENGINE_FB; } #endif - if (!use_engine) { - fprintf(stderr, "Cannot open display!\n"); + if (!ewl_config.evas.engine) { + DERROR("Cannot open display!\n"); ewl_shutdown(); - DRETURN_INT(ewl_init_count, DLEVEL_STABLE); - } - - if (!ewl_config_init()) { - DERROR("Could not init config data.\n"); - ewl_shutdown(); - DRETURN_INT(ewl_init_count, DLEVEL_STABLE); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } if (!ewl_dnd_init()) { DERROR("Count not init dnd.\n"); ewl_shutdown(); - DRETURN_INT(ewl_init_count, DLEVEL_STABLE); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - -#ifdef ENABLE_EWL_SOFTWARE_X11 - if (use_engine == EWL_ENGINE_SOFTWARE_X11) { - IF_FREE(ewl_config.evas.render_method); - ewl_config.evas.render_method = strdup("software_x11"); - } - else -#endif -#ifdef ENABLE_EWL_GL_X11 - if (use_engine == EWL_ENGINE_GL_X11) { - IF_FREE(ewl_config.evas.render_method); - ewl_config.evas.render_method = strdup("gl_x11"); - } - else -#endif -#ifdef ENABLE_EWL_FB - if (use_engine == EWL_ENGINE_FB) { - IF_FREE(ewl_config.evas.render_method); - ewl_config.evas.render_method = strdup("fb"); + if (!ewl_ev_init()) { + DERROR("Could not init event data.\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - else -#endif - if (!ewl_config.evas.render_method) - ewl_config.evas.render_method = strdup("software_x11"); - - if (print_theme_keys) - ewl_config.theme.print_keys = print_theme_keys; - if (print_theme_signals) - ewl_config.theme.print_signals = print_theme_signals; - - if (debug_level) { - ewl_config.debug.enable = 1; - ewl_config.debug.level = debug_level; + if (!ewl_callbacks_init()) { + DERROR("Could not init callback system.\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - if (!ewl_ev_init()) { - DERROR("Could not init event data.\n"); + if (!ewl_theme_init()) { + DERROR("Could not setup theme system.\n"); ewl_shutdown(); - DRETURN_INT(ewl_init_count, DLEVEL_STABLE); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - ewl_callbacks_init(); + if (!(ewl_embed_list = ecore_list_new())) { + DERROR("Could not allocate embed list, out of memory?\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); + } - if (!ewl_theme_init()) { + if (!(ewl_window_list = ecore_list_new())) { + DERROR("Could not allocate window list, out of memory?\n"); ewl_shutdown(); - DRETURN_INT(ewl_init_count, DLEVEL_STABLE); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); } - ewl_embed_list = ecore_list_new(); - ewl_window_list = ecore_list_new(); - idle_enterer = ecore_idle_enterer_add(ewl_idle_render, NULL); + if (!(idle_enterer = ecore_idle_enterer_add(ewl_idle_render, NULL))) { + DERROR("Could not create idle enterer.\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); + } - ewl_text_context_init(); + if (!ewl_text_context_init()) { + DERROR("Could not init text context system.\n"); + ewl_shutdown(); + DRETURN_INT(--ewl_init_count, DLEVEL_STABLE); + } DRETURN_INT(ewl_init_count, DLEVEL_STABLE); } @@ -284,8 +279,10 @@ ewl_text_context_shutdown(); - ecore_idle_enterer_del(idle_enterer); - idle_enterer = NULL; + if (idle_enterer) { + ecore_idle_enterer_del(idle_enterer); + idle_enterer = NULL; + } /* * Shut down the various EWL subsystems cleanly. @@ -324,17 +321,16 @@ evas_shutdown(); #ifdef ENABLE_EWL_SOFTWARE_X11 - if (use_engine & EWL_ENGINE_X11) + if (ewl_config.evas.engine & EWL_ENGINE_X11) ecore_x_shutdown(); #endif #ifdef ENABLE_EWL_FB - if (use_engine & EWL_ENGINE_FB) + if (ewl_config.evas.engine & EWL_ENGINE_FB) ecore_fb_shutdown(); #endif ecore_string_shutdown(); - ecore_shutdown(); DRETURN_INT(ewl_init_count, DLEVEL_STABLE); @@ -511,11 +507,11 @@ i = 0; while (i < *argc) { if (!strcmp(argv[i], "--ewl-segv")) { - debug_segv = 1; + ewl_config.debug.segv = 1; matched++; } else if (!strcmp(argv[i], "--ewl-backtrace")) { - debug_bt = 1; + ewl_config.debug.backtrace = 1; matched++; } else if (!strcmp(argv[i], "--ewl-theme")) { @@ -526,36 +522,52 @@ matched++; } else if (!strcmp(argv[i], "--ewl-print-theme-keys")) { - print_theme_keys = 1; + ewl_config.theme.print_keys = 1; matched++; } else if (!strcmp(argv[i], "--ewl-print-theme-signals")) { - print_theme_signals = 1; + ewl_config.theme.print_signals = 1; matched++; } else if (!strcmp(argv[i], "--ewl-print-gc-reap")) { - print_gc_reap = 1; + ewl_config.debug.gc_reap = 1; matched++; } +#ifdef ENABLE_EWL_SOFTWARE_X11 else if (!strcmp(argv[i], "--ewl-software-x11")) { - use_engine = EWL_ENGINE_SOFTWARE_X11; + IF_FREE(ewl_config.evas.render_method); + ewl_config.evas.render_method = strdup("software_x11"); + ewl_config.evas.engine = EWL_ENGINE_SOFTWARE_X11; + matched++; } +#endif +#ifdef ENABLE_EWL_GL_X11 else if (!strcmp(argv[i], "--ewl-gl-x11")) { - use_engine = EWL_ENGINE_GL_X11; + IF_FREE(ewl_config.evas.render_method); + ewl_config.evas.render_method = strdup("gl_x11"); + ewl_config.evas.engine = EWL_ENGINE_GL_X11; + matched++; } +#endif +#ifdef ENABLE_EWL_FB else if (!strcmp(argv[i], "--ewl-fb")) { - use_engine = EWL_ENGINE_FB; + IF_FREE(ewl_config.evas.render_method); + ewl_config.evas.render_method = strdup("fb"); + ewl_conifg.evas.engine = EWL_ENGINE_FB; + matched++; } +#endif else if (!strcmp(argv[i], "--ewl-debug")) { if (i + i < *argc) { - debug_level = atoi(argv[i + 1]); + ewl_config.debug.level = atoi(argv[i + 1]); matched++; } else { - debug_level = 1; + ewl_config.debug.level = 1; } + ewl_config.debug.enable = 1; matched ++; } else if (!strcmp(argv[i], "--ewl-help")) { @@ -908,7 +920,7 @@ { DENTER_FUNCTION(DLEVEL_STABLE); - DRETURN_INT(use_engine, DLEVEL_STABLE); + DRETURN_INT(ewl_config.evas.engine, DLEVEL_STABLE); } void @@ -989,7 +1001,7 @@ cleanup = 0; - if (print_gc_reap) + if (ewl_config.debug.gc_reap) printf("---\n"); while ((cleanup < EWL_GC_LIMIT) && @@ -1003,7 +1015,7 @@ FREE(w); cleanup++; } - if (print_gc_reap) + if (ewl_config.debug.gc_reap) printf("Destroyed %d EWL objects\n", cleanup); cleanup = 0; @@ -1012,7 +1024,7 @@ evas_object_del(obj); cleanup++; } - if (print_gc_reap) + if (ewl_config.debug.gc_reap) printf("Destroyed %d Evas Objects\n", cleanup); cleanup = 0; @@ -1021,10 +1033,10 @@ evas_free(evas); cleanup++; } - if (print_gc_reap) + if (ewl_config.debug.gc_reap) printf("Destroyed %d Evas\n", cleanup); - if (print_gc_reap) + if (ewl_config.debug.gc_reap) printf("---\n"); if (!ecore_list_nodes(destroy_list)) =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.c,v retrieving revision 1.85 retrieving revision 1.86 diff -u -3 -r1.85 -r1.86 --- ewl_text.c 12 Jan 2006 18:21:19 -0000 1.85 +++ ewl_text.c 31 Jan 2006 16:37:09 -0000 1.86 @@ -3533,7 +3533,7 @@ /* * Ewl_Text_Context Stuff */ -void +int ewl_text_context_init(void) { DENTER_FUNCTION(DLEVEL_STABLE); @@ -3545,7 +3545,7 @@ ecore_hash_set_free_value(context_hash, ewl_text_context_cb_free); } - DLEAVE_FUNCTION(DLEVEL_STABLE); + DRETURN_INT(TRUE, DLEVEL_STABLE); } void =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_text.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- ewl_text.h 12 Jan 2006 18:21:19 -0000 1.28 +++ ewl_text.h 31 Jan 2006 16:37:09 -0000 1.29 @@ -299,7 +299,7 @@ unsigned int ref_count; }; -void ewl_text_context_init(void); +int ewl_text_context_init(void); void ewl_text_context_shutdown(void); Ewl_Text_Context *ewl_text_context_new(void); =================================================================== RCS file: /cvsroot/enlightenment/e17/libs/ewl/src/lib/ewl_window.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- ewl_window.c 12 Jan 2006 18:21:19 -0000 1.27 +++ ewl_window.c 31 Jan 2006 16:37:09 -0000 1.28 @@ -676,10 +676,10 @@ */ #ifdef ENABLE_EWL_SOFTWARE_X11 if (strstr(render, "x11") && - (ewl_engine_mask_get() & (EWL_ENGINE_SOFTWARE_X11 | - EWL_ENGINE_GL_X11))) { + (ewl_engine_mask_get() & EWL_ENGINE_X11)) { int width, height; Ecore_X_Window xwin; + if (window->flags & EWL_WINDOW_OVERRIDE) { xwin = ecore_x_window_override_new(0, window->x, window->y, ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs