Example #1
0
/**
 * Set up connections, signal handlers, sockets etc.
 * @return 1 or greater on success, 0 otherwise
 *
 * This function sets up all singal handlers and the basic event loop. If it
 * succeeds, 1 will be returned, otherwise 0 will be returned.
 *
 * @code
 * #include <Ecore.h>
 *
 * int main(int argc, char **argv)
 * {
 *   if (!ecore_init())
 *   {
 *     printf("ERROR: Cannot init Ecore!\n");
 *     return -1;
 *   }
 *   ecore_main_loop_begin();
 *   ecore_shutdown();
 * }
 * @endcode
 */
EAPI int ecore_init(void)
{
	if (++_ecore_init_count != 1)
		return _ecore_init_count;

#ifdef HAVE_LOCALE_H
	setlocale(LC_CTYPE, "");
#endif
	/*
	   if (strcmp(nl_langinfo(CODESET), "UTF-8"))
	   {
	   WRN("Not a utf8 locale!");
	   }
	 */
#ifdef HAVE_EVIL
	if (!evil_init())
		return --_ecore_init_count;
#endif
	if (!eina_init())
		goto shutdown_evil;
	_ecore_log_dom =
	    eina_log_domain_register("Ecore", ECORE_DEFAULT_LOG_COLOR);
	if (_ecore_log_dom < 0) {
		EINA_LOG_ERR("Ecore was unable to create a log domain.");
		goto shutdown_log_dom;
	}
	if (getenv("ECORE_FPS_DEBUG"))
		_ecore_fps_debug = 1;
	if (_ecore_fps_debug)
		_ecore_fps_debug_init();
	_ecore_main_loop_init();
	_ecore_signal_init();
	_ecore_exe_init();
	_ecore_thread_init();
	_ecore_glib_init();
	_ecore_job_init();
	_ecore_time_init();

#if HAVE_MALLINFO
	if (getenv("ECORE_MEM_STAT")) {
		_ecore_memory_pid = getpid();
		ecore_animator_add(_ecore_memory_statistic, NULL);
	}
#endif

#if defined(GLIB_INTEGRATION_ALWAYS)
	if (_ecore_glib_always_integrate)
		ecore_main_loop_glib_integrate();
#endif

	return _ecore_init_count;

      shutdown_log_dom:
	eina_shutdown();
      shutdown_evil:
#ifdef HAVE_EVIL
	evil_shutdown();
#endif
	return --_ecore_init_count;
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
   if (!ecore_main_loop_glib_integrate())
    {
       printf("Cannot integrate with glib main loop");
       return -1;
    }

#if !GLIB_CHECK_VERSION(2,35,0)
   g_type_init();
#endif

   Evas_Object *win;

   win = elm_win_add(NULL, WINDOW_TEST_TITLE, ELM_WIN_BASIC);
   elm_win_title_set(win, WINDOW_TEST_TITLE);
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
   elm_win_autodel_set(win, EINA_TRUE );

   evas_object_smart_callback_add(win, "focus,in", on_focus_in, NULL);
   initialize_and_show_tooltip(win);

   evas_object_resize(win, 320, 320);
   /* and show the window */
   evas_object_show(win);

   elm_run();
   elm_shutdown();

   /* exit code */
   return 0;
}
Example #3
0
static Eina_Bool
im_module_init(void)
{
    ecore_main_loop_glib_integrate();
    ibus_init();
    ecore_imf_module_register(&ibus_im_info, im_module_create, im_module_exit);

    return EINA_TRUE;
}
WK_EXPORT int NetworkProcessMain(int argc, char* argv[])
{
    if (argc != 2)
        return 1;

#if PLATFORM(EFL)
    if (!ecore_init())
        return 1;

    if (!ecore_main_loop_glib_integrate())
        return 1;
#endif

    InitializeWebKit2();

#if USE(SOUP)
    SoupSession* session = ResourceHandle::defaultSession();
#if PLATFORM(EFL)
    // Only for EFL because GTK port uses the default resolver, which uses GIO's proxy resolver.
    const char* httpProxy = getenv("http_proxy");
    if (httpProxy) {
        const char* noProxy = getenv("no_proxy");
        GRefPtr<SoupProxyURIResolver> resolver = adoptGRef(soupProxyResolverWkNew(httpProxy, noProxy));
        soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolver.get()));
    }
