forked from enlightenment/efl
40 lines
1.0 KiB
C
40 lines
1.0 KiB
C
|
/* Ecore Event Handler Example.
|
||
|
*/
|
||
|
|
||
|
#include <Ecore.h>
|
||
|
|
||
|
Ecore_Event_Handler *handler1 = NULL, *handler2 = NULL;
|
||
|
|
||
|
int event_hup(void *data, int ev_type, void *ev)
|
||
|
{
|
||
|
printf("Hup signal! Remove the exit handler.\n");
|
||
|
ecore_event_handler_del(handler1);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int event_exit(void *data, int ev_type, void *ev)
|
||
|
{
|
||
|
Ecore_Event_Signal_Exit *e;
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
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();
|
||
|
}
|