summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2012-11-22 15:34:48 +0200
committerKristian Høgsberg <krh@bitplanet.net>2012-11-23 21:50:14 -0500
commitfb205078819380538e6c0793f10ce603d7368da3 (patch)
tree0dc48985639a4cf66c288c4f93de7db55b13e995 /src
parent0f5d41e3bbc2741c86b4c85f9f52b22cf35aa71b (diff)
client: Add an entry point for dispatching a queue without blocking
On the client side EGL, all the wl_buffer.release events need to be processed before buffer allocation, otherwise a third buffer might be allocated unnecessarily. However, the buffer allocation should not block in the case no event was received. In order to do that, a non-blocking queue dispatch function is needed.
Diffstat (limited to 'src')
-rw-r--r--src/wayland-client.c19
-rw-r--r--src/wayland-client.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 4d0637b..56dbb4f 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -926,6 +926,25 @@ wl_display_dispatch_queue(struct wl_display *display,
return dispatch_queue(display, queue, 1);
}
+/** Dispatch pending events in an event queue
+ *
+ * \param display The display context object
+ * \param queue The event queue to dispatch
+ * \return The number of dispatched events on success or -1 on failure
+ *
+ * Dispatch all incoming events for objects assigned to the given
+ * event queue. On failure -1 is returned and errno set appropriately.
+ * If there are no events queued, this functions return immediately.
+ *
+ * \memberof wl_display
+ */
+WL_EXPORT int
+wl_display_dispatch_queue_pending(struct wl_display *display,
+ struct wl_event_queue *queue)
+{
+ return dispatch_queue(display, queue, 0);
+}
+
/** Process incoming events
*
* \param display The display context object
diff --git a/src/wayland-client.h b/src/wayland-client.h
index 71fe450..8d2b8df 100644
--- a/src/wayland-client.h
+++ b/src/wayland-client.h
@@ -145,6 +145,8 @@ int wl_display_get_fd(struct wl_display *display);
int wl_display_dispatch(struct wl_display *display);
int wl_display_dispatch_queue(struct wl_display *display,
struct wl_event_queue *queue);
+int wl_display_dispatch_queue_pending(struct wl_display *display,
+ struct wl_event_queue *queue);
int wl_display_dispatch_pending(struct wl_display *display);
int wl_display_get_error(struct wl_display *display);