ecore_event_example_01.c

This example shows how to create an event handler. Explanation: Handling events example

//Compile with:
// gcc -g -Wall -o ecore_event_example_01 ecore_event_example_01.c `pkg-config --cflags --libs ecore`
#include <Ecore.h>
static Eina_Bool
_quitter(void *data EINA_UNUSED, int ev_type EINA_UNUSED, void *event EINA_UNUSED)
{
printf("Leaving already?\n");
ecore_main_loop_quit();
return ECORE_CALLBACK_DONE;
}
int
main(void)
{
ecore_init();
ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, _quitter, NULL);
ecore_main_loop_begin();
return 0;
}
ECORE_EVENT_SIGNAL_EXIT
#define ECORE_EVENT_SIGNAL_EXIT
Exit signal event.
Definition: Ecore_Common.h:565
ecore_event_handler_add
Ecore_Event_Handler * ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
Adds an event handler.
Definition: ecore_events.c:13
ecore_init
EAPI int ecore_init(void)
Sets up connections, signal handlers, sockets etc.
Definition: ecore.c:230
ECORE_CALLBACK_DONE
#define ECORE_CALLBACK_DONE
Return value to stop event handling.
Definition: Ecore_Common.h:156
ecore_main_loop_quit
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
ecore_main_loop_begin
void ecore_main_loop_begin(void)
Runs the application main loop.
Definition: ecore_main.c:1311
Eina_Bool
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
EINA_UNUSED
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339