Make ack event signal that the requests have been composited.
diff --git a/wayland.c b/wayland.c
index 766dc0a..c33d135 100644
--- a/wayland.c
+++ b/wayland.c
@@ -19,6 +19,8 @@
struct wl_display *display;
struct wl_list object_list;
struct wl_list link;
+ uint32_t pending_acknowledge;
+ uint32_t acknowledge_key;
};
struct wl_display {
@@ -500,12 +502,8 @@
wl_display_commit(struct wl_client *client,
struct wl_display *display, uint32_t key)
{
- uint32_t event[3];
-
- event[0] = display->base.id;
- event[1] = WL_DISPLAY_ACKNOWLEDGE | ((sizeof event) << 16);
- event[2] = key;
- wl_connection_write(client->connection, event, sizeof event);
+ client->pending_acknowledge = 1;
+ client->acknowledge_key = key;
return 0;
}
@@ -687,6 +685,30 @@
wl_display_send_event(display, p, sizeof p);
}
+WL_EXPORT void
+wl_display_post_acknowledge(struct wl_display *display)
+{
+ struct wl_client *client;
+ uint32_t event[3];
+
+ event[0] = display->base.id;
+ event[1] = WL_DISPLAY_ACKNOWLEDGE | ((sizeof event) << 16);
+
+ client = container_of(display->client_list.next,
+ struct wl_client, link);
+
+ while (&client->link != &display->client_list) {
+ if (client->pending_acknowledge) {
+ event[2] = client->acknowledge_key;
+ wl_connection_write(client->connection,
+ event, sizeof event);
+ client->pending_acknowledge = 0;
+ }
+ client = container_of(client->link.next,
+ struct wl_client, link);
+ }
+}
+
void
wl_display_set_compositor(struct wl_display *display,
struct wl_compositor *compositor)