server: Add wl_client_flush()
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 29 Jun 2011 15:43:11 +0000 (11:43 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 29 Jun 2011 15:43:11 +0000 (11:43 -0400)
Flush output queue up for the specified client.

wayland/wayland-server.c
wayland/wayland-server.h

index 5875656..176859b 100644 (file)
@@ -58,6 +58,7 @@ struct wl_client {
        struct wl_display *display;
        struct wl_list resource_list;
        uint32_t id_count;
+       uint32_t mask;
        struct wl_list link;
 };
 
@@ -219,6 +220,7 @@ wl_client_connection_update(struct wl_connection *connection,
        struct wl_client *client = data;
        uint32_t emask = 0;
 
+       client->mask = mask;
        if (mask & WL_CONNECTION_READABLE)
                emask |= WL_EVENT_READABLE;
        if (mask & WL_CONNECTION_WRITABLE)
@@ -227,6 +229,13 @@ wl_client_connection_update(struct wl_connection *connection,
        return wl_event_source_fd_update(client->source, emask);
 }
 
+WL_EXPORT void
+wl_client_flush(struct wl_client *client)
+{
+       if (client->mask & WL_CONNECTION_WRITABLE)
+               wl_connection_data(client->connection, WL_CONNECTION_WRITABLE);
+}
+
 WL_EXPORT struct wl_display *
 wl_client_get_display(struct wl_client *client)
 {
index 1fd16eb..69d0d51 100644 (file)
@@ -102,6 +102,7 @@ void wl_client_post_error(struct wl_client *client, struct wl_object *object,
                          uint32_t code, const char *msg, ...);
 void wl_client_post_no_memory(struct wl_client *client);
 void wl_client_post_global(struct wl_client *client, struct wl_object *object);
+void wl_client_flush(struct wl_client *client);
 
 struct wl_visual {
        struct wl_object object;