When integrating the wayland event-loop into another event-loop, we
currently have no chance of checking whether there are pending idle
sources that have to be called. This patch exports the
"dispatch_idle_sources()" call so other event loops can call this before
going to sleep. This is what wl_event_loop_dispatch() currently does so we
simply allow external event-loops to do the same now.
To avoid breaking existing applications, we keep the call to
dispatch_idle_sources() in wl_event_loop_dispatch() for now. However, if
we want we can remove this later and require every application to call
this manually. This needs to be discussed, but the overhead is negligible
so we will probably leave it as it is.
This finally allows to fully integrate the wayland-server API into
existing event-loops without any nasty workarounds.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
return n;
}
-static void
-dispatch_idle_sources(struct wl_event_loop *loop)
+WL_EXPORT void
+wl_event_loop_dispatch_idle(struct wl_event_loop *loop)
{
struct wl_event_source_idle *source;
struct wl_event_source *source;
int i, count, n;
- dispatch_idle_sources(loop);
+ wl_event_loop_dispatch_idle(loop);
count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
if (count < 0)
int wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout);
+void wl_event_loop_dispatch_idle(struct wl_event_loop *loop);
struct wl_event_source *wl_event_loop_add_idle(struct wl_event_loop *loop,
wl_event_loop_idle_func_t func,
void *data);