summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2011-05-10 17:51:52 +0100
committerKristian Høgsberg <krh@bitplanet.net>2011-05-10 13:07:06 -0400
commitdcfaf4ec2d08a12f0d72f1cb93fd37cf232b0a11 (patch)
treee7f37f29dcd5a7c90e027323d2ed9a41baa40ac4
parenta77498d07c099b96f2cfc18728a1a24430e2e999 (diff)
display: Adds wl_display_flush to send buffered commands
Previously for wayland clients to flush buffered connection data to the compositor they needed to first register an event-mask-update-callback via wl_display_get_fd() to determine if there is anything writeable pending. (NB: It's considered an error to iterate connection data with an invalid mask) Since it's only possible to register a single update callback currently it's a bit awkward if you want to allow multiple orthogonal components to flush the connection data, such as Cogl and Clutter which both want to interact with wayland and may want to flush commands at different times. This adds a mechanism, wl_display_flush(), which makes it possible to flush writeable connection data without first checking the event mask.
-rw-r--r--wayland/wayland-client.c7
-rw-r--r--wayland/wayland-client.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c
index 531807d..59c68f7 100644
--- a/wayland/wayland-client.c
+++ b/wayland/wayland-client.c
@@ -593,6 +593,13 @@ wl_display_iterate(struct wl_display *display, uint32_t mask)
}
}
+WL_EXPORT void
+wl_display_flush(struct wl_display *display)
+{
+ while (display->mask & WL_DISPLAY_WRITABLE)
+ wl_display_iterate (display, WL_DISPLAY_WRITABLE);
+}
+
WL_EXPORT uint32_t
wl_display_allocate_id(struct wl_display *display)
{
diff --git a/wayland/wayland-client.h b/wayland/wayland-client.h
index f1ac797..eefb840 100644
--- a/wayland/wayland-client.h
+++ b/wayland/wayland-client.h
@@ -60,6 +60,7 @@ int wl_display_get_fd(struct wl_display *display,
wl_display_update_func_t update, void *data);
uint32_t wl_display_allocate_id(struct wl_display *display);
void wl_display_iterate(struct wl_display *display, uint32_t mask);
+void wl_display_flush(struct wl_display *display);
int wl_display_sync_callback(struct wl_display *display,
wl_display_sync_func_t func, void *data);
int wl_display_frame_callback(struct wl_display *display,