From 0ea0323d0fb3130e5bc1782812e70993e5cdb742 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Fri, 3 Jan 2020 21:02:12 +0100 Subject: wayland: don't use wl_display_dispatch() wl_display_dispatch() calls poll(), which is unnecessary since we already know the FD is readable. Use the more lower level wl_display_read_events() + wl_display_dispatch_pending(). These require wl_display_prepare_read() to have been called. The idea is to call wl_display_prepare_read() **before** calling poll(). Thus, we do this more or less last in wayl_init(), and at the **end** of the FDM handler. However, having taking this lock also means we no longer can call wl_display_roundtrip() directly (it will hang). So, add a wrapper, wayl_roundtrip(), that cancels the read intent, does the roundtrip, and then re-acquires the read intent. --- wayland.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'wayland.h') diff --git a/wayland.h b/wayland.h index fd0c36e2..eda9e009 100644 --- a/wayland.h +++ b/wayland.h @@ -178,6 +178,8 @@ struct wayland { struct wayland *wayl_init(const struct config *conf, struct fdm *fdm); void wayl_destroy(struct wayland *wayl); +void wayl_roundtrip(struct wayland *wayl); + struct terminal *wayl_terminal_from_surface( struct wayland *wayl, struct wl_surface *surface); -- cgit v1.3