From abc36d8f090dbae1b127f74a83b601d3fa3c8bed Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 4 Jan 2020 21:10:08 +0100 Subject: wayland: wl_display_flush() never blocks Since it doesn't block, we need to detect EAGAIN failures and ensure we actually flush everything. If we don't, we sooner or later end up in a wayland client library call that aborts due to the socket buffer being full. Ideally, we'd simply enable POLLOUT in the FDM. However, we cannot write *anything* to the wayland socket until we've actually managed to send everything. This means enabling POLLOUT in the FDM wont work since we may (*will*) end up trying to write more data to it before we've flushed it. So, add a wrapper function, wayl_flush(), that acts as a blocking variant of wl_display_flush(), by detecting EAGAIN failiures and calling poll() itself, on the wayland socket only, until all data has been sent. --- wayland.h | 1 + 1 file changed, 1 insertion(+) (limited to 'wayland.h') diff --git a/wayland.h b/wayland.h index eda9e009..ad352797 100644 --- a/wayland.h +++ b/wayland.h @@ -178,6 +178,7 @@ struct wayland { struct wayland *wayl_init(const struct config *conf, struct fdm *fdm); void wayl_destroy(struct wayland *wayl); +void wayl_flush(struct wayland *wayl); void wayl_roundtrip(struct wayland *wayl); struct terminal *wayl_terminal_from_surface( -- cgit v1.3