.finalize = NULL,
};
-static gboolean
-_input_event_handler(GIOChannel *source, GIOCondition condition, gpointer user_data)
-{
- uint64_t value;
- E_Input_Event_Source *src = user_data;
-
- if (condition == G_IO_IN)
- {
- int ret = read(src->fd, &value, sizeof(uint64_t));
- e_input_event_process(src);
- }
-
- return TRUE;
-}
-
EINTERN E_Input_Event_Source *
e_input_event_source_create()
{
- int fd = eventfd(0, EFD_CLOEXEC);
- if (fd == -1)
- {
- ERR("Failed to create event fd\n");
- return NULL;
- }
-
E_Input_Event_Source *source = (E_Input_Event_Source *)g_source_new(&_event_source_funcs, sizeof(E_Input_Event_Source));
- source->fd = fd;
- source->data = NULL;
- GIOChannel *ch = g_io_channel_unix_new(source->fd);
-
- g_io_add_watch(ch, G_IO_IN, _input_event_handler, (gpointer)source);
-
source->ev_queue = g_queue_new();
return source;
g_list_free(source->ev_handler_list);
- close(source->fd);
-
/* should be flushed all events in ev_queue before free ev_queue */
g_queue_free(source->ev_queue);
g_source_destroy(&source->gsource);
if (!source) return;
g_queue_push_tail(source->ev_queue, ev);
-
- uint64_t value = 1;
- int ret = write(source->fd, &value, sizeof(uint64_t));
- if (ret == -1)
- ERR("failed to send event. (%p)\n", source);
}
E_API void
ev->free_func_data = free_func_data;
_e_input_event_send(source, ev);
+
+ e_input_event_process(source);
}