2004-05-12 19:40:58 -07:00
|
|
|
/* Ecore Event Handler Example. */
|
2004-05-07 21:44:04 -07:00
|
|
|
#include <Ecore.h>
|
|
|
|
|
|
|
|
Ecore_Event_Handler *handler1 = NULL, *handler2 = NULL;
|
|
|
|
|
|
|
|
int event_hup(void *data, int ev_type, void *ev)
|
|
|
|
{
|
2004-05-12 19:40:58 -07:00
|
|
|
printf("Hup signal! Remove the exit handler.\n");
|
|
|
|
if (handler1)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(handler1);
|
|
|
|
handler1 = NULL;
|
|
|
|
}
|
|
|
|
return 0;
|
2004-05-07 21:44:04 -07:00
|
|
|
}
|
2004-05-12 19:40:58 -07:00
|
|
|
|
2004-05-07 21:44:04 -07:00
|
|
|
int event_exit(void *data, int ev_type, void *ev)
|
|
|
|
{
|
2004-05-12 19:40:58 -07:00
|
|
|
Ecore_Event_Signal_Exit *e;
|
2004-05-07 21:44:04 -07:00
|
|
|
|
2004-05-12 19:40:58 -07:00
|
|
|
e = (Ecore_Event_Signal_Exit *)ev;
|
|
|
|
printf("This callback handles event type: %i\n", ECORE_EVENT_SIGNAL_EXIT);
|
|
|
|
printf("Event type recieved: %i\n", ev_type);
|
|
|
|
if (e->interrupt) printf("Exit: interrupt\n");
|
|
|
|
if (e->quit) printf("Exit: quit\n");
|
|
|
|
if (e->terminate) printf("Exit: terminate\n");
|
|
|
|
ecore_main_loop_quit();
|
|
|
|
return 1;
|
2004-05-07 21:44:04 -07:00
|
|
|
}
|
2004-05-12 19:40:58 -07:00
|
|
|
|
2004-05-07 21:44:04 -07:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2004-05-12 19:40:58 -07:00
|
|
|
ecore_init();
|
|
|
|
ecore_app_args_set(argc, argv);
|
|
|
|
handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT,
|
|
|
|
event_exit, NULL);
|
|
|
|
handler2 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_HUP,
|
|
|
|
event_hup, NULL);
|
|
|
|
ecore_main_loop_begin();
|
|
|
|
ecore_shutdown();
|
2004-05-07 21:44:04 -07:00
|
|
|
}
|