#endif
#endif

    int socket = atoi(argv[1]);

    WebKit::ChildProcessInitializationParameters parameters;
    parameters.connectionIdentifier = int(socket);

    NetworkProcess::shared().initialize(parameters);

#if USE(SOUP)
    // Despite using system CAs to validate certificates we're
    // accepting invalid certificates by default. New API will be
    // added later to let client accept/discard invalid certificates.
    g_object_set(session, SOUP_SESSION_SSL_USE_SYSTEM_CA_FILE, TRUE,
        SOUP_SESSION_SSL_STRICT, FALSE, NULL);
#endif

    RunLoop::run();

#if USE(SOUP)
    if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
        soup_cache_flush(SOUP_CACHE(soupCache));
        soup_cache_dump(SOUP_CACHE(soupCache));
    }
#endif

    return 0;
}
    bool platformInitialize() override
    {
        if (!eina_init())
            return false;

        if (!ecore_init()) {
            // Could not init ecore.
            eina_shutdown();
            return false;
        }

#ifdef HAVE_ECORE_X
        XSetExtensionErrorHandler(dummyExtensionErrorHandler);

        if (!ecore_x_init(0)) {
            // Could not init ecore_x.
            // PlatformScreenEfl and systemBeep() functions
            // depend on ecore_x functionality.
            ecore_shutdown();
            eina_shutdown();
            return false;
        }
#endif

        if (!ecore_evas_init()) {
#ifdef HAVE_ECORE_X
            ecore_x_shutdown();
#endif
            ecore_shutdown();
            eina_shutdown();
            return false;
        }

        if (!edje_init()) {
            ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
            ecore_x_shutdown();
#endif
            ecore_shutdown();
            eina_shutdown();
            return false;
        }

        if (!ecore_main_loop_glib_integrate())
            return false;

        SoupNetworkSession::defaultSession().setupHTTPProxyFromEnvironment();
        return true;
    }
Example #6
0
static Eina_Bool
im_module_init(void)
{
   const char *s;

   if (!getenv("DISPLAY")) return EINA_FALSE;
   if ((s = getenv("ELM_DISPLAY")))
     {
        if (strcmp(s, "x11")) return EINA_FALSE;
     }
   ecore_main_loop_glib_integrate();
   ibus_init();
   ecore_imf_module_register(&ibus_im_info, im_module_create, im_module_exit);

   return EINA_TRUE;
}
Example #7
0
int ewk_init(void)
{
    if (_ewkInitCount)
        return ++_ewkInitCount;

    if (!eina_init())
        goto error_eina;

    _ewk_log_dom = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE);
    if (_ewk_log_dom < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit2'");
        goto error_log_domain;
    }

    if (!evas_init()) {
        CRITICAL("could not init evas.");
        goto error_evas;
    }

    if (!ecore_init()) {
        CRITICAL("could not init ecore.");
        goto error_ecore;
    }

    if (!ecore_evas_init()) {
        CRITICAL("could not init ecore_evas.");
        goto error_ecore_evas;
    }

    if (!ecore_imf_init()) {
        CRITICAL("could not init ecore_imf.");
        goto error_ecore_imf;
    }

    if (!efreet_init()) {
        CRITICAL("could not init efreet.");
        goto error_efreet;
    }

#ifdef HAVE_ECORE_X
    if (!ecore_x_init(0)) {
        CRITICAL("could not init ecore_x.");
        goto error_ecore_x;
    }
#endif

    if (!edje_init()) {
        CRITICAL("Could not init edje.");
        goto error_edje;
    }

    if (!ecore_main_loop_glib_integrate()) {
        WARN("Ecore was not compiled with GLib support, some plugins will not "
            "work (ie: Adobe Flash)");
    }

    return ++_ewkInitCount;

error_edje:
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
error_ecore_x:
#else
    efreet_shutdown();
#endif
error_efreet:
    ecore_imf_shutdown();
error_ecore_imf:
    ecore_evas_shutdown();
