Ecore Evas Callbacks

Our example is remarkably simple, all it does is create an Ecore_Evas and register a callback for a bunch of events. What's interesting here is knowing when each of these callbacks will be called, however since that depends on the underlying windowing system there are no guarantees that all of the callbacks will be called for your windowing system. To know which callbacks will be called for your windowing system run the example and redirect the output to a file, and take a look at it.

Note
Make sure you minimize, resize, give and remove focus to see more callbacks called.

The example is constituted of two main parts, first is the implementation of callbacks that will be called for each event(all our callbacks do is print their own name) and the second is the main function where we register the event callbacks and run the main loop:

#include <Ecore.h>
#include <Ecore_Evas.h>
static void
_destroy(Ecore_Evas *ee EINA_UNUSED)
{
printf("destroy\n");
}
static void
_delete(Ecore_Evas *ee EINA_UNUSED)
{
printf("delete\n");
}
static void
_focus_in(Ecore_Evas *ee EINA_UNUSED)
{
printf("focus_in\n");
}
static void
_focus_out(Ecore_Evas *ee EINA_UNUSED)
{
printf("focus_out\n");
}
static void
_hide(Ecore_Evas *ee EINA_UNUSED)
{
printf("hide\n");
}
static void
_mouse_in(Ecore_Evas *ee EINA_UNUSED)
{
printf("mouse_in\n");
}
static void
_show(Ecore_Evas *ee EINA_UNUSED)
{
printf("show\n");
}
static void
_mouse_out(Ecore_Evas *ee EINA_UNUSED)
{
printf("mouse_out\n");
}
static void
_move(Ecore_Evas *ee EINA_UNUSED)
{
printf("move\n");
}
static void
_post_render(Ecore_Evas *ee EINA_UNUSED)
{
printf("post_render\n");
}
static void
_pre_free(Ecore_Evas *ee EINA_UNUSED)
{
printf("pre_free\n");
}
static void
_pre_render(Ecore_Evas *ee EINA_UNUSED)
{
printf("pre_render\n");
}
static void
_resize(Ecore_Evas *ee EINA_UNUSED)
{
printf("resize\n");
}
int
main(void)
{
Ecore_Evas *ee;
ee = ecore_evas_new(NULL, 0, 0, 200, 100, NULL);
ecore_evas_title_set(ee, "Ecore Evas Callbacks Example");
evas_object_color_set(bg, 255, 128, 0, 255);
evas_object_resize(bg, 9999, 9999);
//callbacks
return 0;
}
Evas wrapper functions.
EAPI int ecore_evas_init(void)
Inits the Ecore_Evas system.
Definition: ecore_evas.c:602
EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas destroy events.
Definition: ecore_evas.c:1185
EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t)
Sets the title of an Ecore_Evas' window.
Definition: ecore_evas.c:1527
EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas delete request events.
Definition: ecore_evas.c:1176
EAPI void ecore_evas_show(Ecore_Evas *ee)
Shows an Ecore_Evas' window.
Definition: ecore_evas.c:1480
EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas move events.
Definition: ecore_evas.c:1149
EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas pre-free event.
Definition: ecore_evas.c:1286
EAPI Evas * ecore_evas_get(const Ecore_Evas *ee)
Gets an Ecore_Evas's Evas.
Definition: ecore_evas.c:1300
EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas show events.
Definition: ecore_evas.c:1158
EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas mouse post-render events.
Definition: ecore_evas.c:1277
EAPI Ecore_Evas * ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options)
Creates a new Ecore_Evas based on engine name and common parameters.
Definition: ecore_evas.c:1039
EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas resize events.
Definition: ecore_evas.c:1140
EAPI int ecore_evas_shutdown(void)
Shuts down the Ecore_Evas system.
Definition: ecore_evas.c:666
EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas pre-render events.
Definition: ecore_evas.c:1268
EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas hide events.
Definition: ecore_evas.c:1167
EAPI void ecore_evas_free(Ecore_Evas *ee)
Frees an Ecore_Evas.
Definition: ecore_evas.c:1083
EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas focus in events.
Definition: ecore_evas.c:1194
EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas mouse in events.
Definition: ecore_evas.c:1250
EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas focus out events.
Definition: ecore_evas.c:1213
EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, Ecore_Evas_Event_Cb func)
Sets a callback for Ecore_Evas mouse out events.
Definition: ecore_evas.c:1259
void ecore_main_loop_quit(void)
Quits the main loop once all the events currently on the queue have been processed.
Definition: ecore_main.c:1321
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339
EVAS_API void evas_object_show(Evas_Object *eo_obj)
Makes the given Evas object visible.
Definition: evas_object_main.c:1814
EVAS_API void evas_object_color_set(Evas_Object *obj, int r, int g, int b, int a)
Sets the general/main color of the given Evas object to the given one.
Definition: evas_object_main.c:2024
Efl_Canvas_Object Evas_Object
An Evas Object handle.
Definition: Evas_Common.h:185
EVAS_API void evas_object_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
Changes the size of the given Evas object.
Definition: evas_object_main.c:1236
EVAS_API Evas_Object * evas_object_rectangle_add(Evas *e)
Adds a rectangle to the given evas.
Definition: evas_object_rectangle.c:78