int main(int argc, char **argv) { struct context ctxt = {0}; if (!ecore_init()) { printf("ERROR: Cannot init Ecore!\n"); return -1; } _event_type = ecore_event_type_new(); ctxt.enterer = ecore_idle_enterer_add(_enterer_cb, &ctxt); ctxt.exiter = ecore_idle_exiter_add(_exiter_cb, &ctxt); // ctxt.idler = ecore_idler_add(_idler_cb, &ctxt); ctxt.idler = eo_add_custom(ECORE_IDLER_CLASS, NULL, ecore_idler_constructor(_idler_cb, &ctxt)); ctxt.handler = ecore_event_handler_add(_event_type, _event_handler_cb, &ctxt); ctxt.timer = ecore_timer_add(0.0005, _timer_cb, &ctxt); ecore_main_loop_begin(); ecore_shutdown(); return 0; }
static void enable_idlers() { if ( idle_enterer == NULL ) idle_enterer = ecore_idle_enterer_add( idle_in_cb, NULL ); if ( idle_exiter == NULL ) idle_exiter = ecore_idle_exiter_add( idle_out_cb, NULL ); }
static Eina_Bool _on_exiter(__UNUSED__ void *data) { e_connman_system_shutdown(); ecore_idle_enterer_add(_quit, NULL); exiter = NULL; return ECORE_CALLBACK_CANCEL; }
void EventManager::appendEvent(const CalaosEvent &ev) { if (ev.getType() == CalaosEvent::EventUnkown) { cWarning() << "Event type Unkown added to queue, dropping..."; return; } if (eventsQueue.empty()) { //start idler if it was stopped idler = ecore_idle_enterer_add(EventManager_event_idler, this); } eventsQueue.push(ev); }
/*----------------------------------------------------------------------------* * Base Type functions * *----------------------------------------------------------------------------*/ static void _ctor(Ekeko_Object *o) { Eon_Document *d; Eon_Document_Private *prv = PRIVATE(d); d = (Eon_Document *)o; /* FIXME do we need a single idler or better one idler per document? */ if (!_idler) { /* this idler will process every child */ _idler = ecore_idle_enterer_add(_idler_cb, d); } d->prv = prv = ekeko_type_instance_private_get(_document_type_get(), o); /* setup the animation system */ prv->etch = etch_new(); etch_timer_fps_set(prv->etch, 30); prv->anim_cb = ecore_timer_add(1.0f/30.0f, _animation_cb, d); /* the id system */ prv->ids = eina_hash_string_superfast_new(NULL); /* the event listeners */ ekeko_event_listener_add(o, EKEKO_EVENT_OBJECT_APPEND, _child_appended, EINA_FALSE, NULL); }
EAPI void e_popup_show(E_Popup *pop) { E_OBJECT_CHECK(pop); E_OBJECT_TYPE_CHECK(pop, E_POPUP_TYPE); if (pop->visible) return; pop->visible = 1; if ((pop->shaped) && (!e_config->use_composite)) { ecore_evas_move(pop->ecore_evas, pop->zone->container->manager->w, pop->zone->container->manager->h); ecore_evas_show(pop->ecore_evas); if (pop->idle_enterer) ecore_idle_enterer_del(pop->idle_enterer); pop->idle_enterer = ecore_idle_enterer_add(_e_popup_idle_enterer, pop); } else { ecore_evas_show(pop->ecore_evas); if (!(pop->shaped && e_config->use_composite)) e_container_shape_show(pop->shape); } }
void shell_init(void) { /* ecore_display_init(NULL); ecore_event_signal_init(); ecore_event_filter_init(); ecore_event_x_init(); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_EXPOSE, ecore_window_expose); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_MOVE, ecore_mouse_move); ecore_event_filter_handler_add(ECORE_EVENT_WINDOW_CONFIGURE, ecore_window_configure); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_DOWN, ecore_mouse_down); ecore_event_filter_handler_add(ECORE_EVENT_MOUSE_UP, ecore_mouse_up); ecore_event_filter_handler_add(ECORE_EVENT_KEY_DOWN, ecore_key_down); */ ecore_idle_enterer_add(ecore_idle, NULL); create_view(); drawing_load(); }
static void _e_mod_run_cb(void *data, E_Menu *m, E_Menu_Item *mi) { ecore_idle_enterer_add(_e_mod_run_defer_cb, m->zone); }
/** * @brief Does the same thing as etk_init() except you can specify custom arguments that could be then retrieved with * etk_argument_* functions. For example, etk_init_full(argc, argv, "--option1 value --toggle1") * @param argc the location of the "argc" parameter passed to main(). It is used to parse the arguments specific to Etk. * It can be set to NULL. * @param argv the location of the "argv" parameter passed to main(). It is used to parse the arguments specific to Etk. * It can be set to NULL. * @param custom_opts a string corresponding to the custom arguments to add to argv. It can be set to NULL * @return Returns the number of times Etk has been initialized, or 0 on failure * @note It initializes Evas, Ecore and Edje so you don't need to initialize them after an etk_init() * @see etk_init() * @see etk_shutdown() */ int etk_init_full(int argc, char **argv, const char *custom_opts) { char *engine_name = NULL; if (_etk_main_init_count > 0) { _etk_main_init_count++; return _etk_main_init_count; } else { /* Parse the arguments */ etk_argument_init(argc, argv, custom_opts); etk_argument_value_get("etk-engine", 0, ETK_TRUE, &engine_name); /* Initialize the EFL */ if (!evas_init()) { ETK_WARNING("Evas initialization failed!"); return 0; } if (!ecore_init()) { ETK_WARNING("Ecore initialization failed!"); return 0; } if (!ecore_imf_init()) { ETK_WARNING("Ecore_IMF initialization failed!"); } if (!edje_init()) { ETK_WARNING("Edje initialization failed!"); return 0; } /* TODO: maybe we should do this in etk_main(). * Problem: if we do this, a program that uses directly ecore_main_loop_begin() and not etk_main() won't work */ _etk_main_idle_enterer = ecore_idle_enterer_add(_etk_main_idle_enterer_cb, NULL); /* Initialize the subsystems of Etk */ if (!etk_config_init()) { ETK_WARNING("Etk_Config initialization failed!"); return 0; } etk_config_load(); etk_theme_init(); if (!etk_engine_init()) { ETK_WARNING("Etk_Engine initialization failed!"); return 0; } if (!etk_engine_load(engine_name ? engine_name : "ecore_evas_software_x11")) { ETK_WARNING("Etk can not load the requested engine!"); return 0; } etk_event_init(); etk_tooltips_init(); /* Initialize Gettext */ setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); free(engine_name); _etk_main_init_count++; return _etk_main_init_count; } }
/** * @param argc: the argc passed into the main function * @param argv: the argv passed into the main function * @return Returns 1 or greater on success, 0 otherwise. * @brief Initialize the internal variables of ewl to begin the program * * Sets up necessary internal variables for executing ewl * functions. This should be called before any other ewl functions are used. */ int ewl_init(int *argc, char **argv) { const char *locale; DENTER_FUNCTION(DLEVEL_STABLE); /* check if we are already initialized */ if (++ewl_init_count > 1) DRETURN_INT(ewl_init_count, DLEVEL_STABLE); /* set the locale for string collation if it isn't already set */ locale = setlocale(LC_COLLATE, NULL); if (strcmp(locale, "C") || strcmp(locale, "POSIX")) { setlocale(LC_COLLATE, ""); } shutdown_queue = ecore_list_new(); if (!shutdown_queue) { fprintf(stderr, "Could not create Ewl shutdown queue.\n"); goto FAILED; } if (!ecore_init()) { fprintf(stderr, "Could not initialize Ecore.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ecore_shutdown); #ifdef BUILD_EFREET_SUPPORT if (!efreet_init()) { fprintf(stderr, "Could not initialize Efreet.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, efreet_shutdown); if (!efreet_mime_init()) { fprintf(stderr, "Could not initialize Efreet_Mime.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, efreet_mime_shutdown); #endif if (!ecore_string_init()) { fprintf(stderr, "Could not initialize Ecore Strings.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ecore_string_shutdown); reveal_list = ecore_list_new(); obscure_list = ecore_list_new(); configure_active = ecore_list_new(); configure_available = ecore_list_new(); realize_list = ecore_list_new(); destroy_list = ecore_list_new(); free_evas_list = ecore_list_new(); free_evas_object_list = ecore_list_new(); child_add_list = ecore_list_new(); ewl_embed_list = ecore_list_new(); ewl_window_list = ecore_list_new(); shutdown_hooks = ecore_list_new(); if ((!reveal_list) || (!obscure_list) || (!configure_active) || (!configure_available) || (!realize_list) || (!destroy_list) || (!free_evas_list) || (!free_evas_object_list) || (!child_add_list) || (!ewl_embed_list) || (!ewl_window_list) || (!shutdown_hooks)) { fprintf(stderr, "Unable to initialize internal configuration." " Out of memory?\n"); goto FAILED; } /* * Cleanup the queue buffers when the management lists get freed. */ ecore_list_free_cb_set(configure_active, free); ecore_list_free_cb_set(configure_available, free); if (!ewl_system_directories_init()) { fprintf(stderr, "Could not initialize the system" " directories.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_system_directories_shutdown); /* now that the directories are init we can also set the text domain */ #ifdef ENABLE_NLS bindtextdomain(PACKAGE, ewl_system_directory_get(EWL_DIRECTORY_LOCALE)); bind_textdomain_codeset(PACKAGE, "UTF-8"); #endif if (!ewl_config_init()) { fprintf(stderr, "Could not initialize Ewl Config.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_config_shutdown); if (!ewl_engines_init()) { fprintf(stderr, "Could not intialize Ewl Engines.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_engines_shutdown); /* handle any command line options */ ewl_init_parse_options(argc, argv); /* initialize this _after_ we've handled the command line options */ ewl_config_cache_init(); /* we create the engine we will be working with here so that it is * initialized before we start to use it. */ if (!ewl_engine_new(ewl_config_string_get(ewl_config, EWL_CONFIG_ENGINE_NAME), argc, argv)) { fprintf(stderr, "Could not initialize Ewl Engine.\n"); goto FAILED; } if (!ewl_callbacks_init()) { fprintf(stderr, "Could not initialize Ewl Callback system.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_callbacks_shutdown); /* allocate the two window callbacks */ EWL_CALLBACK_EXPOSE = ewl_callback_type_add(); EWL_CALLBACK_DELETE_WINDOW = ewl_callback_type_add(); /* allocate the mvc callback */ EWL_CALLBACK_MVC_CLICKED = ewl_callback_type_add(); if (!ewl_theme_init()) { fprintf(stderr, "Could not setup Ewl Theme system.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_theme_shutdown); if (!ewl_icon_theme_init()) { fprintf(stderr, "Could not initialize Ewl Icon Theme system.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_icon_theme_shutdown); if (!ewl_dnd_init()) { fprintf(stderr, "Could not initialize Ewl DND support.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_dnd_shutdown); if (!ewl_io_manager_init()) { fprintf(stderr, "Could not initialize Ewl IO Manager.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_io_manager_shutdown); if (!ewl_text_context_init()) { fprintf(stderr, "Could not initialize Ewl Text Context system.\n"); goto FAILED; } ecore_list_prepend(shutdown_queue, ewl_text_context_shutdown); if (!(idle_enterer = ecore_idle_enterer_add(ewl_idle_render, NULL))) { fprintf(stderr, "Could not create Idle Enterer.\n"); goto FAILED; } DRETURN_INT(ewl_init_count, DLEVEL_STABLE); FAILED: ewl_shutdown(); DRETURN_INT(ewl_init_count, DLEVEL_STABLE); }
void gui_event_callback (entropy_notify_event * eevent, void *requestor, void *ret, void *user_data) { entropy_gui_component_instance *comp = (entropy_gui_component_instance *) user_data; switch (eevent->event_type) { case ENTROPY_NOTIFY_FILELIST_REQUEST_EXTERNAL: case ENTROPY_NOTIFY_FILELIST_REQUEST:{ event_idle_processor *proc = entropy_malloc (sizeof (event_idle_processor)); entropy_generic_file *event_file; entropy_file_request *request = eevent->data; /*A file request's data is the dest dir */ entropy_icon_viewer *view = comp->data; Ecore_Hash *tmp_gui_hash; Ecore_Hash *tmp_icon_hash; printf ("Icon viewer got a directory change order!\n"); /*Keep a reference to our existing hash */ tmp_gui_hash = view->gui_hash; tmp_icon_hash = view->icon_hash; view->gui_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); view->icon_hash = ecore_hash_new (ecore_direct_hash, ecore_direct_compare); /*Terminate our last load if we are still going...Not the most elegant solution, but there can only be 1 at once */ if (view->last_processor) view->last_processor->terminate = 1; /*Setup the background processor object */ //proc->eevent = eevent; proc->requestor = comp; proc->count = 0; proc->terminate = 0; proc->user_data = ecore_list_new (); view->last_processor = proc; ecore_list_first_goto (ret); while ((event_file = ecore_list_next (ret))) { //printf("Populating with '%s'\n", event_file->filename); entropy_core_file_cache_add_reference (event_file->md5); ecore_list_append (proc->user_data, event_file); } ecore_idle_enterer_add (idle_add_icons, proc); /*Set the current path from the event source... */ snprintf (view->current_dir, 1024, "%s://%s/%s", request->file->uri_base, request->file->path, request->file->filename); /*Before we begin, see if our file hash is initialized, if so - we must destroy it first */ /*TODO*/ gui_object_destroy_and_free (comp, tmp_gui_hash); ecore_hash_destroy (tmp_icon_hash); /*Clear the view, if there's anything to nuke */ ewl_iconbox_clear (EWL_ICONBOX (view->iconbox)); /*See if there is a custom BG image for this folder */ if (entropy_config_str_get ("iconbox_viewer", view->current_dir)) { ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), entropy_config_str_get ("iconbox_viewer", view-> current_dir)); view->default_bg = 0; } else { /*if (!view->default_bg) { */ ewl_iconbox_background_set (EWL_ICONBOX (view->iconbox), NULL); view->default_bg = 1; } /*Goto the root of the iconbox */ ewl_iconbox_scrollpane_recalculate (EWL_ICONBOX (view->iconbox)); ewl_iconbox_scrollpane_goto_root (EWL_ICONBOX (view->iconbox)); } break; case ENTROPY_NOTIFY_THUMBNAIL_REQUEST:{ /*Only bother if we have a thumbnail, and a component */ if (ret && user_data) { gui_file *obj; entropy_thumbnail *thumb = (entropy_thumbnail *) ret; entropy_icon_viewer *view = comp->data; obj = ecore_hash_get (view->gui_hash, thumb->parent); if (obj) { obj->thumbnail = thumb; /*printf("Received callback notify from notify event..\n"); */ /*Make sure the icon still exists */ /*if (obj->icon) { */ ewl_iconbox_icon_image_set (EWL_ICONBOX_ICON (obj->icon), obj->thumbnail->thumbnail_filename); /*FIXME This is inefficient as all hell - find a better way to do this */ //ewl_iconbox_icon_arrange(EWL_ICONBOX(view->iconbox)); } else { //printf("ERR: Couldn't find a hash reference for this file!\n"); } } } //End case break; case ENTROPY_NOTIFY_FILE_CHANGE:{ //printf ("Received file change event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename); } break; case ENTROPY_NOTIFY_FILE_CREATE:{ //printf ("Received file create event at icon viewer for file %s \n", ((entropy_generic_file*)ret)->filename); ewl_icon_local_viewer_add_icon (comp, (entropy_generic_file *) ret, DO_MIME); } break; case ENTROPY_NOTIFY_FILE_REMOVE_DIRECTORY: case ENTROPY_NOTIFY_FILE_REMOVE:{ printf ("Received a remove file notify\n"); ewl_icon_local_viewer_remove_icon (comp, (entropy_generic_file *) ret); } break; case ENTROPY_NOTIFY_FILE_STAT_EXECUTED:{ //printf("STAT EXECUTED Response back at ewl_icon_local_viewer\n"); } break; case ENTROPY_NOTIFY_USER_INTERACTION_YES_NO_ABORT: { printf("Yes/No/Abort to file copy?\n"); entropy_ewl_user_interaction_dialog_new((entropy_file_operation*)ret); } break; case ENTROPY_NOTIFY_FILE_STAT_AVAILABLE:{ entropy_file_stat *file_stat = (entropy_file_stat *) eevent->return_struct; if (file_stat->file == NULL) { printf ("***** File stat file is null\n"); } ewl_icon_local_viewer_show_stat (file_stat); } break; case ENTROPY_NOTIFY_FILE_PROGRESS:{ entropy_icon_viewer *view = comp->data; entropy_file_progress *progress = ret; if (!view->progress->progress_window) { printf ("Showing progressbar dialog..\n"); ewl_progress_window_create (view->progress); ewl_widget_show (view->progress->progress_window); } if (view->progress->progress_window) { ewl_text_text_set (EWL_TEXT (view->progress->file_from), progress->file_from->filename); ewl_text_text_set (EWL_TEXT (view->progress->file_to), progress->file_to->filename); ewl_progressbar_value_set (EWL_PROGRESSBAR (view->progress->progressbar), progress->progress); } /*Is it time to hide (i.e. end) */ if (progress->type == TYPE_END) { printf ("Hiding progressbar dialog..\n"); ewl_widget_destroy (view->progress->progress_window); view->progress->progress_window = NULL; } } break; } //End switch }