error_ecore_evas:
    ecore_shutdown();
error_ecore:
    evas_shutdown();
error_evas:
    eina_log_domain_unregister(_ewk_log_dom);
    _ewk_log_dom = -1;
error_log_domain:
    eina_shutdown();
error_eina:
    return 0;
}
Example #8
0
WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
{
    // WebProcess should be launched with an option.
    if (argc != 2)
        return 1;

    if (!eina_init())
        return 1;

    if (!ecore_init()) {
        // Could not init ecore.
        eina_shutdown();
        return 1;
    }

#ifdef HAVE_ECORE_X
    XSetExtensionErrorHandler(dummyExtensionErrorHandler);

    if (!ecore_x_init(0)) {
        // Could not init ecore_x.
        // PlatformScreenEfl and systemBeep() functions
        // depend on ecore_x functionality.
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }
#endif

#if !GLIB_CHECK_VERSION(2, 35, 0)
    g_type_init();
#endif

    if (!ecore_main_loop_glib_integrate())
        return 1;

    JSC::initializeThreading();
    WTF::initializeMainThread();

    RunLoop::initializeMainRunLoop();

    SoupSession* session = WebCore::ResourceHandle::defaultSession();
    const char* httpProxy = getenv("http_proxy");
    if (httpProxy) {
        const char* noProxy = getenv("no_proxy");
        SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy);
        soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl));
        g_object_unref(resolverEfl);
    }

    // Set SOUP cache.
    String soupCacheDirectory = String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl";
    SoupCache* soupCache = soup_cache_new(soupCacheDirectory.utf8().data(), SOUP_CACHE_SINGLE_USER);
    soup_session_add_feature(session, SOUP_SESSION_FEATURE(soupCache));
    soup_cache_load(soupCache);

    int socket = atoi(argv[1]);

    ChildProcessInitializationParameters parameters;
    parameters.connectionIdentifier = socket;

    WebProcess::shared().initialize(parameters);

    RunLoop::run();

    soup_cache_flush(soupCache);
    soup_cache_dump(soupCache);
    g_object_unref(soupCache);

    ecore_x_shutdown();
    ecore_shutdown();
    eina_shutdown();

    return 0;

}
Example #9
0
int ewk_init(void)
{
    if (_ewk_init_count)
        return ++_ewk_init_count;

    if (!eina_init())
        goto error_eina;

    _ewk_log_dom = eina_log_domain_register("ewebkit", EINA_COLOR_ORANGE);
    if (_ewk_log_dom < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit'");
        goto error_log_domain;
    }

    if (!evas_init()) {
        CRITICAL("could not init evas.");
        goto error_evas;
    }

    if (!ecore_init()) {
        CRITICAL("could not init ecore.");
        goto error_ecore;
    }

    if (!ecore_evas_init()) {
        CRITICAL("could not init ecore_evas.");
        goto error_ecore_evas;
    }

    if (!edje_init()) {
        CRITICAL("could not init edje.");
        goto error_edje;
    }

#ifdef ENABLE_GLIB_SUPPORT
    g_type_init();

    if (!g_thread_supported())
        g_thread_init(0);

#ifdef ENABLE_GTK_PLUGINS_SUPPORT
    gdk_threads_init();
    if (!gtk_init_check(0, 0))
        WRN("Could not initialize GTK support.");
#endif

    if (!ecore_main_loop_glib_integrate())
        WRN("Ecore was not compiled with GLib support, some plugins will not "
            "work (ie: Adobe Flash)");
#endif

    JSC::initializeThreading();
    WTF::initializeMainThread();
    WebCore::InitializeLoggingChannelsIfNecessary();

    // Page cache capacity (in pages). Comment from Mac port:
    // (Research indicates that value / page drops substantially after 3 pages.)
    // FIXME: Expose this with an API and/or calculate based on available resources
    WebCore::pageCache()->setCapacity(3);
    WebCore::PageGroup::setShouldTrackVisitedLinks(true);

    // TODO: this should move to WebCore, already reported to webkit-gtk folks:
    if (1) {
        SoupSession* session = WebCore::ResourceHandle::defaultSession();
        soup_session_add_feature_by_type(session, SOUP_TYPE_CONTENT_SNIFFER);
    }

    return ++_ewk_init_count;

error_edje:
    ecore_evas_shutdown();
error_ecore_evas:
    ecore_shutdown();
error_ecore:
    evas_shutdown();
error_evas:
    eina_log_domain_unregister(_ewk_log_dom);
    _ewk_log_dom = -1;
error_log_domain:
    eina_shutdown();
error_eina:
    return 0;
}
WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
{
    // WebProcess should be launched with an option.
    if (argc != 2)
        return 1;

    if (!eina_init())
        return 1;

    if (!ecore_init()) {
        // Could not init ecore.
        eina_shutdown();
        return 1;
    }

#ifdef HAVE_ECORE_X
    XSetExtensionErrorHandler(dummyExtensionErrorHandler);

    if (!ecore_x_init(0)) {
        // Could not init ecore_x.
        // PlatformScreenEfl and systemBeep() functions
        // depend on ecore_x functionality.
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }
#endif

    if (!ecore_evas_init()) {
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }

    if (!edje_init()) {
        ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
        ecore_x_shutdown();
#endif
        ecore_shutdown();
        eina_shutdown();
        return 1;
    }

#if !GLIB_CHECK_VERSION(2, 35, 0)
    g_type_init();
#endif

    if (!ecore_main_loop_glib_integrate())
        return 1;

    InitializeWebKit2();

    SoupSession* session = WebCore::ResourceHandle::defaultSession();
    const char* httpProxy = getenv("http_proxy");
    if (httpProxy) {
        const char* noProxy = getenv("no_proxy");
        SoupProxyURIResolver* resolverEfl = soupProxyResolverWkNew(httpProxy, noProxy);
        soup_session_add_feature(session, SOUP_SESSION_FEATURE(resolverEfl));
        g_object_unref(resolverEfl);
    }

    int socket = atoi(argv[1]);

    ChildProcessInitializationParameters parameters;
    parameters.connectionIdentifier = socket;

    WebProcess::shared().initialize(parameters);

    RunLoop::run();

    if (SoupSessionFeature* soupCache = soup_session_get_feature(session, SOUP_TYPE_CACHE)) {
        soup_cache_flush(SOUP_CACHE(soupCache));
        soup_cache_dump(SOUP_CACHE(soupCache));
    }

    edje_shutdown();
    ecore_evas_shutdown();
#ifdef HAVE_ECORE_X
    ecore_x_shutdown();
#endif
    ecore_shutdown();
    eina_shutdown();

    return 0;

}
Example #11
0
int EwkMain::initialize()
{
    if (m_initCount)
        return ++m_initCount;

    if (!eina_init()) {
        EINA_LOG_CRIT("could not init eina.");
        return 0;
    }

    m_logDomainId = eina_log_domain_register("ewebkit2", EINA_COLOR_ORANGE);
    if (m_logDomainId < 0) {
        EINA_LOG_CRIT("could not register log domain 'ewebkit2'");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EinaLog);
        return 0;
    }

    if (!evas_init()) {
        CRITICAL("could not init evas.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Evas);
        return 0;
    }

    if (!ecore_init()) {
        CRITICAL("could not init ecore.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Ecore);
        return 0;
    }

    if (!ecore_evas_init()) {
        CRITICAL("could not init ecore_evas.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreEvas);
        return 0;
    }

    if (!ecore_imf_init()) {
        CRITICAL("could not init ecore_imf.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreImf);
        return 0;
    }

    if (!efreet_init()) {
        CRITICAL("could not init efreet.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Efreet);
        return 0;
    }

#ifdef HAVE_ECORE_X
    if (!ecore_x_init(0)) {
        CRITICAL("could not init ecore_x.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::EcoreX);
        return 0;
    }
#endif

    if (!edje_init()) {
        CRITICAL("Could not init edje.");
        shutdownInitializedEFLModules(EFLModuleInitFailure::Edje);
        return 0;
    }

    if (!ecore_main_loop_glib_integrate()) {
        WARN("Ecore was not compiled with GLib support, some plugins will not "
            "work (ie: Adobe Flash)");
    }

    return ++m_initCount;
}